#
Junjie
2025-02-14 ac4341ea6b66ae02427d39d35f41d42d78b2eb2e
zy-asrs-flow/src/services/route.js
@@ -62,8 +62,14 @@
            break;
        }
    }
    const rootMenu = { routes: [], children: [] }
    addHomeMenu(remoteMenu);
    addUserSettingMenu(remoteMenu);
    patchRouteItems(proLayout, remoteMenu);
    patchRouteItems(rootMenu, remoteMenu);
    proLayout.children = proLayout.children.concat(rootMenu.routes);
    proLayout.routes = proLayout.routes.concat(rootMenu.routes);
}
function patchRouteItems(parent, children) {
@@ -76,8 +82,8 @@
                path: menu.path,
                element: <Component />,
            }
            parent.children.push(newRoute);
            parent.routes.push(newRoute);
            parent.children.push(newRoute);
        } else {
            // parent
            const newRoute = {
@@ -87,6 +93,7 @@
                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]);
@@ -97,17 +104,33 @@
    }
}
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"
    }
    // 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",
        component: null,
        routes: [settingRoute],
        path: "/account/setting",
        component: "/account/setting",
        icon: createIcon('UserOutlined')
    })
}