|  |  | 
 |  |  |     remoteMenu = data; | 
 |  |  | } | 
 |  |  |  | 
 |  |  | // export async function getUserInfo(options) { | 
 |  |  | //     return request('/api/system/user/getInfo', { | 
 |  |  | //         method: 'GET', | 
 |  |  | //         ...(options || {}), | 
 |  |  | //     }); | 
 |  |  | // } | 
 |  |  | export async function getUserInfo(options) { | 
 |  |  |     return request('/api/auth/user', { | 
 |  |  |         method: 'GET', | 
 |  |  |         ...(options || {}), | 
 |  |  |     }); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | export async function getRouters() { | 
 |  |  |     return request('/api/auth/menu', { | 
 |  |  |         baseURL: 'http://localhost:9090/wcs' | 
 |  |  |     }); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | 
 |  |  |             break; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |     patchRouteItems(proLayout, remoteMenu); | 
 |  |  |  | 
 |  |  |     const rootMenu = { routes: [], children: [] } | 
 |  |  |     addMapMenu(remoteMenu) | 
 |  |  |     addHomeMenu(remoteMenu); | 
 |  |  |     addUserSettingMenu(remoteMenu); | 
 |  |  |     patchRouteItems(rootMenu, remoteMenu); | 
 |  |  |  | 
 |  |  |     proLayout.children = proLayout.children.concat(rootMenu.children); | 
 |  |  |     proLayout.routes = proLayout.routes.concat(rootMenu.routes); | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function patchRouteItems(parent, children) { | 
 |  |  |     for (const menu of children) { | 
 |  |  |         if (menu.component !== null) { | 
 |  |  |         if (menu.component !== null && menu.component !== undefined) { | 
 |  |  |             // children | 
 |  |  |             const Component = require(`@/pages${menu.path}/index.jsx`).default | 
 |  |  |             const newRoute = { | 
 |  |  |                 name: menu.name, | 
 |  |  |                 path: menu.path, | 
 |  |  |                 element: <Component />, | 
 |  |  |             let Component; | 
 |  |  |             try { | 
 |  |  |                 Component = require(`@/pages${menu.path}/index.jsx`).default | 
 |  |  |             } catch (error) { | 
 |  |  |                 console.error('An error has occurred: ', error); | 
 |  |  |             } | 
 |  |  |             parent.children.push(newRoute); | 
 |  |  |             parent.routes.push(newRoute); | 
 |  |  |             if (Component) { | 
 |  |  |                 const newRoute = { | 
 |  |  |                     name: menu.name, | 
 |  |  |                     path: menu.path, | 
 |  |  |                     element: <Component />, | 
 |  |  |                 } | 
 |  |  |                 parent.routes.push(newRoute); | 
 |  |  |                 parent.children.push(newRoute); | 
 |  |  |             } | 
 |  |  |         } else { | 
 |  |  |             // parent | 
 |  |  |             const newRoute = { | 
 |  |  | 
 |  |  |                 children: [], | 
 |  |  |             } | 
 |  |  |             parent.routes.push(newRoute); | 
 |  |  |             parent.children.push(newRoute); | 
 |  |  |             if (menu.routes && menu.routes.length > 0) { | 
 |  |  |                 for (const route of menu.routes) { | 
 |  |  |                     patchRouteItems(newRoute, [route]); | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function addMapMenu(remoteMenu) { | 
 |  |  |     remoteMenu.unshift({ | 
 |  |  |         name: "地图监控", | 
 |  |  |         path: "/map", | 
 |  |  |         component: "/map", | 
 |  |  |         icon: createIcon('HeatMapOutlined') | 
 |  |  |     }) | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function addHomeMenu(remoteMenu) { | 
 |  |  |     remoteMenu.unshift({ | 
 |  |  |         name: "首页", | 
 |  |  |         path: "/home", | 
 |  |  |         component: "/home", | 
 |  |  |         icon: createIcon('HomeOutlined') | 
 |  |  |     }) | 
 |  |  | } | 
 |  |  |  | 
 |  |  | function addUserSettingMenu(remoteMenu) { | 
 |  |  |     // const settingRoute = { | 
 |  |  |     //     name: "个人设置", | 
 |  |  |     //     path: "/account/setting", | 
 |  |  |     //     component: "/account/setting" | 
 |  |  |     // } | 
 |  |  |     // remoteMenu.push({ | 
 |  |  |     //     name: "个人中心", | 
 |  |  |     //     path: "/account", | 
 |  |  |     //     component: null, | 
 |  |  |     //     routes: [settingRoute], | 
 |  |  |     //     icon: createIcon('UserOutlined') | 
 |  |  |     // }) | 
 |  |  |  | 
 |  |  |     remoteMenu.push({ | 
 |  |  |         name: "个人中心", | 
 |  |  |         path: "/account/setting", | 
 |  |  |         component: "/account/setting", | 
 |  |  |         icon: createIcon('UserOutlined') | 
 |  |  |     }) | 
 |  |  | } |