Your Name
2022-07-13 656696be4b70513e94f1341db8d1c2d3f43b3e6d
src/router/index.ts
@@ -10,9 +10,7 @@
import { staticRoutes } from '/@/router/route';
import { initFrontEndControlRoutes } from '/@/router/frontEnd';
import { initBackEndControlRoutes } from '/@/router/backEnd';
import {useUserInfo} from "/@/stores/userInfo";
import { useUserInfo } from '/@/stores/userInfo';
// 读取 `/src/stores/themeConfig.ts` 是否开启后端控制路由配置
const storesThemeConfig = useThemeConfig(pinia);
@@ -20,12 +18,10 @@
const { isRequestRoutes } = themeConfig.value;
if (isRequestRoutes) staticRoutes.splice(0, 1);
export const router = createRouter({
   history: createWebHashHistory(),
   routes: staticRoutes,
    routes: staticRoutes
});
export function formatFlatteningRoutes(arr: any) {
   if (arr.length <= 0) return false;
@@ -36,7 +32,6 @@
   }
   return arr;
}
export function formatTwoStageRoutes(arr: any) {
   if (arr.length <= 0) return false;
@@ -65,8 +60,8 @@
   return newArr;
}
// isRequestRoutes 为 true,则开启后端控制路由,路径:`/src/stores/themeConfig.ts`
if (!isRequestRoutes) initFrontEndControlRoutes();
// // isRequestRoutes 为 true,则开启后端控制路由,路径:`/src/stores/themeConfig.ts`
// if (!isRequestRoutes) initFrontEndControlRoutes();
// 路由加载前
router.beforeEach(async (to, from, next) => {
@@ -82,7 +77,7 @@
         Session.clear();
         NProgress.done();
      } else if (token && to.path === '/login') {
         next('/home');
            next('/homeMenu');
         NProgress.done();
      } else {
         const storesRoutesList = useRoutesList(pinia);