|
|
|
@@ -61,6 +61,8 @@ function patchRouteItems(route: any, menu: any, parentPath: string) { |
|
|
|
element: React.createElement(lazy(() => import('@/pages/' + path))), |
|
|
|
path: parentPath + menuItem.path, |
|
|
|
}; |
|
|
|
console.log(newRoute); |
|
|
|
|
|
|
|
route.children.push(newRoute); |
|
|
|
route.routes.push(newRoute); |
|
|
|
} |
|
|
|
@@ -73,7 +75,10 @@ export function patchRouteWithRemoteMenus(routes: any) { |
|
|
|
} |
|
|
|
let proLayout = null; |
|
|
|
for (const routeItem of routes) { |
|
|
|
|
|
|
|
if (routeItem.id === 'ant-design-pro-layout') { |
|
|
|
|
|
|
|
|
|
|
|
proLayout = routeItem; |
|
|
|
break; |
|
|
|
} |
|
|
|
@@ -97,6 +102,7 @@ export async function refreshToken() { |
|
|
|
} |
|
|
|
|
|
|
|
export function convertCompatRouters(childrens: API.RoutersMenuItem[]): any[] { |
|
|
|
|
|
|
|
return childrens.map((item: API.RoutersMenuItem) => { |
|
|
|
return { |
|
|
|
path: item.path, |
|
|
|
@@ -130,6 +136,7 @@ export function getMatchMenuItem( |
|
|
|
): MenuDataItem[] { |
|
|
|
if (!menuData) return []; |
|
|
|
let items: MenuDataItem[] = []; |
|
|
|
|
|
|
|
menuData.forEach((item) => { |
|
|
|
if (item.path) { |
|
|
|
if (item.path === path) { |
|
|
|
@@ -143,9 +150,12 @@ export function getMatchMenuItem( |
|
|
|
const subpath = path.substr(item.path.length + 1); |
|
|
|
const subItem: MenuDataItem[] = getMatchMenuItem(subpath, item.routes); |
|
|
|
items = items.concat(subItem); |
|
|
|
|
|
|
|
} else { |
|
|
|
const paths = path.split('/'); |
|
|
|
if (paths.length >= 2 && paths[0] === item.path && paths[1] === 'index') { |
|
|
|
console.log(item); |
|
|
|
|
|
|
|
items.push(item); |
|
|
|
} |
|
|
|
} |
|
|
|
|