|
|
|
@@ -60,6 +60,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); |
|
|
|
} |
|
|
|
@@ -72,7 +74,10 @@ export function patchRouteWithRemoteMenus(routes: any) { |
|
|
|
} |
|
|
|
let proLayout = null; |
|
|
|
for (const routeItem of routes) { |
|
|
|
|
|
|
|
if (routeItem.id === 'ant-design-pro-layout') { |
|
|
|
|
|
|
|
|
|
|
|
proLayout = routeItem; |
|
|
|
break; |
|
|
|
} |
|
|
|
@@ -96,6 +101,7 @@ export async function refreshToken() { |
|
|
|
} |
|
|
|
|
|
|
|
export function convertCompatRouters(childrens: API.RoutersMenuItem[]): any[] { |
|
|
|
|
|
|
|
return childrens.map((item: API.RoutersMenuItem) => { |
|
|
|
return { |
|
|
|
path: item.path, |
|
|
|
@@ -129,6 +135,7 @@ export function getMatchMenuItem( |
|
|
|
): MenuDataItem[] { |
|
|
|
if (!menuData) return []; |
|
|
|
let items: MenuDataItem[] = []; |
|
|
|
|
|
|
|
menuData.forEach((item) => { |
|
|
|
if (item.path) { |
|
|
|
if (item.path === path) { |
|
|
|
@@ -142,9 +149,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); |
|
|
|
} |
|
|
|
} |
|
|
|
|