用户登录优化
continuous-integration/drone/push Build is passing Details

uat_us
caiyiling 2024-05-16 13:53:48 +08:00
parent a0ec36ac28
commit 54df1b8504
2 changed files with 15 additions and 3 deletions

View File

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

View File

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