登录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 (res.code === '200') {
if (this.saveUser) { if (this.saveUser) {
this.$store.dispatch('saveLoginName', this.user) this.$store.dispatch('saveLoginName', this.user)
} else { } else {
this.$store.dispatch('delLoginName', '') this.$store.dispatch('delLoginName', '')
} }
this.$store.dispatch('saveUserInfo', JSON.stringify(res.user.user)) this.$store.dispatch('saveUserInfo', JSON.stringify(res.data.user))
this.$store.dispatch('saveToken', res.token) this.$store.dispatch('saveToken', res.token)
uni.redirectTo({ uni.redirectTo({
url: '/pages/home/home' url: '/pages/home/home'
}) })
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
this.disabled = false this.disabled = false
} catch (e) { } catch (e) {
this.disabled = false this.disabled = false