|
@@ -9,7 +9,7 @@
|
|
<view class="login-body">
|
|
<view class="login-body">
|
|
<view class="input-container">
|
|
<view class="input-container">
|
|
<uni-icons type="auth" size="30" class="input-icon"></uni-icons>
|
|
<uni-icons type="auth" size="30" class="input-icon"></uni-icons>
|
|
- <input type="text" v-model="username" placeholder="请输入用户名" class="input-item-1" />
|
|
|
|
|
|
+ <input type="text" v-model="userName" placeholder="请输入用户名" class="input-item-1" />
|
|
</view>
|
|
</view>
|
|
<view class="input-container">
|
|
<view class="input-container">
|
|
<uni-icons type="locked" size="30" class="input-icon"></uni-icons>
|
|
<uni-icons type="locked" size="30" class="input-icon"></uni-icons>
|
|
@@ -18,46 +18,55 @@
|
|
<view class="login-change">
|
|
<view class="login-change">
|
|
<checkbox-group>
|
|
<checkbox-group>
|
|
<label class="checkbox-zhanghao">
|
|
<label class="checkbox-zhanghao">
|
|
- <checkbox value="cb" color="#0550e5" checked="true" />记住此账号
|
|
|
|
|
|
+ <checkbox value="cb" color="#0550e5" checked="true"/>记住此账号
|
|
</label>
|
|
</label>
|
|
</checkbox-group>
|
|
</checkbox-group>
|
|
- <text class="checkbox-zhanghao">
|
|
|
|
- 忘记密码?
|
|
|
|
- </text>
|
|
|
|
|
|
+ <text class="checkbox-zhanghao" @click="forgetPassword"> 忘记密码?</text>
|
|
</view>
|
|
</view>
|
|
<button class="login-btn" @click="handleLogin">登录</button>
|
|
<button class="login-btn" @click="handleLogin">登录</button>
|
|
</view>
|
|
</view>
|
|
|
|
+ <passwordLli ref="passLLiRef" :password="password" @lli-password="onLliPassword" />
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
- import {
|
|
|
|
- getAppConfig,
|
|
|
|
- login,
|
|
|
|
- kaoshiList
|
|
|
|
- } from '@/api/login.js'
|
|
|
|
|
|
+ import {toast} from "@/utils/common";
|
|
|
|
+ import {getAppConfig,login,kaoshiList} from '@/api/login.js'
|
|
|
|
+ import passwordLli from "@/components/password-lli/password-lli.vue";
|
|
import JSEncrypt from 'jsencrypt';
|
|
import JSEncrypt from 'jsencrypt';
|
|
- import {
|
|
|
|
- ref
|
|
|
|
- } from 'vue';
|
|
|
|
|
|
+ import {ref} from 'vue';
|
|
|
|
+ const passLLiRef = ref(null)
|
|
let systemName = ref('麦塔考试系统')
|
|
let systemName = ref('麦塔考试系统')
|
|
- let username = ref('')
|
|
|
|
|
|
+ let userName = ref('')
|
|
let password = ref('')
|
|
let password = ref('')
|
|
- // 密码公钥
|
|
|
|
- const publicKey ='MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1xwHUB9shgHJlVbs3/LK8CbUa0KMrSfw/M2SAdXpy/iYvwyMacigKNkCi+fiLGcnBigzwO9WtiT/oceF431UsJs2MqLS2ZPzaL+BktR9zWWtNAsZpxUfGyI3YT+T7TT94Rs9O80896FHx9MvE1cHR2bvybskgfB2zuzd9c96+yZ9KXebhbIwDZpMW0fwx7vZ+OywTL3/6SSg2pRf+AvHQsBfTPVbMSgIQegAL4WocD2PerpSGlFElnzZT8jKM4TqDVyhfsYT+4/Gi7/RDDCngdtmruCUIoz8OCLfjVrBsvHfuNNBFIwjTbxtWhrRhVii+wz7RfNxT9+pU/3sjIRKtwIDAQAB'
|
|
|
|
- const encrypt = new JSEncrypt();
|
|
|
|
- encrypt.setPublicKey(publicKey);
|
|
|
|
- const changePassword = () => {
|
|
|
|
-
|
|
|
|
|
|
+ const lliPassword = ref('') // 加密后的密码
|
|
|
|
+ // 加密
|
|
|
|
+ function onLliPassword(password) {
|
|
|
|
+ console.log('onLliPassword',password)
|
|
|
|
+ lliPassword.value = password;
|
|
}
|
|
}
|
|
- const handleLogin = () => {
|
|
|
|
- console.log('Username:', username.value);
|
|
|
|
- console.log('Password:', password.value);
|
|
|
|
|
|
+
|
|
|
|
+ function handleLogin(){
|
|
|
|
+ if(userName.value.length ===0){
|
|
|
|
+ toast('请输入手机号!')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(password.value.length ===0){
|
|
|
|
+ toast('请输入密码!')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 去除 userName 两端的空格
|
|
|
|
+ const trimmedUserName = userName.value.trim();
|
|
|
|
+ const trimmedPassword = lliPassword.value.trim();
|
|
|
|
+
|
|
let req = {
|
|
let req = {
|
|
- password: 'sslQR4MPhS/du9qQ7/sRc6OFaVIZ0GwHDWmgAhUj08+BBlTzo+kEMgfgi0rrLFx59mrK5ypJc71Ojn3bHciHSlRGcIJex80RHVQyknC1i1HnkQ1T6vgKWBFHISQpd9qEo2fXCEYSRh8Rl3/qfO8XD5NuCrQxqF/REaVUX3fLVB8=',
|
|
|
|
- //password: encrypt.encrypt(password.value),
|
|
|
|
- userName: 'root'
|
|
|
|
|
|
+ userName: trimmedUserName,
|
|
|
|
+ password: trimmedPassword,
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ console.log('req:', req);
|
|
login(req).then(res => {
|
|
login(req).then(res => {
|
|
let obj = JSON.stringify(res.data)
|
|
let obj = JSON.stringify(res.data)
|
|
console.log(obj)
|
|
console.log(obj)
|
|
@@ -68,18 +77,12 @@
|
|
uni.switchTab({
|
|
uni.switchTab({
|
|
url: '/pages/index/index'
|
|
url: '/pages/index/index'
|
|
});
|
|
});
|
|
- // setTimeout(() => {
|
|
|
|
- // let req = {
|
|
|
|
- // 'page': 1,
|
|
|
|
- // 'size': 4,
|
|
|
|
- // 'status': 1,
|
|
|
|
- // }
|
|
|
|
- // kaoshiList(req).then(res => {
|
|
|
|
- // console.log(res)
|
|
|
|
- // })
|
|
|
|
- // }, 5000)
|
|
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ function forgetPassword(){
|
|
|
|
+ toast('请联系管理员修改密码!');
|
|
|
|
+ }
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|