登录过期重复跳转问题彻底修复

This commit is contained in:
jianzhichu
2026-01-15 01:14:07 +08:00
parent ff80250012
commit f376498fe5
5 changed files with 45 additions and 110 deletions
+16 -14
View File
@@ -47,22 +47,24 @@ http.interceptors.response.use(
const accountStore = useAccountStore();
accountStore.setLogged(false);
message.warning('登录状态已过期,请重新登录');
setTimeout(() => {
const redirectPath = router.currentRoute.value.fullPath;
if (redirectPath !== '/login') {
router.push({
path: '/login',
query: { redirect: redirectPath }
}).then(() => {
console.log('跳转登录页成功');
}).catch((err) => {
console.error('跳转登录页失败:', err);
}).finally(() => {
const redirectPath = router.currentRoute.value.fullPath;
if (redirectPath !== '/login') {
router.push({
path: '/login',
query: { redirect: redirectPath }
}).then(() => {
console.log('跳转登录页成功');
}).catch((err) => {
console.error('跳转登录页失败:', err);
}).finally(() => {
isRedirecting = false;
});
} else {
isRedirecting = false;
});
} else {
isRedirecting = false;
}
}
}, 100);
}
// 新增结束
} else {