Merge pull request #4778 from dataease/pr@dev@perf_mobile_multi_login

perf(登录): 移动端禁止多端登录
This commit is contained in:
fit2cloud-chenyw 2023-03-14 15:10:45 +08:00 committed by GitHub
commit 160c4844cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 32 additions and 15 deletions

View File

@ -2007,6 +2007,7 @@ export default {
bus.$off('show-quota-edit-filter', this.showQuotaEditFilter)
bus.$off('show-quota-edit-compare', this.showQuotaEditCompare)
bus.$off('show-edit-filter', this.showEditFilter)
bus.$off('show-edit-formatter', this.valueFormatter)
bus.$off('calc-data', this.calcData)
bus.$off('plugins-calc-style', this.calcStyle)
bus.$off('plugin-chart-click', this.chartClick)
@ -2077,6 +2078,7 @@ export default {
bus.$on('show-quota-edit-filter', this.showQuotaEditFilter)
bus.$on('show-quota-edit-compare', this.showQuotaEditCompare)
bus.$on('show-edit-filter', this.showEditFilter)
bus.$on('show-edit-formatter', this.valueFormatter)
bus.$on('calc-data', this.calcData)
bus.$on('plugins-calc-style', this.calcStyle)
bus.$on('plugin-chart-click', this.chartClick)

View File

@ -60,10 +60,13 @@ checkAuth(error.response)
} else {
msg = error.message
}
if (msg?.startsWith('MultiLoginError')) {
return Promise.reject(error)
}
uni.showToast({
icon: 'error',
title: msg
});
})
return Promise.reject(error)
})
const logout = () => {

View File

@ -31,7 +31,8 @@
"loginbtn": "Login",
"pwdFmtError": "Password Must More Than 6 Characters",
"uOrpwdError": "Invalid Account Or Password",
"accFmtError": "Account Must More Than 1 Characters"
"accFmtError": "Account Must More Than 1 Characters",
"multiLogin": "The current account is online,Prohibit multi-terminal login"
},
"home": {
"tab1": "My Favorites",

View File

@ -31,7 +31,8 @@
"loginbtn": "登录",
"pwdFmtError": "密码最短为1个字符",
"accFmtError": "账号最短为1个字符",
"uOrpwdError": "无效账号或密码"
"uOrpwdError": "无效账号或密码",
"multiLogin": "当前账号已在线,禁止多端登录"
},
"home": {
"tab1": "我的收藏",

View File

@ -32,7 +32,8 @@
"loginbtn": "登錄",
"pwdFmtError": "密碼最短為6個字符",
"uOrpwdError": "無效賬號或密碼",
"accFmtError": "帳號最短為1個字符"
"accFmtError": "帳號最短為1個字符",
"multiLogin": "當前賬號已在線,禁止多端登錄"
},
"home": {
"tab1": "我的收藏",

View File

@ -106,9 +106,13 @@
}).catch(error => {
this.loginBtnLoading = false
let msg = error.response.data.message
if (msg?.startsWith('MultiLoginError')) {
msg = this.$t('login.multiLogin')
}
uni.showToast({
icon: 'error',
title: error.response.data.message,
title: msg,
});
})
},

View File

@ -36,7 +36,8 @@
</template>
<script>
import { setToken, getLanguage } from '@/common/utils'
import {getUserInfo, setUserInfo} from '@/common/utils'
import { getUserInfo, setUserInfo } from '@/common/utils'
import { logout } from '@/api/auth'
export default {
data() {
return {
@ -85,11 +86,15 @@ export default {
});
},
logout() {
setToken(null)
setUserInfo(null)
uni.reLaunch({
url: '/'
});
const callBack = () => {
setToken(null)
setUserInfo(null)
uni.reLaunch({
url: '/'
});
}
logout().then(res => {callBack()}).catch(e => {callBack()})
}
}
}

View File

@ -5,10 +5,10 @@ module.exports = {
LinkTokenKey: 'LINK-PWD-TOKEN',
title: 'DataEase',
WHITE_LIST: [
'/api/auth/login',
'/api/auth/getPublicKey',
'/system/ui/info',
'/system/ui/image/'
'/api/auth/login',
'/api/auth/getPublicKey',
'/system/ui/info',
'/system/ui/image/'
],
RECENT_KEY: 'recently',