|
@@ -54,7 +54,9 @@ function setupAccessGuard(router: Router) {
|
|
|
if (coreRouteNames.includes(to.name as string)) {
|
|
|
if (to.path === LOGIN_PATH && accessStore.accessToken) {
|
|
|
return decodeURIComponent(
|
|
|
- (to.query?.redirect as string) || DEFAULT_HOME_PATH,
|
|
|
+ (to.query?.redirect as string) ||
|
|
|
+ userStore.userInfo?.homePath ||
|
|
|
+ DEFAULT_HOME_PATH,
|
|
|
);
|
|
|
}
|
|
|
return true;
|
|
@@ -72,7 +74,10 @@ function setupAccessGuard(router: Router) {
|
|
|
return {
|
|
|
path: LOGIN_PATH,
|
|
|
// 如不需要,直接删除 query
|
|
|
- query: { redirect: encodeURIComponent(to.fullPath) },
|
|
|
+ query:
|
|
|
+ to.fullPath === DEFAULT_HOME_PATH
|
|
|
+ ? {}
|
|
|
+ : { redirect: encodeURIComponent(to.fullPath) },
|
|
|
// 携带当前跳转的页面,登录后重新跳转该页面
|
|
|
replace: true,
|
|
|
};
|
|
@@ -102,7 +107,10 @@ function setupAccessGuard(router: Router) {
|
|
|
accessStore.setAccessMenus(accessibleMenus);
|
|
|
accessStore.setAccessRoutes(accessibleRoutes);
|
|
|
accessStore.setIsAccessChecked(true);
|
|
|
- const redirectPath = (from.query.redirect ?? to.fullPath) as string;
|
|
|
+ const redirectPath = (from.query.redirect ??
|
|
|
+ (to.path === DEFAULT_HOME_PATH
|
|
|
+ ? userInfo.homePath || DEFAULT_HOME_PATH
|
|
|
+ : to.fullPath)) as string;
|
|
|
|
|
|
return {
|
|
|
...router.resolve(decodeURIComponent(redirectPath)),
|