import React from 'react'; import { isUrl } from '../utils/utils'; import AXIcon from '../components/AXIcon'; const menuData = () => { return [{ name: '统计概览', icon: 'dashboard', path: 'dashboard', children: [{ // name: '营销统计', // path: 'analysis', // icon: <AXIcon type="monitor" />, // }, { name: '销售详情', path: 'sold', icon: <AXIcon type="action" />, }, { name: '账号资源', path: 'accounts', icon: 'database', }], authority: ['admin', 'platform'], }, { name: '基础资源', icon: 'folder', path: 'resource', children: [{ name: '图库管理', path: 'picture', icon: 'file-jpg', }, { name: '视频管理', path: 'video', icon: 'video-camera', }, { name: '有声读物', path: 'audiobook', icon: 'notification', }], authority: ['admin', 'platform'], }, { name: '产品加工', icon: 'appstore-o', path: 'product', children: [{ name: '制作课件', path: 'courseware', }, { name: '制作课', path: 'lesson', }, { name: '制作课程', path: 'course', }, { name: '制作配套', path: 'support', }, { name: '制作师训', path: 'training', }, { name: '制作套餐包', path: 'package', }], authority: ['admin', 'platform'], }, { name: '产品出售', icon: 'shop', path: 'shelves', children: [{ name: '上架课程', path: 'course', }, { name: '上架配套', path: 'support', }, { name: '上架师训', path: 'training', }, { name: '上架套餐包', path: 'package', }], authority: ['admin', 'platform'], }, { name: '前端配置', icon: 'android-o', path: 'frontend', children: [{ name: '栏目类型', path: 'tagType', }, { name: '侧边栏目', path: 'tag', }, { name: '推荐内容', path: 'recommend', }, { name: '个性化配置', path: 'personalize', }], authority: ['admin', 'platform'], }, { name: '交易管理', icon: 'trademark', path: 'trade', children: [{ name: '购物车', icon: 'shopping-cart', path: 'shopcart', }, { name: '订单列表', icon: <AXIcon type="order" />, path: 'order', }], authority: ['admin', 'platform'], }, { name: '厂商管理', icon: 'team', path: 'merchant', children: [{ name: '商户列表', path: 'list', }], authority: ['admin', 'platform'], }, { name: '校区管理', icon: <AXIcon type="campus" />, path: 'campus', children: [{ name: '校区列表', path: 'list', }], authority: ['admin', 'platform', 'channel'], }, { name: '终端管理', path: 'terminal', icon: <AXIcon type="terminal" />, children: [{ name: '终端用户', path: 'user', }, { name: '权限列表', path: 'auth', }, { name: '白名单', path: 'whitelist', }], authority: ['admin', 'platform', 'channel'], }, { name: '系统管理', path: 'system', icon: <AXIcon type="systemuser" />, children: [{ name: '系统用户', path: 'cms-user', }], authority: 'admin', }]; }; function formatter(data, parentPath = '/', parentAuthority) { return data.map((item) => { let { path } = item; if (!isUrl(path)) { path = parentPath + item.path; } const result = { ...item, path, authority: item.authority || parentAuthority, }; if (item.children) { result.children = formatter(item.children, `${parentPath}${item.path}/`, item.authority); } return result; }); } export const getMenuData = () => formatter(menuData());