From 8659e0cf78c3ee5e9304da6e8089c1f10b451588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=94=A1=E7=8E=B2?= <8702040+cai-ling@user.noreply.gitee.com> Date: Tue, 24 Dec 2024 10:05:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/login/login.vue | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/pages/login/login.vue b/pages/login/login.vue index 88a3f9e..5c52e1a 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -77,16 +77,23 @@ } try { let res = await handLogin(this.user, RSAencrypt(this.password)) - if (this.saveUser) { - this.$store.dispatch('saveLoginName', this.user) + if (res.code === '200') { + 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 { - 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 } catch (e) { this.disabled = false