This commit is contained in:
吴红兵
2026-03-07 01:34:48 +08:00
parent adc511cfdc
commit 94c3473958
1211 changed files with 599405 additions and 322105 deletions

View File

@@ -46,7 +46,7 @@ export async function initBackEndControlRoutes() {
// https://gitee.com/lyt-top/vue-next-admin/issues/I64HVO
if (menuList.length <= 0) {
useRequestOldRoutes().setRequestOldRoutes([]);
baseRoutes[0].children = [...dynamicRoutes, ...(await backEndComponent([]) || [])];
baseRoutes[0].children = [...dynamicRoutes, ...((await backEndComponent([])) || [])];
await setAddRoute();
await setFilterMenuAndCacheTagsViewRoutes();
return Promise.resolve(true);
@@ -142,7 +142,8 @@ export function backEndComponent(routes: any) {
} else if (item.component === 'Layout' || item.componentPath === 'Layout') {
// 特殊处理 Layout 组件
item.component = () => import('/@/layout/index.vue');
} else if (item.componentPath) { // 支持动态路径 /a/1 ==> /a ; /b/1 ==> /b
} else if (item.componentPath) {
// 支持动态路径 /a/1 ==> /a ; /b/1 ==> /b
item.component = dynamicImport(dynamicViewsModules, item.componentPath);
} else {
item.component = dynamicImport(dynamicViewsModules, item.path);
@@ -166,7 +167,7 @@ export function dynamicImport(dynamicViewsModules: Record<string, Function>, com
if (component === 'Layout' || component === '/Layout') {
return () => import('/@/layout/index.vue');
}
const keys = Object.keys(dynamicViewsModules);
const matchKeys = keys.filter((key) => {

View File

@@ -9,8 +9,8 @@ import { useUserInfo } from '/@/stores/userInfo';
import { Session } from '/@/utils/storage';
import { staticRoutes, notFoundAndNoPower } from '/@/router/route';
import { initBackEndControlRoutes } from '/@/router/backEnd';
import { flowConfig } from "/@/flow/designer/config/flow-config";
import { replaceRouterRoute } from "/@/flow/support/extend";
import { flowConfig } from '/@/flow/designer/config/flow-config';
import { replaceRouterRoute } from '/@/flow/support/extend';
import { NextLoading } from '/@/utils/loading';
/**
@@ -69,7 +69,7 @@ export function formatTwoStageRoutes(arr: any) {
newArr.push({ component: v.component, name: v.name, path: v.path, redirect: v.redirect, meta: v.meta, children: [] });
} else {
if (v.id) {
v.name=v.name+"_"+v.id;
v.name = v.name + '_' + v.id;
}
// 判断是否是动态路由xx/:id/:name用于 tagsView 等中使用
if (v.path.indexOf('/:') > -1) {
@@ -101,19 +101,17 @@ router.beforeEach(async (to, from, next) => {
}
// 若上面刚写了 token后续用去掉 token 的 query 做一次 replace在 init 之后统一做保证只一次导航、tagsView 能正确加 tag
const stripTokenQuery =
urlToken && to.query
? Object.fromEntries(Object.entries(to.query).filter(([k]) => k !== 'token' && k !== 'refresh_token'))
: null;
urlToken && to.query ? Object.fromEntries(Object.entries(to.query).filter(([k]) => k !== 'token' && k !== 'refresh_token')) : null;
const token = Session.getToken();
if (to.meta.isAuth !== undefined && !to.meta.isAuth) {
next();
NProgress.done();
} else if (to.fullPath.indexOf(flowConfig.mobileConfig.mobilePrefix) !== -1) {
await replaceRouterRoute(to, router)
await replaceRouterRoute(to, router);
next();
NProgress.done();
}/* else if (to.fullPath.indexOf(staticRoutesFlow[0].path) !== -1) {
} /* else if (to.fullPath.indexOf(staticRoutesFlow[0].path) !== -1) {
await replaceRouterThirdRoute(to, router)
next();
NProgress.done();

View File

@@ -1,5 +1,5 @@
import { RouteRecordRaw } from 'vue-router';
import {dynamicRoutesFlow, staticRoutesFlow} from "/@/flow/support/extend";
import { dynamicRoutesFlow, staticRoutesFlow } from '/@/flow/support/extend';
/**
* 建议:路由 path 路径与文件夹名称相同,找文件可浏览器地址找,方便定位文件位置
@@ -65,10 +65,10 @@ export const dynamicRoutes: Array<RouteRecordRaw> = [
component: () => import('/@/views/professional/professionalteacherstationchange/print.vue'),
meta: {
isHide: true, // 隐藏路由,不在菜单中显示
isAuth: true // 需要认证,在 layout 中显示
isAuth: true, // 需要认证,在 layout 中显示
},
},
...dynamicRoutesFlow
...dynamicRoutesFlow,
];
/**
@@ -108,7 +108,7 @@ export const staticRoutes: Array<RouteRecordRaw> = [
},
},
...staticRoutesFlow
...staticRoutesFlow,
];
/**