登录bug

This commit is contained in:
蔡玲
2024-12-24 10:05:14 +08:00
parent 1a153dd60c
commit 8659e0cf78

View File

@@ -77,16 +77,23 @@
} }
try { try {
let res = await handLogin(this.user, RSAencrypt(this.password)) let res = await handLogin(this.user, RSAencrypt(this.password))
if (this.saveUser) { if (res.code === '200') {
this.$store.dispatch('saveLoginName', this.user) if (this.saveUser) {
this.$store.dispatch('saveLoginName', this.user)
} else {
this.$store.dispatch('delLoginName', '')
}
this.$store.dispatch('saveUserInfo', JSON.stringify(res.data.user))
this.$store.dispatch('saveToken', res.token)
uni.redirectTo({
url: '/pages/home/home'
})
} else { } else {
this.$store.dispatch('delLoginName', '') uni.showToast({
title: res.msg,
icon: 'none'
})
} }
this.$store.dispatch('saveUserInfo', JSON.stringify(res.user.user))
this.$store.dispatch('saveToken', res.token)
uni.redirectTo({
url: '/pages/home/home'
})
this.disabled = false this.disabled = false
} catch (e) { } catch (e) {
this.disabled = false this.disabled = false