| | |
| | | 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); |
| | |
| | | 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; |
| | |
| | | } |
| | | return arr; |
| | | } |
| | | |
| | | |
| | | export function formatTwoStageRoutes(arr: any) { |
| | | if (arr.length <= 0) return false; |
| | |
| | | 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) => { |
| | |
| | | Session.clear(); |
| | | NProgress.done(); |
| | | } else if (token && to.path === '/login') { |
| | | next('/home'); |
| | | next('/homeMenu'); |
| | | NProgress.done(); |
| | | } else { |
| | | const storesRoutesList = useRoutesList(pinia); |