This commit is contained in:
陈红丽 2024-08-06 16:24:27 +08:00
parent e21b444cdb
commit 90e52e7410
4 changed files with 7 additions and 5 deletions

View File

@ -179,7 +179,7 @@
import { useTabsViewStore } from '@/store/modules/tabsView';
import { computed, ref, unref, watch, inject } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { TABS_ROUTES } from '@/store/mutation-types';
import { TABS_ROUTES,FIRST_ROUTE } from '@/store/mutation-types';
import { useUserStore } from '@/store/modules/user';
import { useLockscreenStore } from '@/store/modules/lockscreen';
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
@ -343,6 +343,7 @@
//
tabsViewStore.closeAllTabs();
localStorage.removeItem(TABS_ROUTES);
localStorage.removeItem(FIRST_ROUTE);
asyncRouteStore.setDynamicAddedRoute(false);
window.location.reload();
router.replace({

View File

@ -122,7 +122,7 @@
import { computed, ref, unref, provide, watch, onMounted, nextTick, toRaw, inject } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { storage } from '@/utils/Storage';
import { TABS_ROUTES } from '@/store/mutation-types';
import { TABS_ROUTES,FIRST_ROUTE } from '@/store/mutation-types';
import { useTabsViewStore } from '@/store/modules/tabsView';
import { useAsyncRouteStore } from '@/store/modules/asyncRoute';
import { RouteItem } from '@/store/modules/tabsView';
@ -385,7 +385,7 @@
//
const closeAll = () => {
tabsViewStore.closeAllTabs();
router.replace(storage.get('FIRST-PATH'));
router.replace(storage.get(FIRST_ROUTE));
// router.replace(PageEnum.BASE_HOME_REDIRECT);
updateNavScroll();
};

View File

@ -2,7 +2,7 @@ import type { RouteRecordRaw } from 'vue-router';
import { isNavigationFailure, Router } from 'vue-router';
import { useUserStoreWidthOut } from '@/store/modules/user';
import { useAsyncRouteStoreWidthOut } from '@/store/modules/asyncRoute';
import { ACCESS_TOKEN } from '@/store/mutation-types';
import { ACCESS_TOKEN,FIRST_ROUTE } from '@/store/mutation-types';
import { storage } from '@/utils/Storage';
import { PageEnum } from '@/enums/pageEnum';
import { ErrorPageRoute,AboutPageRoute } from '@/router/base';
@ -69,7 +69,7 @@ export function createRouterGuards(router: Router) {
}
router.addRoute(AboutPageRoute as unknown as RouteRecordRaw);
const firstRoutePath = findFirstRoutePath(routes)
storage.set('FIRST-PATH',firstRoutePath)
storage.set(FIRST_ROUTE,firstRoutePath)
if (from.path === LOGIN_PATH && (to.name === 'errorPage' || !to.name)) {
next(firstRoutePath);
return;

View File

@ -2,3 +2,4 @@ export const ACCESS_TOKEN = 'ACCESS-TOKEN'; // 用户token
export const CURRENT_USER = 'CURRENT-USER'; // 当前用户信息
export const IS_LOCKSCREEN = 'IS-LOCKSCREEN'; // 是否锁屏
export const TABS_ROUTES = 'TABS-ROUTES'; // 标签页
export const FIRST_ROUTE = 'FIRST-ROUTE'; // 菜单第一个路由