接入登录

This commit is contained in:
2025-06-19 16:48:26 +08:00
parent 342c482c6c
commit 33ef7f5cdb
6 changed files with 54 additions and 44 deletions

View File

@@ -93,8 +93,8 @@ export default {
data() {
return {
phoneNo:'',
username: '',
password: '',
username: 'admin',
password: 'admin123',
loginType: 'currentPhone',
showPassword: false,
remember: true,
@@ -164,7 +164,7 @@ export default {
}
});
},
submit(loginType) {
async submit(loginType) {
if (this.username.length == 0) {
this.$u.toast('请输入账号');
return;
@@ -173,28 +173,34 @@ export default {
this.$u.toast('请输入密码');
return;
}
this.$u.api.login({
username: this.username,
password: this.password,
validCode: this.validCode,
loginType: loginType
})
.then(res => {
if(res.msg){
this.$u.toast(res.msg);
}
if (res.code == '200') {
setTimeout(() => {
uni.reLaunch({
url: '/pages/sys/msg/index'
});
}, 500);
}
if (res.isValidCodeLogin){
this.isValidCodeLogin = true;
this.refreshImgValidCode();
}
// this.$u.api.login(
// {
// "tenantId": '000000',
// "username": this.username,
// "password": this.password,
// "grantType": "password",
// "uuid": "7cb3ea4fe2ae4f08bbd561c94ef0191b",
// "clientId": "dab457a1ea14411787c240db05bb0832"
// }
// )
let res=await this.$u.api.login({
"tenantId": "000000", // 把单引号换成双引号
"username": this.username,
"password": this.password,
"grantType": "password",
"uuid": "7cb3ea4fe2ae4f08bbd561c94ef0191b",
"clientId": "dab457a1ea14411787c240db05bb0832"
});
console.log(res)
if (res.code=="200"){
this.$u.toast("登录成功")
this.$u.access_token=res.data.access_token
setTimeout(() => {
uni.reLaunch({
url: '/pages/sys/msg/index'
});
}, 500);
}
},
wxLogin(res) {
this.$u.toast('微信登录');