123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- import React from 'react';
- import { isUrl } from '../utils/utils';
- import { plantform } from '../utils/config';
- import RBIcon from '../components/RBIcon';
- const menuData = () => {
- if ('LJ' === plantform) {
- return [{
- name: '统计概览',
- icon: 'dashboard',
- path: 'dashboard',
- children: [{
- name: '运行监控',
- path: 'analysis',
- icon: <RBIcon type="apprun" />,
- }, {
- name: '营销统计',
- path: 'monitor',
- icon: <RBIcon type="monitor" />,
- }, {
- name: '行为分析',
- path: 'workplace',
- icon: <RBIcon type="action" />,
- }],
- }, {
- name: '基础资源',
- icon: 'folder',
- path: 'resource',
- children: [{
- name: '图库管理',
- path: 'image',
- icon: 'file-jpg',
- }, {
- name: '视频管理',
- path: 'video',
- icon: 'video-camera',
- }],
- }, {
- name: '产品加工',
- icon: 'appstore-o',
- path: 'product',
- children: [{
- name: '制作课件',
- path: 'ware',
- }, {
- name: '制作课',
- path: 'lesson',
- }, {
- name: '制作课程',
- path: 'course',
- }, {
- name: '制作配套',
- path: 'support',
- }, {
- name: '制作套装包',
- path: 'package',
- }],
- }, {
- name: '产品出售',
- icon: 'shop',
- path: 'goods',
- children: [{
- name: '虚拟课程',
- path: 'virtual',
- }, {
- name: '实体物品',
- path: 'entity',
- }, {
- name: '打包套装',
- path: 'package',
- }],
- }, {
- name: '前端配置',
- icon: 'android-o',
- path: 'app',
- children: [{
- name: '首页入口',
- path: 'tagGroup',
- }, {
- name: '标签栏目',
- path: 'tag',
- }, {
- name: '推荐位配置',
- path: 'recommend',
- }],
- }, {
- name: '订单系统',
- icon: 'trademark',
- path: 'trade',
- children: [{
- name: '购物车',
- icon: 'shopping-cart',
- path: 'shopcart',
- }, {
- name: '订单列表',
- icon: <RBIcon type="order" />,
- }]
- }, {
- name: '厂商管理',
- icon: 'team',
- path: 'merchant',
- }, {
- name: '校区管理',
- icon: <RBIcon type="campus" />,
- path: 'campus',
- }, {
- name: '终端用户',
- path: 'terminal',
- icon: <RBIcon type="terminal" />
- }, {
- name: '系统用户',
- path: 'system',
- icon: <RBIcon type="systemuser" />
- }];
- } else if ('PJ' === plantform) {
- return [{
- name: '统计概览',
- icon: 'dashboard',
- path: 'dashboard',
- children: [{
- name: '运行监控',
- path: 'analysis',
- icon: <RBIcon type="apprun" />,
- }, {
- name: '营销统计',
- path: 'monitor',
- icon: <RBIcon type="monitor" />,
- }, {
- name: '行为分析',
- path: 'workplace',
- icon: <RBIcon type="action" />,
- }],
- }, {
- name: '产品库',
- icon: 'shop',
- path: 'goods',
- children: [{
- name: '虚拟课程',
- path: 'virtual',
- }, {
- name: '实体物品',
- path: 'entity',
- }, {
- name: '打包套装',
- path: 'package',
- }],
- }, {
- name: '订单系统',
- icon: 'trademark',
- path: 'trade',
- children: [{
- name: '购物车',
- icon: 'shopping-cart',
- path: 'shopcart',
- }, {
- name: '订单列表',
- icon: <RBIcon type="order" />,
- }]
- }, {
- name: '校区管理',
- icon: <RBIcon type="campus" />,
- path: 'campus',
- }, {
- name: '终端用户',
- path: 'terminal',
- icon: <RBIcon type="terminal" />
- }, {
- name: '账户信息',
- icon: 'team',
- path: 'merchant',
- }];
- } else if ('CP' === plantform) {
- return [{
- name: '统计概览',
- icon: 'dashboard',
- path: 'dashboard',
- children: [{
- name: '营销统计',
- path: 'monitor',
- icon: <RBIcon type="monitor" />,
- }]
- }, {
- name: '产品库',
- icon: 'shop',
- path: 'goods',
- children: [{
- name: '虚拟课程',
- path: 'virtual',
- }, {
- name: '实体物品',
- path: 'entity',
- }, {
- name: '打包套装',
- path: 'package',
- }],
- }, {
- name: '订单系统',
- icon: 'trademark',
- path: 'trade',
- children: [{
- name: '订单列表',
- icon: <RBIcon type="order" />,
- }]
- }, {
- name: '账户信息',
- icon: 'team',
- path: 'merchant',
- }];
- }
- };
- 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());
|