Browse Source

feat:[登录] 只允许同时1个地方登录

luojie
memorylkf 3 weeks ago
parent
commit
72f0e0a865
4 changed files with 24 additions and 6 deletions
  1. +2
    -1
      src/lang/en.js
  2. +2
    -1
      src/lang/zh.js
  3. +3
    -1
      src/utils/request.js
  4. +17
    -3
      src/views/login.vue

+ 2
- 1
src/lang/en.js View File

@ -2,7 +2,8 @@ export default {
system: { system: {
title: 'HXHQ', title: 'HXHQ',
tip: 'prompt', tip: 'prompt',
logOut: 'Are you sure to log out and exit the system?'
logOut: 'Are you sure to log out and exit the system?',
crowdOut: '该账户已在其他地方登录,是否继续登录,继续登录挤掉原登录账号'
}, },
form: { form: {
search: 'search', search: 'search',

+ 2
- 1
src/lang/zh.js View File

@ -2,7 +2,8 @@ export default {
system: { system: {
title: '华西海圻管理系统', title: '华西海圻管理系统',
tip: '提示', tip: '提示',
logOut: '确认注销并退出系统吗?'
logOut: '确认注销并退出系统吗?',
crowdOut: '该账户已在其他地方登录,是否继续登录,继续登录挤掉原登录账号'
}, },
form: { form: {
search: '查询', search: '查询',

+ 3
- 1
src/utils/request.js View File

@ -129,7 +129,9 @@ service.interceptors.response.use(
} }
return Promise.reject('无效的会话,或者会话已过期,请重新登录。') return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
} else if (code === 500) { } else if (code === 500) {
Message({ message: msg, type: 'error' })
if (msg !== 'exists') {
Message({ message: msg, type: 'error' })
}
return Promise.reject(new Error(msg)) return Promise.reject(new Error(msg))
} else if (code === 601) { } else if (code === 601) {
Message({ message: msg, type: 'warning' }) Message({ message: msg, type: 'warning' })

+ 17
- 3
src/views/login.vue View File

@ -78,8 +78,8 @@ export default {
footerContent: defaultSettings.footerContent, footerContent: defaultSettings.footerContent,
codeUrl: "", codeUrl: "",
loginForm: { loginForm: {
username: "admin",
password: "admin123",
username: "",
password: "",
rememberMe: false, rememberMe: false,
code: "", code: "",
uuid: "", uuid: "",
@ -152,9 +152,23 @@ export default {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{}); this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}).catch(err => { }).catch(err => {
if(err && err.message==='exists'){ if(err && err.message==='exists'){
this.$confirm(this.$t('system.crowdOut'), this.$t('system.tip'), {
confirmButtonText: this.$t('form.confirm'),
cancelButtonText: this.$t('form.cancel'),
type: 'warning'
}).then(() => {
this.loginForm.force = true
this.handleLogin()
}).catch(() => {
this.loading = false;
this.loginForm.force = false
if (this.captchaEnabled) {
this.getCode();
}
})
}else{ }else{
this.loading = false; this.loading = false;
this.loginForm.force = false
if (this.captchaEnabled) { if (this.captchaEnabled) {
this.getCode(); this.getCode();
} }

Loading…
Cancel
Save