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 @@