用户登录优化
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
a0ec36ac28
commit
54df1b8504
|
@ -91,12 +91,12 @@ const actions = {
|
||||||
zzSessionStorage.setItem('my_username', username.trim())
|
zzSessionStorage.setItem('my_username', username.trim())
|
||||||
zzSessionStorage.setItem('my_password', md5(password))
|
zzSessionStorage.setItem('my_password', md5(password))
|
||||||
const data = response.Result
|
const data = response.Result
|
||||||
if (data.BasicInfo.IsFirstAdd) {
|
if (data.BasicInfo.IsFirstAdd || data.BasicInfo.LoginState === 1) {
|
||||||
try {
|
try {
|
||||||
zzSessionStorage.setItem('userId', data.BasicInfo.Id)
|
zzSessionStorage.setItem('userId', data.BasicInfo.Id)
|
||||||
commit('SET_TOKEN', data.JWTStr)
|
commit('SET_TOKEN', data.JWTStr)
|
||||||
setToken(data.JWTStr)
|
setToken(data.JWTStr)
|
||||||
resolve(false)
|
resolve(response.Result)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,13 +246,25 @@ export default {
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.showCode = false
|
this.showCode = false
|
||||||
this.$store.dispatch('user/login', this.loginForm).then((res) => {
|
this.$store.dispatch('user/login', this.loginForm).then((res) => {
|
||||||
if (!res) {
|
if (res.BasicInfo.IsFirstAdd) {
|
||||||
// 当前用户为首次登录,请先修改密码之后再次登录
|
// 当前用户为首次登录,请先修改密码之后再次登录
|
||||||
this.$message.success(this.$t('login:message:login1'))
|
this.$message.success(this.$t('login:message:login1'))
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$router.push({ path: `/recompose?userName=${this.loginForm.username}` })
|
this.$router.push({ path: `/recompose?userName=${this.loginForm.username}` })
|
||||||
}, 500)
|
}, 500)
|
||||||
return
|
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.$store.dispatch('permission/generateRoutes').then(res => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
|
|
Loading…
Reference in New Issue