menu.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. import React from 'react';
  2. import { isUrl } from '../utils/utils';
  3. import AXIcon from '../components/AXIcon';
  4. const menuData = () => {
  5. return [{
  6. name: '统计概览',
  7. icon: 'dashboard',
  8. path: 'dashboard',
  9. children: [{
  10. // name: '营销统计',
  11. // path: 'analysis',
  12. // icon: <AXIcon type="monitor" />,
  13. // }, {
  14. name: '销售详情',
  15. path: 'sold',
  16. icon: <AXIcon type="action" />,
  17. }, {
  18. name: '账号资源',
  19. path: 'accounts',
  20. icon: 'database',
  21. }],
  22. authority: ['admin', 'platform'],
  23. }, {
  24. name: '基础资源',
  25. icon: 'folder',
  26. path: 'resource',
  27. children: [{
  28. name: '图库管理',
  29. path: 'picture',
  30. icon: 'file-jpg',
  31. }, {
  32. name: '视频管理',
  33. path: 'video',
  34. icon: 'video-camera',
  35. }, {
  36. name: '有声读物',
  37. path: 'audiobook',
  38. icon: 'notification',
  39. }],
  40. authority: ['admin', 'platform'],
  41. }, {
  42. name: '产品加工',
  43. icon: 'appstore-o',
  44. path: 'product',
  45. children: [{
  46. name: '制作课件',
  47. path: 'courseware',
  48. }, {
  49. name: '制作课',
  50. path: 'lesson',
  51. }, {
  52. name: '制作课程',
  53. path: 'course',
  54. }, {
  55. name: '制作配套',
  56. path: 'support',
  57. }, {
  58. name: '制作师训',
  59. path: 'training',
  60. }, {
  61. name: '制作套餐包',
  62. path: 'package',
  63. }],
  64. authority: ['admin', 'platform'],
  65. }, {
  66. name: '产品出售',
  67. icon: 'shop',
  68. path: 'shelves',
  69. children: [{
  70. name: '上架课程',
  71. path: 'course',
  72. }, {
  73. name: '上架配套',
  74. path: 'support',
  75. }, {
  76. name: '上架师训',
  77. path: 'training',
  78. }, {
  79. name: '上架套餐包',
  80. path: 'package',
  81. }],
  82. authority: ['admin', 'platform'],
  83. }, {
  84. name: '前端配置',
  85. icon: 'android-o',
  86. path: 'frontend',
  87. children: [{
  88. name: '栏目类型',
  89. path: 'tagType',
  90. }, {
  91. name: '侧边栏目',
  92. path: 'tag',
  93. }, {
  94. name: '推荐内容',
  95. path: 'recommend',
  96. }, {
  97. name: '个性化配置',
  98. path: 'personalize',
  99. }],
  100. authority: ['admin', 'platform'],
  101. }, {
  102. name: '交易管理',
  103. icon: 'trademark',
  104. path: 'trade',
  105. children: [{
  106. name: '购物车',
  107. icon: 'shopping-cart',
  108. path: 'shopcart',
  109. }, {
  110. name: '订单列表',
  111. icon: <AXIcon type="order" />,
  112. path: 'order',
  113. }],
  114. authority: ['admin', 'platform'],
  115. }, {
  116. name: '厂商管理',
  117. icon: 'team',
  118. path: 'merchant',
  119. children: [{
  120. name: '商户列表',
  121. path: 'list',
  122. }],
  123. authority: ['admin', 'platform'],
  124. }, {
  125. name: '校区管理',
  126. icon: <AXIcon type="campus" />,
  127. path: 'campus',
  128. children: [{
  129. name: '校区列表',
  130. path: 'list',
  131. }],
  132. authority: ['admin', 'platform', 'channel'],
  133. }, {
  134. name: '终端管理',
  135. path: 'terminal',
  136. icon: <AXIcon type="terminal" />,
  137. children: [{
  138. name: '终端用户',
  139. path: 'user',
  140. }, {
  141. name: '权限列表',
  142. path: 'auth',
  143. }, {
  144. name: '白名单',
  145. path: 'whitelist',
  146. }],
  147. authority: ['admin', 'platform', 'channel'],
  148. }, {
  149. name: '系统管理',
  150. path: 'system',
  151. icon: <AXIcon type="systemuser" />,
  152. children: [{
  153. name: '系统用户',
  154. path: 'cms-user',
  155. }],
  156. authority: 'admin',
  157. }];
  158. };
  159. function formatter(data, parentPath = '/', parentAuthority) {
  160. return data.map((item) => {
  161. let { path } = item;
  162. if (!isUrl(path)) {
  163. path = parentPath + item.path;
  164. }
  165. const result = {
  166. ...item,
  167. path,
  168. authority: item.authority || parentAuthority,
  169. };
  170. if (item.children) {
  171. result.children = formatter(item.children, `${parentPath}${item.path}/`, item.authority);
  172. }
  173. return result;
  174. });
  175. }
  176. export const getMenuData = () => formatter(menuData());