From 54df1b8504b78e1ad2f81214db360785efa179d4 Mon Sep 17 00:00:00 2001 From: caiyiling <1321909229@qq.com> Date: Thu, 16 May 2024 13:53:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=99=BB=E5=BD=95=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.js | 4 ++-- src/views/login/index.vue | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 3563527e..c9cfdae0 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -91,12 +91,12 @@ const actions = { zzSessionStorage.setItem('my_username', username.trim()) zzSessionStorage.setItem('my_password', md5(password)) const data = response.Result - if (data.BasicInfo.IsFirstAdd) { + if (data.BasicInfo.IsFirstAdd || data.BasicInfo.LoginState === 1) { try { zzSessionStorage.setItem('userId', data.BasicInfo.Id) commit('SET_TOKEN', data.JWTStr) setToken(data.JWTStr) - resolve(false) + resolve(response.Result) } catch (e) { console.log(e) } diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 2cbf01c9..f8f3fa01 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -246,13 +246,25 @@ export default { this.loading = true this.showCode = false this.$store.dispatch('user/login', this.loginForm).then((res) => { - if (!res) { + if (res.BasicInfo.IsFirstAdd) { // 当前用户为首次登录,请先修改密码之后再次登录 this.$message.success(this.$t('login:message:login1')) setTimeout(() => { this.$router.push({ path: `/recompose?userName=${this.loginForm.username}` }) }, 500) return + }else if (res.BasicInfo.LoginState === 1) { + // 请先修改密码后再登录! + this.$alert(this.$t('login:message:login3'), this.$t('common:title:warning'), { + callback: action => { + this.$router.push({ path: `/recompose?userName=${this.loginForm.username}` }) + return + } + }) + return + }else if (res.BasicInfo.LoginState === 2) { + // 本次登录的IP或设备与上次不一致,请确认' + this.$alert(this.$t('login:message:login4')) } this.$store.dispatch('permission/generateRoutes').then(res => { this.loading = false