From ed6da1696e9a26010285b11b2bb23ac8c1aa8b3a Mon Sep 17 00:00:00 2001 From: binbin_pan Date: Wed, 5 Jun 2024 14:52:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=8E=E6=96=87=E5=8A=A0=E8=A7=A3=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sgzb-ui/src/store/modules/user.js | 3 ++- sgzb-ui/src/views/newLogin.vue | 14 ++++++-------- sgzb-ui/src/views/resetPassword.vue | 10 ++++------ sgzb-ui/src/views/system/user/index.vue | 7 ++++--- sgzb-ui/src/views/system/user/profile/resetPwd.vue | 7 ++++++- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/sgzb-ui/src/store/modules/user.js b/sgzb-ui/src/store/modules/user.js index 3a2915f2..55931659 100644 --- a/sgzb-ui/src/store/modules/user.js +++ b/sgzb-ui/src/store/modules/user.js @@ -48,7 +48,7 @@ const user = { return new Promise((resolve, reject) => { login(username, password, code, uuid).then(res => { let data = res.data - localStorage.setItem('isCode', res.data.code) + localStorage.setItem('isCode', data.code || '') setToken(data.access_token) commit('SET_TOKEN', data.access_token) localStorage.setItem('token', data.access_token) @@ -154,6 +154,7 @@ const user = { commit('SET_TOKEN', '') commit('SET_ROLES', []) commit('SET_PERMISSIONS', []) + localStorage.removeItem('isCode') removeToken() resolve() }).catch(error => { diff --git a/sgzb-ui/src/views/newLogin.vue b/sgzb-ui/src/views/newLogin.vue index bb28c4b7..6eb5336e 100644 --- a/sgzb-ui/src/views/newLogin.vue +++ b/sgzb-ui/src/views/newLogin.vue @@ -507,15 +507,13 @@ export default { this.$store .dispatch('Login', this.loginForm) .then(() => { - // if (localStorage.getItem('isCode') == 1) { - // this.$router - // .push({ path: '/resetPassword' }) - // .catch(() => {}) - // } else { - // this.$router.push({ path: '/' }).catch(() => {}) - // } + if (localStorage.getItem('isCode') == 1) { + this.$router.push({ path: '/resetPassword' }).catch(() => {}) + } else { + this.$router.push({ path: '/' }).catch(() => {}) + } - this.$router.push({ path: '/' }).catch(() => {}) + // this.$router.push({ path: '/' }).catch(() => {}) }) .catch(() => { this.loading = false diff --git a/sgzb-ui/src/views/resetPassword.vue b/sgzb-ui/src/views/resetPassword.vue index a39db898..c685a80a 100644 --- a/sgzb-ui/src/views/resetPassword.vue +++ b/sgzb-ui/src/views/resetPassword.vue @@ -48,12 +48,11 @@