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
})
if (response.data.code === 80001) {
// localStorage.clear()
localStorage.setItem('DE-GATEWAY-FLAG', response.data.msg)
localStorage.clear()
let queryRedirectPath = '/workbranch/index'
if (router.currentRoute.value.fullPath) {
queryRedirectPath = router.currentRoute.value.fullPath as string

View File

@ -82,7 +82,7 @@ const formRef = ref<FormInstance | undefined>()
const duringLogin = ref(false)
const handleLogin = () => {
if (!formRef.value) return
formRef.value.validate((valid: boolean) => {
formRef.value.validate(async (valid: boolean) => {
if (valid) {
if (!checkUsername(state.loginForm.username) || !validatePwd(state.loginForm.password)) {
ElMessage.error('用户名或密码错误')
@ -90,6 +90,10 @@ const handleLogin = () => {
}
const name = state.loginForm.username.trim()
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) }
duringLogin.value = true
cleanPlatformFlag()