合并代码

This commit is contained in:
szz
2025-08-11 09:40:54 +08:00
parent b91560ccbe
commit 50e205e776
9 changed files with 2279 additions and 100 deletions

View File

@@ -64,11 +64,20 @@ api.interceptors.response.use(
switch (status) {
case 401:
// 未授权清除token并跳转到登录页
// 未授权清除token并根据当前路由跳转到相应的登录页
localStorage.removeItem('token')
localStorage.removeItem('agentInfo') // 清除代理信息
delete api.defaults.headers.common['Authorization']
router.push({ name: 'Login' })
ElMessage.error('登录已过期,请重新登录')
// 判断当前是否在代理相关页面
const currentPath = router.currentRoute.value.path
if (currentPath.startsWith('/agent')) {
router.push('/agent/login')
ElMessage.error('代理登录已过期,请重新登录')
} else {
router.push({ name: 'Login' })
ElMessage.error('登录已过期,请重新登录')
}
break
case 403: