import React from 'react' import { RouteComponentProps, RouteProps } from 'react-router-dom' import Pages from './page' export type IRouteItem = { id: number path: string sort?: number title?: string name?: string icon?: string exact?: boolean hideMenu?: boolean //隐藏当前菜单 hideSubMenu?: boolean //隐藏下级菜单 redirect?: string noAuth?: boolean component?: React.ComponentType> | React.ComponentType childRoute?: IRouteItem[] } & RouteProps const config: IRouteItem[] = [ { id: 100, sort: 1, title: '首页', icon: 'home', name: 'home', path: '/', component: Pages.Home, // hideMenu: true, // hideSubMenu: true, childRoute: [], }, // { // id: 101, // sort: 2, // title: '审批中心', // icon: 'approval', // name: 'approval-center', // path: '/approval', // component: Pages.Approval, // noAuth: false, // childRoute: [ // { // id: 101001, // sort: 1, // title: '入驻审批', // name: 'dashboard', // path: '/approval/settle', // component: Pages.Approval, // childRoute: [], // }, // ], // }, { id: 102, sort: 3, title: '商户管理', icon: 'merchant', name: 'business-management', path: '/business', component: Pages.ServiceList, noAuth: false, childRoute: [ { id: 102001, sort: 1, title: '商户列表', name: 'business_list', path: '/business/provider', component: Pages.ServiceList, hideSubMenu: true, noAuth: false, childRoute: [ { id: 102001001, sort: 1, title: '新增特殊价', name: 'price_add', path: '/business/provider/specialPrice/add/:uid', component: Pages.speicalPriceAdd, noAuth: false, childRoute: [], }, { id: 102001002, sort: 2, title: '账户明细', name: 'account_detail', path: '/business/provider/account/:uid', component: Pages.AccountDetail, noAuth: false, childRoute: [], }, { id: 102001003, sort: 3, title: '设置特殊价', name: 'price_setting', path: '/business/provider/specialPrice/:uid', component: Pages.specialPriceSetting, noAuth: false, childRoute: [], }, { id: 102001004, sort: 4, title: '设置特殊价', name: 'price_add', path: '/business/provider/specialPrice', component: Pages.specialPriceSetting, noAuth: false, childRoute: [], }, ], }, { id: 102003, sort: 2, title: '商户角色', name: 'business_role', path: '/business/role', component: Pages.Channel, hideSubMenu: true, noAuth: false, childRoute: [ { id: 102003001, sort: 1, title: '渠道价盘', name: 'channel_price', path: '/business/role/channelPrice/:roleId', component: Pages.ChannelPriceSet, noAuth: false, childRoute: [], }, ], }, ], }, { id: 103, sort: 4, title: '订单管理', icon: 'order', name: 'order-management', path: '/order', component: Pages.Order, noAuth: false, // hideMenu: true, // hideSubMenu: true, childRoute: [ { id: 103001, sort: 1, title: '实物订单', name: 'dashboard', path: '/order/physical', component: Pages.Order, noAuth: false, childRoute: [], }, { id: 103002, sort: 2, title: '订单详情', name: 'dashboard', path: '/order/physical/detail/:id', component: Pages.OrderDetails, hideMenu: true, noAuth: false, childRoute: [], }, ], }, { id: 105, sort: 5, title: '奖励中心', icon: 'award', name: 'award-center', path: '/award', component: Pages.MerchantList, noAuth: false, // hideMenu: true, // hideSubMenu: true, childRoute: [ { id: 105001, sort: 1, title: '商户列表', name: 'dashboard', path: '/award/merchant/list', component: Pages.MerchantList, hideSubMenu: true, noAuth: false, childRoute: [ { id: 105001001, sort: 1, title: '奖励账户明细', name: 'dashboard', path: '/award/account/detail/:id', component: Pages.AwardDetail, noAuth: false, childRoute: [], }, ], }, { id: 105002, sort: 2, title: '拉新活动', name: 'dashboard', path: '/award/activity/list', component: Pages.ActivityList, noAuth: false, hideSubMenu: true, childRoute: [ { id: 105002001, sort: 1, title: '编辑拉新活动', name: 'dashboard', path: '/award/activity/edit', component: Pages.AddActivity, noAuth: false, childRoute: [], }, ], }, ], }, { id: 106, sort: 6, title: '供应商管理', icon: 'scm', name: 'scm', path: '/scm', component: Pages.SCMList, // hideMenu: true, // hideSubMenu: true, childRoute: [ { id: 106001, sort: 1, title: '供应商列表', name: 'dashboard', path: '/scm/scmList', component: Pages.SCMList, hideSubMenu: true, childRoute: [ { id: 106001001, sort: 1, title: '供应商详情', name: 'dashboard', path: '/scm/scmList/detail/:id', component: Pages.SCMDetail, children: [], }, ], }, ], }, { id: 104, sort: 5, title: '设置', icon: 'setting', name: 'setting', path: '/setting', component: Pages.AccountManage, noAuth: false, childRoute: [ { id: 104001, sort: 1, title: '用户管理', name: 'dashboard', path: '/setting/account', component: Pages.AccountManage, hideSubMenu: true, noAuth: false, childRoute: [ { id: 104001, sort: 1, title: '编辑用户', name: 'dashboard', path: '/setting/account/edit/:uid', component: Pages.AccountEdit, noAuth: false, childRoute: [], }, { id: 104001, sort: 1, title: '新增用户', name: 'dashboard', path: '/setting/account/add', component: Pages.AccountEdit, noAuth: false, childRoute: [], }, ], }, ], }, ] export const enum PermsKey { default = 'default', business = 'business', finance = 'finance', channel = 'channel', tech = 'tech', supply_chain = 'supply_chain', } //权限控制preset export const permsConfig = { // [PermsKey.default]: ['/business', '/business/provider'], [PermsKey.business]: [ '/business', '/business/provider', '/business/provider/account/:uid', '/order', '/order/physical', '/order/physical/detail/:id', '/award/merchant/list', '/award/account/detail/:id', '/award/activity/list', ], [PermsKey.finance]: [ '/business', '/business/provider', '/business/provider/account/:uid', '/order', '/order/physical', '/order/physical/detail/:id', '/award', '/award/merchant/list', '/award/account/detail/:id', '/award/activity/list', ], [PermsKey.channel]: [ '/business', '/business/provider', '/business/provider/account/:uid', '/business/role', '/business/role/channelPrice/:roleId', '/order', '/order/physical', '/order/physical/detail/:id', '/award', '/award/merchant/list', '/award/account/detail/:id', '/award/activity/list', '/scm', '/scm/scmList', '/scm/scmList/detail/:id', ], [PermsKey.supply_chain]: [ '/business', '/business/provider', '/business/provider/specialPrice', '/business/provider/specialPrice/add/:uid', '/business/provider/specialPrice/:uid', '/order', '/order/physical', '/order/physical/detail/:id', '/scm', '/scm/scmList', '/scm/scmList/detail/:id', ], [PermsKey.tech]: [ '/setting', '/setting/account', '/setting/account/edit/:uid', '/award', '/award/merchant/list', '/award/account/detail/:id', '/award/activity/list', '/award/activity/edit', ], } export default config