feat: 新增token过期 跳出提示框 并跳转登录页的逻辑

This commit is contained in:
valarchie
2023-07-07 18:07:13 +08:00
parent de5550e216
commit d0d9bee8b7
6 changed files with 79 additions and 26 deletions

View File

@@ -122,7 +122,8 @@ router.beforeEach((to: ToRouteType, _from, next) => {
}
/** 如果已经登录并存在登录信息后不能跳转到路由白名单,而是继续保持在当前页面 */
function toCorrectRoute() {
whiteList.includes(to.fullPath) ? next(_from.fullPath) : next();
/** 新增判断是否存在登录信息 */
whiteList.includes(to.fullPath) && userInfo ? next(_from.fullPath) : next();
}
if (userInfo) {
// 无权限跳转403页面