fix: 受限用户浏览器循环刷新错误

This commit is contained in:
fit2cloud-chenyw 2023-12-04 13:28:46 +08:00
parent 36e03c5f3e
commit 375d6b984c
2 changed files with 6 additions and 3 deletions

View File

@ -144,8 +144,7 @@ service.interceptors.response.use(
showClose: true showClose: true
}) })
if (response.data.code === 80001) { if (response.data.code === 80001) {
// localStorage.clear() localStorage.clear()
localStorage.setItem('DE-GATEWAY-FLAG', response.data.msg)
let queryRedirectPath = '/workbranch/index' let queryRedirectPath = '/workbranch/index'
if (router.currentRoute.value.fullPath) { if (router.currentRoute.value.fullPath) {
queryRedirectPath = router.currentRoute.value.fullPath as string queryRedirectPath = router.currentRoute.value.fullPath as string

View File

@ -82,7 +82,7 @@ const formRef = ref<FormInstance | undefined>()
const duringLogin = ref(false) const duringLogin = ref(false)
const handleLogin = () => { const handleLogin = () => {
if (!formRef.value) return if (!formRef.value) return
formRef.value.validate((valid: boolean) => { formRef.value.validate(async (valid: boolean) => {
if (valid) { if (valid) {
if (!checkUsername(state.loginForm.username) || !validatePwd(state.loginForm.password)) { if (!checkUsername(state.loginForm.username) || !validatePwd(state.loginForm.password)) {
ElMessage.error('用户名或密码错误') ElMessage.error('用户名或密码错误')
@ -90,6 +90,10 @@ const handleLogin = () => {
} }
const name = state.loginForm.username.trim() const name = state.loginForm.username.trim()
const pwd = state.loginForm.password const pwd = state.loginForm.password
if (!wsCache.get(appStore.getDekey)) {
const res = await queryDekey()
wsCache.set(appStore.getDekey, res.data)
}
const param = { name: rsaEncryp(name), pwd: rsaEncryp(pwd) } const param = { name: rsaEncryp(name), pwd: rsaEncryp(pwd) }
duringLogin.value = true duringLogin.value = true
cleanPlatformFlag() cleanPlatformFlag()