/** * CRMEB Admin 路由配置 * 基于 CRMEB v5 标准版路由体系 1:1 映射 * * 路由结构说明: * - 一级菜单(topMenu): 主侧边栏显示的顶级模块 * - 分组(group): 二级侧边栏的分组标题 * - 菜单项(item): 具体的页面路由 */ /** * 路由记录类型定义 */ export type RouteRecord = { id: string // 路由唯一标识,对应 CRMEB 的 name title: string // 显示标题 icon?: string // 图标(仅一级菜单) path: string // 路径(用于内部路由切换) componentKey: string // 组件映射key parentId?: string // 父路由ID groupId?: string // 所属分组ID auth?: string[] // 权限标识 hidden?: boolean // 是否隐藏 keepAlive?: boolean // 是否缓存 order?: number // 排序 isAffix?: boolean // 是否固定标签 } /** * 菜单分组类型 */ export type MenuGroup = { id: string title: string order?: number } /** * 一级菜单类型 */ export type TopMenu = { id: string title: string icon: string path: string // 默认跳转路径 order: number groups: MenuGroup[] // 该菜单下的分组列表 } /** * ============================================ * CRMEB 路由常量配置 * ============================================ */ /** * 一级菜单配置(主侧边栏) */ export const topMenus: TopMenu[] = [ { id: 'home', title: '首页', icon: 'home', path: '/pages/mall/admin/homePage/index', order: 1, groups: [] }, { id: 'user', title: '用户', icon: 'user', path: '/pages/mall/admin/user/management/index', order: 2, groups: [ { id: 'user-manage', title: '', order: 1 } ] }, { id: 'order', title: '订单', icon: 'order', path: '/pages/mall/admin/order/list', order: 3, groups: [ { id: 'order-manage', title: '', order: 1 } ] }, { id: 'product', title: '商品', icon: 'product', path: '/pages/mall/admin/product/statistic', order: 4, groups: [ { id: 'product-manage', title: '商品管理', order: 1 } ] }, { id: 'marketing', title: '营销', icon: 'marketing', path: '/pages/mall/admin/marketing/coupon/list', order: 5, groups: [ { id: 'marketing-coupon', title: '优惠券', order: 1 }, { id: 'marketing-integral', title: '积分管理', order: 2 }, { id: 'marketing-lottery', title: '抽奖管理', order: 3 }, { id: 'marketing-bargain', title: '砍价管理', order: 4 }, { id: 'marketing-combination', title: '拼团管理', order: 5 }, { id: 'marketing-seckill', title: '秒杀管理', order: 6 }, { id: 'marketing-member', title: '付费会员', order: 7 }, { id: 'marketing-live', title: '直播管理', order: 8 }, { id: 'marketing-recharge', title: '用户充值', order: 9 }, { id: 'marketing-checkin', title: '每日签到', order: 10 }, { id: 'marketing-other', title: '其他', order: 11 } ] }, { id: 'distribution', title: '分销', icon: 'share', path: '/pages/mall/admin/distribution/statistic', order: 6, groups: [ { id: 'distribution-manage', title: '', order: 1 } ] }, { id: 'kefu', title: '客服', icon: 'customer-service', path: '/pages/mall/admin/kefu/list', order: 7, groups: [ { id: 'kefu-manage', title: '', order: 1 } ] }, { id: 'finance', title: '财务', icon: 'finance', path: '/pages/mall/admin/finance/transaction_stats', order: 8, groups: [ { id: 'finance-data', title: '', order: 1 }, { id: 'finance-ops', title: '财务操作', order: 2 }, { id: 'finance-record', title: '财务记录', order: 3 }, { id: 'finance-commission', title: '佣金记录', order: 4 }, { id: 'finance-balance', title: '余额记录', order: 5 } ] }, { id: 'cms', title: '内容', icon: 'content', path: '/pages/mall/admin/cms/article/list', order: 9, groups: [ { id: 'cms-manage', title: '内容管理', order: 1 } ] }, { id: 'decoration', title: '装修', icon: 'decoration', path: '/pages/mall/admin/decoration/home', order: 10, groups: [ { id: 'decoration-manage', title: '', order: 1 } ] }, { id: 'app', title: '应用', icon: 'app', path: '/pages/mall/admin/app/statistic', order: 11, groups: [ { id: 'app-manage', title: '', order: 1 } ] }, { id: 'setting', title: '设置', icon: 'setting', path: '/pages/mall/admin/setting/system/config', order: 12, groups: [ { id: 'setting-system', title: '系统设置', order: 1 }, { id: 'setting-application', title: '应用设置', order: 2 } ] }, { id: 'maintain', title: '维护', icon: 'tool', path: '/pages/mall/admin/maintain/dev/config', order: 13, groups: [ { id: 'maintain-dev', title: '开发配置', order: 1 }, { id: 'maintain-security', title: '安全维护', order: 2 }, { id: 'maintain-data', title: '数据维护', order: 3 }, { id: 'maintain-api', title: '对外接口', order: 4 }, { id: 'maintain-lang', title: '语言设置', order: 5 }, { id: 'maintain-tool', title: '开发工具', order: 6 }, { id: 'maintain-sys', title: '系统信息', order: 7 } ] } ] /** * 完整路由表 * 映射自 CRMEB router/modules/* */ export const routes: RouteRecord[] = [ // ========== 首页 ========== { id: 'home_index', title: '主页', icon: 'home', path: '/pages/mall/admin/homePage/index', componentKey: 'HomeIndex', isAffix: true, order: 1 }, // ========== 用户模块 ========== { id: 'user_statistic', title: '用户统计', path: '/pages/mall/admin/user/statistics/index', componentKey: 'UserStatistic', parentId: 'user', groupId: 'user-manage', auth: ['admin-user-statistic-index'], order: 1 }, { id: 'user_list', title: '用户管理', path: '/pages/mall/admin/user/management/index', componentKey: 'UserList', parentId: 'user', groupId: 'user-manage', auth: ['admin-user-user-index'], order: 2 }, { id: 'user_group', title: '用户分组', path: '/pages/mall/admin/user/grouping/index', componentKey: 'UserGroup', parentId: 'user', groupId: 'user-manage', auth: ['user-user-group'], order: 3 }, { id: 'user_label', title: '用户标签', path: '/pages/mall/admin/user/label/index', componentKey: 'UserLabel', parentId: 'user', groupId: 'user-manage', auth: ['user-user-label'], order: 4 }, { id: 'user_level', title: '用户等级', path: '/pages/mall/admin/user/level/index', componentKey: 'UserLevel', parentId: 'user', groupId: 'user-manage', auth: ['user-user-level'], order: 5 }, // ========== 商品模块 ========== { id: 'product_statistic', title: '商品统计', path: '/pages/mall/admin/product/statistic', componentKey: 'ProductStatistic', parentId: 'product', groupId: 'product-manage', auth: ['admin-store-storeProuduct-statistic'], order: 1 }, { id: 'product_productList', title: '商品管理', path: '/pages/mall/admin/product/list', componentKey: 'ProductList', parentId: 'product', groupId: 'product-manage', auth: ['admin-store-storeProuduct-index'], keepAlive: true, order: 2 }, { id: 'product_productClassify', title: '商品分类', path: '/pages/mall/admin/product/classification/index', componentKey: 'ProductClassify', parentId: 'product', groupId: 'product-manage', auth: ['admin-store-storeCategory-index'], order: 3 }, { id: 'product_productAttr', title: '商品规格', path: '/pages/mall/admin/product/specifications/index', componentKey: 'ProductAttr', parentId: 'product', groupId: 'product-manage', auth: ['admin-store-storeProuduct-index'], order: 4 }, { id: 'product_paramList', title: '商品参数', path: '/pages/mall/admin/product/parameters/index', componentKey: 'ProductParam', parentId: 'product', groupId: 'product-manage', auth: ['admin-product-param-list'], order: 5 }, { id: 'product_labelList', title: '商品标签', path: '/pages/mall/admin/product/labels/index', componentKey: 'ProductLabel', parentId: 'product', groupId: 'product-manage', auth: ['admin-product-label-list'], order: 6 }, { id: 'product_protectionList', title: '商品保障', path: '/pages/mall/admin/product/protection/index', componentKey: 'ProductProtection', parentId: 'product', groupId: 'product-manage', auth: ['admin-product-protection-list'], order: 7 }, { id: 'product_productEvaluate', title: '商品评论', path: '/pages/mall/admin/product/reviews/index', componentKey: 'ProductReply', parentId: 'product', groupId: 'product-manage', auth: ['admin-store-storeProuduct-index'], order: 8 }, { id: 'product_edit', title: '编辑商品', path: '/pages/mall/admin/product/edit', componentKey: 'ProductEdit', parentId: 'product', groupId: 'product-manage', hidden: true, auth: ['admin-store-storeProuduct-index'] }, { id: 'product_member_price', title: '预售会员价', path: '/pages/mall/admin/product/member-price', componentKey: 'ProductMemberPrice', parentId: 'product', groupId: 'product-manage', hidden: true, auth: ['admin-store-storeProuduct-index'] }, // ========== 订单模块 ========== { id: 'order_statistic', title: '订单统计', path: '/pages/mall/admin/order/statistic', componentKey: 'OrderStatistic', parentId: 'order', groupId: 'order-manage', auth: ['admin-order-statistic-index'], order: 1 }, { id: 'order_list', title: '订单管理', path: '/pages/mall/admin/order/list', componentKey: 'OrderList', parentId: 'order', groupId: 'order-manage', auth: ['admin-order-storeOrder-index'], keepAlive: true, order: 2 }, { id: 'order_refund', title: '售后订单', path: '/pages/mall/admin/order/refund', componentKey: 'OrderRefund', parentId: 'order', groupId: 'order-manage', auth: ['admin-order-refund-index'], order: 3 }, { id: 'order_cashier', title: '收银订单', path: '/pages/mall/admin/order/cashier', componentKey: 'OrderCashier', parentId: 'order', groupId: 'order-manage', auth: ['admin-order-cashier-index'], order: 4 }, { id: 'order_verify', title: '核销记录', path: '/pages/mall/admin/order/verify', componentKey: 'OrderVerify', parentId: 'order', groupId: 'order-manage', auth: ['admin-order-verify-index'], order: 5 }, { id: 'order_config', title: '订单配置', path: '/pages/mall/admin/order/config', componentKey: 'OrderConfig', parentId: 'order', groupId: 'order-manage', auth: ['admin-order-config-index'], order: 6 }, // ========== 营销模块 ========== // 1. 优惠券 { id: 'marketing_coupon_list', title: '优惠券列表', path: '/pages/mall/admin/marketing/coupon/list', componentKey: 'MarketingCouponList', parentId: 'marketing', groupId: 'marketing-coupon', auth: ['admin-marketing-storeCoupon-index'], order: 1 }, { id: 'marketing_coupon_user', title: '用户领取记录', path: '/pages/mall/admin/marketing/coupon/user', componentKey: 'MarketingCouponUser', parentId: 'marketing', groupId: 'marketing-coupon', auth: ['admin-marketing-storeCouponUser-index'], order: 2 }, // 2. 积分管理 { id: 'marketing_integral_statistic', title: '积分统计', path: '/pages/mall/admin/marketing/integral/statistic', componentKey: 'MarketingIntegralStatistic', parentId: 'marketing', groupId: 'marketing-integral', auth: ['admin-marketing-integral-statistic'], order: 1 }, { id: 'marketing_integral_product', title: '积分商品', path: '/pages/mall/admin/marketing/integral/product', componentKey: 'MarketingIntegralProduct', parentId: 'marketing', groupId: 'marketing-integral', auth: ['admin-marketing-integral-product'], order: 2 }, { id: 'marketing_integral_order', title: '积分订单', path: '/pages/mall/admin/marketing/integral/order', componentKey: 'MarketingIntegralOrder', parentId: 'marketing', groupId: 'marketing-integral', auth: ['admin-marketing-integral-order'], order: 3 }, { id: 'marketing_integral_record', title: '积分记录', path: '/pages/mall/admin/marketing/integral/record', componentKey: 'MarketingIntegralRecord', parentId: 'marketing', groupId: 'marketing-integral', auth: ['admin-marketing-integral-record'], order: 4 }, { id: 'marketing_integral_config', title: '积分配置', path: '/pages/mall/admin/marketing/integral/config', componentKey: 'MarketingIntegralConfig', parentId: 'marketing', groupId: 'marketing-integral', auth: ['admin-marketing-integral-config'], order: 5 }, // 3. 抽奖管理 { id: 'marketing_lottery_list', title: '抽奖列表', path: '/pages/mall/admin/marketing/lottery/list', componentKey: 'MarketingLotteryList', parentId: 'marketing', groupId: 'marketing-lottery', auth: ['admin-marketing-lottery-index'], order: 1 }, { id: 'marketing_lottery_config', title: '抽奖配置', path: '/pages/mall/admin/marketing/lottery/config', componentKey: 'MarketingLotteryConfig', parentId: 'marketing', groupId: 'marketing-lottery', auth: ['admin-marketing-lottery-config'], order: 2 }, // 4. 砍价管理 { id: 'marketing_bargain_product', title: '砍价商品', path: '/pages/mall/admin/marketing/bargain/product', componentKey: 'MarketingBargainProduct', parentId: 'marketing', groupId: 'marketing-bargain', auth: ['admin-marketing-bargain-product'], order: 1 }, { id: 'marketing_bargain_list', title: '砍价列表', path: '/pages/mall/admin/marketing/bargain/list', componentKey: 'MarketingBargainList', parentId: 'marketing', groupId: 'marketing-bargain', auth: ['admin-marketing-bargain-index'], order: 2 }, // 5. 拼团管理 { id: 'marketing_combination_product', title: '拼团商品', path: '/pages/mall/admin/marketing/combination/product', componentKey: 'MarketingCombinationProduct', parentId: 'marketing', groupId: 'marketing-combination', auth: ['admin-marketing-combination-product'], order: 1 }, { id: 'marketing_combination_list', title: '拼团列表', path: '/pages/mall/admin/marketing/combination/list', componentKey: 'MarketingCombinationList', parentId: 'marketing', groupId: 'marketing-combination', auth: ['admin-marketing-combination-index'], order: 2 }, { id: 'marketing_combination_create', title: '添加拼团商品', path: '/pages/mall/admin/marketing/combination/create', componentKey: 'MarketingCombinationCreate', parentId: 'marketing', groupId: 'marketing-combination', auth: ['admin-marketing-combination-create'], hidden: true }, // 6. 秒杀管理 { id: 'marketing_seckill_list', title: '秒杀列表', path: '/pages/mall/admin/marketing/seckill/list', componentKey: 'MarketingSeckillList', parentId: 'marketing', groupId: 'marketing-seckill', auth: ['admin-marketing-seckill-index'], order: 1 }, { id: 'marketing_seckill_product', title: '秒杀商品', path: '/pages/mall/admin/marketing/seckill/product', componentKey: 'MarketingSeckillProduct', parentId: 'marketing', groupId: 'marketing-seckill', auth: ['admin-marketing-seckill-product'], order: 2 }, { id: 'marketing_seckill_config', title: '秒杀配置', path: '/pages/mall/admin/marketing/seckill/config', componentKey: 'MarketingSeckillConfig', parentId: 'marketing', groupId: 'marketing-seckill', auth: ['admin-marketing-seckill-config'], order: 3 }, // 7. 付费会员 (从用户模块迁入) { id: 'marketing_member_type', title: '会员类型', path: '/pages/mall/admin/marketing/member/type', componentKey: 'MarketingMemberType', parentId: 'marketing', groupId: 'marketing-member', auth: ['admin-user-member-type'], order: 1 }, { id: 'marketing_member_right', title: '会员权益', path: '/pages/mall/admin/marketing/member/right', componentKey: 'MarketingMemberRight', parentId: 'marketing', groupId: 'marketing-member', auth: ['admin-user-member-right'], order: 2 }, { id: 'marketing_member_card', title: '卡密会员', path: '/pages/mall/admin/marketing/member/card', componentKey: 'MarketingMemberCard', parentId: 'marketing', groupId: 'marketing-member', auth: ['admin-user-member-card'], order: 3 }, { id: 'marketing_member_record', title: '会员记录', path: '/pages/mall/admin/marketing/member/record', componentKey: 'MarketingMemberRecord', parentId: 'marketing', groupId: 'marketing-member', auth: ['admin-user-member-record'], order: 4 }, { id: 'marketing_member_config', title: '会员配置', path: '/pages/mall/admin/marketing/member/config', componentKey: 'MarketingMemberConfig', parentId: 'marketing', groupId: 'marketing-member', auth: ['admin-user-member-config'], order: 5 }, // 8. 直播管理 { id: 'marketing_live_room', title: '直播间管理', path: '/pages/mall/admin/marketing/live/room', componentKey: 'MarketingLiveRoom', parentId: 'marketing', groupId: 'marketing-live', auth: ['admin-marketing-live-room'], order: 1 }, { id: 'marketing_live_product', title: '直播商品管理', path: '/pages/mall/admin/marketing/live/product', componentKey: 'MarketingLiveProduct', parentId: 'marketing', groupId: 'marketing-live', auth: ['admin-marketing-live-product'], order: 2 }, { id: 'marketing_live_anchor', title: '主播管理', path: '/pages/mall/admin/marketing/live/anchor', componentKey: 'MarketingLiveAnchor', parentId: 'marketing', groupId: 'marketing-live', auth: ['admin-marketing-live-anchor'], order: 3 }, // 9. 用户充值 { id: 'marketing_recharge_quota', title: '金额设置', path: '/pages/mall/admin/marketing/recharge/quota', componentKey: 'MarketingRechargeQuota', parentId: 'marketing', groupId: 'marketing-recharge', auth: ['admin-marketing-recharge-quota'], order: 1 }, { id: 'marketing_recharge_config', title: '充值配置', path: '/pages/mall/admin/marketing/recharge/config', componentKey: 'MarketingRechargeConfig', parentId: 'marketing', groupId: 'marketing-recharge', auth: ['admin-marketing-recharge-config'], order: 2 }, // 10. 每日签到 { id: 'marketing_checkin_config', title: '签到配置', path: '/pages/mall/admin/marketing/checkin/config', componentKey: 'MarketingCheckinConfig', parentId: 'marketing', groupId: 'marketing-checkin', auth: ['admin-marketing-checkin-config'], order: 1 }, { id: 'marketing_checkin_reward', title: '签到奖励', path: '/pages/mall/admin/marketing/checkin/reward', componentKey: 'MarketingCheckinReward', parentId: 'marketing', groupId: 'marketing-checkin', auth: ['admin-marketing-checkin-reward'], order: 2 }, // 11. 渠道码 & 新人礼 { id: 'marketing_channel_code', title: '渠道码', path: '/pages/mall/admin/marketing/channel/list', componentKey: 'MarketingChannelList', parentId: 'marketing', groupId: 'marketing-other', auth: ['admin-marketing-channel-index'], order: 1 }, { id: 'marketing_newcomer_gift', title: '新人礼', path: '/pages/mall/admin/marketing/newcomer/gift', componentKey: 'MarketingNewcomerGift', parentId: 'marketing', groupId: 'marketing-other', auth: ['admin-marketing-newcomer-index'], order: 2 }, // ========== 内容模块 ========== { id: 'cms_article', title: '文章管理', path: '/pages/mall/admin/cms/article/list', componentKey: 'CmsArticle', parentId: 'cms', groupId: 'cms-manage', auth: ['admin-cms-article-index'], order: 1 }, { id: 'cms_category', title: '文章分类', path: '/pages/mall/admin/cms/category/list', componentKey: 'CmsCategory', parentId: 'cms', groupId: 'cms-manage', auth: ['admin-cms-category-index'], order: 2 }, // ========== 财务模块 ========== { id: 'finance_transaction_stats', title: '交易统计', path: '/pages/mall/admin/finance/transaction_stats', componentKey: 'FinanceTransactionStats', parentId: 'finance', groupId: 'finance-data', auth: ['admin-finance-transaction-stats'], order: 1 }, { id: 'finance_withdrawal', title: '提现申请', path: '/pages/mall/admin/finance/withdrawal', componentKey: 'FinanceWithdrawal', parentId: 'finance', groupId: 'finance-ops', auth: ['admin-finance-withdrawal-index'], order: 1 }, { id: 'finance_invoice', title: '发票管理', path: '/pages/mall/admin/finance/invoice', componentKey: 'FinanceInvoice', parentId: 'finance', groupId: 'finance-ops', auth: ['admin-finance-invoice-index'], order: 2 }, { id: 'finance_recharge', title: '充值记录', path: '/pages/mall/admin/finance/recharge', componentKey: 'FinanceRecharge', parentId: 'finance', groupId: 'finance-record', auth: ['admin-finance-recharge-index'], order: 1 }, { id: 'finance_capital_flow', title: '资金流水', path: '/pages/mall/admin/finance/capital_flow', componentKey: 'FinanceCapitalFlow', parentId: 'finance', groupId: 'finance-record', auth: ['admin-finance-capital-flow-index'], order: 2 }, { id: 'finance_bill', title: '账单记录', path: '/pages/mall/admin/finance/bill', componentKey: 'FinanceBill', parentId: 'finance', groupId: 'finance-record', auth: ['admin-finance-bill-index'], order: 3 }, { id: 'finance_commission_record', title: '佣金记录', path: '/pages/mall/admin/finance/commission', componentKey: 'FinanceCommission', parentId: 'finance', groupId: 'finance-commission', auth: ['admin-finance-commission-index'], order: 1 }, { id: 'finance_balance_stats', title: '余额统计', path: '/pages/mall/admin/finance/balance_stats', componentKey: 'FinanceBalanceStats', parentId: 'finance', groupId: 'finance-balance', auth: ['admin-finance-balance-stats'], order: 1 }, { id: 'finance_balance_record', title: '余额记录', path: '/pages/mall/admin/finance/balance_record', componentKey: 'FinanceBalanceRecord', parentId: 'finance', groupId: 'finance-balance', auth: ['admin-finance-balance-record-index'], order: 2 }, // ========== 数据统计模块 ========== { id: 'statistic_index', title: '数据概览', path: '/pages/mall/admin/statistic/index', componentKey: 'StatisticIndex', parentId: 'statistic', groupId: 'statistic-data', auth: ['admin-statistic-index'], order: 1 }, // ========== 设置模块 ========== { id: 'setting_systemConfig', title: '系统配置', path: '/pages/mall/admin/setting/system/config', componentKey: 'SettingSystemConfig', parentId: 'setting', groupId: 'setting-system', auth: ['admin-setting-system-config'], order: 1 }, { id: 'setting_systemAdmin', title: '管理员管理', path: '/pages/mall/admin/setting/system/admin', componentKey: 'SettingSystemAdmin', parentId: 'setting', groupId: 'setting-system', auth: ['admin-setting-system-admin'], order: 2 }, { id: 'setting_systemRole', title: '角色管理', path: '/pages/mall/admin/setting/system/role', componentKey: 'SettingSystemRole', parentId: 'setting', groupId: 'setting-system', auth: ['admin-setting-system-role'], order: 3 }, // ========== 分销模块 ========== { id: 'distribution_statistic', title: '分销统计', path: '/pages/mall/admin/distribution/statistic', componentKey: 'DistributionStatistic', parentId: 'distribution', groupId: 'distribution-manage', order: 1 }, { id: 'distribution_list', title: '分销员列表', path: '/pages/mall/admin/distribution/list', componentKey: 'DistributionList', parentId: 'distribution', groupId: 'distribution-manage', order: 2 }, { id: 'distribution_config', title: '分销设置', path: '/pages/mall/admin/distribution/config', componentKey: 'DistributionConfig', parentId: 'distribution', groupId: 'distribution-manage', order: 3 }, // ========== 客服模块 ========== { id: 'kefu_list', title: '客服列表', path: '/pages/mall/admin/kefu/list', componentKey: 'KefuList', parentId: 'kefu', groupId: 'kefu-manage', order: 1 }, { id: 'kefu_words', title: '客服话术', path: '/pages/mall/admin/kefu/words', componentKey: 'KefuWords', parentId: 'kefu', groupId: 'kefu-manage', order: 2 }, { id: 'kefu_feedback', title: '用户留言', path: '/pages/mall/admin/kefu/feedback', componentKey: 'KefuFeedback', parentId: 'kefu', groupId: 'kefu-manage', order: 3 }, { id: 'kefu_auto_reply', title: '自动回复', path: '/pages/mall/admin/kefu/auto_reply', componentKey: 'KefuAutoReply', parentId: 'kefu', groupId: 'kefu-manage', order: 4 }, { id: 'kefu_config', title: '客服配置', path: '/pages/mall/admin/kefu/config', componentKey: 'KefuConfig', parentId: 'kefu', groupId: 'kefu-manage', order: 5 }, // ========== 装修模块 ========== { id: 'decoration_home', title: '首页装修', path: '/pages/mall/admin/decoration/home', componentKey: 'DecorationHome', parentId: 'decoration', groupId: 'decoration-manage', order: 1 }, { id: 'decoration_category', title: '商品分类', path: '/pages/mall/admin/decoration/category', componentKey: 'DecorationCategory', parentId: 'decoration', groupId: 'decoration-manage', order: 2 }, { id: 'decoration_user', title: '个人中心', path: '/pages/mall/admin/decoration/user', componentKey: 'DecorationUser', parentId: 'decoration', groupId: 'decoration-manage', order: 3 }, { id: 'decoration_data', title: '数据配置', path: '/pages/mall/admin/decoration/data', componentKey: 'DecorationData', parentId: 'decoration', groupId: 'decoration-manage', order: 4 }, { id: 'decoration_style', title: '主题风格', path: '/pages/mall/admin/decoration/style', componentKey: 'DecorationStyle', parentId: 'decoration', groupId: 'decoration-manage', order: 5 }, { id: 'decoration_material', title: '素材管理', path: '/pages/mall/admin/decoration/material', componentKey: 'DecorationMaterial', parentId: 'decoration', groupId: 'decoration-manage', order: 6 }, { id: 'decoration_link', title: '链接管理', path: '/pages/mall/admin/decoration/link', componentKey: 'DecorationLink', parentId: 'decoration', groupId: 'decoration-manage', order: 7 }, // ========== 应用模块 ========== { id: 'app_statistic', title: '应用统计', path: '/pages/mall/admin/app/statistic', componentKey: 'AppStatistic', parentId: 'app', groupId: 'app-manage', order: 1 }, { id: 'app_list', title: '应用列表', path: '/pages/mall/admin/app/list', componentKey: 'AppList', parentId: 'app', groupId: 'app-manage', order: 2 }, // ========== 维护模块 ========== // 开发配置 { id: 'maintain_dev_config', title: '配置分类', path: '/pages/mall/admin/maintain/dev/config', componentKey: 'MaintainDevConfig', parentId: 'maintain', groupId: 'maintain-dev', order: 1 }, { id: 'maintain_dev_data', title: '组合数据', path: '/pages/mall/admin/maintain/dev/data', componentKey: 'MaintainDevData', parentId: 'maintain', groupId: 'maintain-dev', order: 2 }, { id: 'maintain_dev_task', title: '定时任务', path: '/pages/mall/admin/maintain/dev/task', componentKey: 'MaintainDevTask', parentId: 'maintain', groupId: 'maintain-dev', order: 3 }, { id: 'maintain_dev_auth', title: '权限维护', path: '/pages/mall/admin/maintain/dev/auth', componentKey: 'MaintainDevAuth', parentId: 'maintain', groupId: 'maintain-dev', order: 4 }, { id: 'maintain_dev_module', title: '模块配置', path: '/pages/mall/admin/maintain/dev/module', componentKey: 'MaintainDevModule', parentId: 'maintain', groupId: 'maintain-dev', order: 5 }, { id: 'maintain_dev_event', title: '自定事件', path: '/pages/mall/admin/maintain/dev/event', componentKey: 'MaintainDevEvent', parentId: 'maintain', groupId: 'maintain-dev', order: 6 }, // 安全维护 { id: 'maintain_security_cache', title: '刷新缓存', path: '/pages/mall/admin/maintain/security/cache', componentKey: 'MaintainSecurityCache', parentId: 'maintain', groupId: 'maintain-security', order: 1 }, { id: 'maintain_security_log', title: '系统日志', path: '/pages/mall/admin/maintain/security/log', componentKey: 'MaintainSecurityLog', parentId: 'maintain', groupId: 'maintain-security', order: 2 }, { id: 'maintain_security_upgrade', title: '在线升级', path: '/pages/mall/admin/maintain/security/upgrade', componentKey: 'MaintainSecurityUpgrade', parentId: 'maintain', groupId: 'maintain-security', order: 3 }, // 数据维护 { id: 'maintain_data_logistics', title: '物流公司', path: '/pages/mall/admin/maintain/data/logistics', componentKey: 'MaintainDataLogistics', parentId: 'maintain', groupId: 'maintain-data', order: 1 }, { id: 'maintain_data_city', title: '城市数据', path: '/pages/mall/admin/maintain/data/city', componentKey: 'MaintainDataCity', parentId: 'maintain', groupId: 'maintain-data', order: 2 }, { id: 'maintain_data_clear', title: '清除数据', path: '/pages/mall/admin/maintain/data/clear', componentKey: 'MaintainDataClear', parentId: 'maintain', groupId: 'maintain-data', order: 3 }, // 对外接口 { id: 'maintain_api_account', title: '账号管理', path: '/pages/mall/admin/maintain/api/account', componentKey: 'MaintainApiAccount', parentId: 'maintain', groupId: 'maintain-api', order: 1 }, // 语言设置 { id: 'maintain_lang_list', title: '语言列表', path: '/pages/mall/admin/maintain/lang/list', componentKey: 'MaintainLangList', parentId: 'maintain', groupId: 'maintain-lang', order: 1 }, { id: 'maintain_lang_detail', title: '语言详情', path: '/pages/mall/admin/maintain/lang/detail', componentKey: 'MaintainLangDetail', parentId: 'maintain', groupId: 'maintain-lang', order: 2 }, { id: 'maintain_lang_region', title: '地区列表', path: '/pages/mall/admin/maintain/lang/region', componentKey: 'MaintainLangRegion', parentId: 'maintain', groupId: 'maintain-lang', order: 3 }, { id: 'maintain_lang_config', title: '翻译配置', path: '/pages/mall/admin/maintain/lang/config', componentKey: 'MaintainLangConfig', parentId: 'maintain', groupId: 'maintain-lang', order: 4 }, // 开发工具 { id: 'maintain_tool_db', title: '数据库管理', path: '/pages/mall/admin/maintain/tool/db', componentKey: 'MaintainToolDb', parentId: 'maintain', groupId: 'maintain-tool', order: 1 }, { id: 'maintain_tool_file', title: '文件管理', path: '/pages/mall/admin/maintain/tool/file', componentKey: 'MaintainToolFile', parentId: 'maintain', groupId: 'maintain-tool', order: 2 }, { id: 'maintain_tool_api', title: '接口管理', path: '/pages/mall/admin/maintain/tool/api', componentKey: 'MaintainToolApi', parentId: 'maintain', groupId: 'maintain-tool', order: 3 }, { id: 'maintain_tool_dic', title: '数据字典', path: '/pages/mall/admin/maintain/tool/dic', componentKey: 'MaintainToolDic', parentId: 'maintain', groupId: 'maintain-tool', order: 4 }, // 系统信息 { id: 'maintain_sys_info', title: '系统信息', path: '/pages/mall/admin/maintain/sys/info', componentKey: 'MaintainSysInfo', parentId: 'maintain', groupId: 'maintain-sys', order: 1 } ] /** * ============================================ * 工具函数 * ============================================ */ /** * 获取所有一级菜单 */ export function getTopMenus(): TopMenu[] { return topMenus.sort((a, b) => a.order - b.order) } /** * 根据一级菜单ID获取其分组列表 */ export function getGroupsByTopMenu(topMenuId: string): MenuGroup[] { const menu = topMenus.find(m => m.id === topMenuId) return menu ? menu.groups.sort((a, b) => (a.order || 0) - (b.order || 0)) : [] } /** * 根据分组ID获取该分组下的路由列表 */ export function getRoutesByGroup(groupId: string): RouteRecord[] { return routes .filter(r => r.groupId === groupId && !r.hidden) .sort((a, b) => (a.order || 0) - (b.order || 0)) } /** * 根据一级菜单ID获取其所有子路由(分组后) */ export function getRoutesByTopMenu(topMenuId: string): Map { const groups = getGroupsByTopMenu(topMenuId) const result = new Map() groups.forEach(group => { result.set(group.id, getRoutesByGroup(group.id)) }) return result } /** * 根据路由ID查找路由记录 */ export function findRouteById(routeId: string): RouteRecord | null { return routes.find(r => r.id === routeId) || null } /** * 根据路径查找路由记录 */ export function findRouteByPath(path: string): RouteRecord | null { // 标准化路径: 去除查询参数和前导斜杠 const normalizePath = (p: string): string => { let result = p.startsWith('/') ? p.slice(1) : p const queryIndex = result.indexOf('?') return queryIndex >= 0 ? result.slice(0, queryIndex) : result } const normalizedPath = normalizePath(path) return routes.find(r => normalizePath(r.path) === normalizedPath) || null } /** * 构建默认打开的标签页列表 */ export function buildDefaultTabs(): RouteRecord[] { return routes.filter(r => r.isAffix) } /** * 获取路由的面包屑路径 */ export function getBreadcrumb(routeId: string): Array<{id: string, title: string}> { const route = findRouteById(routeId) if (!route) return [] const breadcrumb: Array<{id: string, title: string}> = [] // 添加一级菜单 if (route.parentId) { const topMenu = topMenus.find(m => m.id === route.parentId) if (topMenu) { breadcrumb.push({ id: topMenu.id, title: topMenu.title }) } } // 添加当前路由 breadcrumb.push({ id: route.id, title: route.title }) return breadcrumb }