menu.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. import React from 'react';
  2. import { isUrl } from '../utils/utils';
  3. import { plantform } from '../utils/config';
  4. import RBIcon from '../components/RBIcon';
  5. const menuData = () => {
  6. if ('LJ' === plantform) {
  7. return [{
  8. name: '统计概览',
  9. icon: 'dashboard',
  10. path: 'dashboard',
  11. children: [{
  12. name: '运行监控',
  13. path: 'analysis',
  14. icon: <RBIcon type="apprun" />,
  15. }, {
  16. name: '营销统计',
  17. path: 'monitor',
  18. icon: <RBIcon type="monitor" />,
  19. }, {
  20. name: '行为分析',
  21. path: 'workplace',
  22. icon: <RBIcon type="action" />,
  23. }],
  24. }, {
  25. name: '基础资源',
  26. icon: 'folder',
  27. path: 'resource',
  28. children: [{
  29. name: '图库管理',
  30. path: 'image',
  31. icon: 'file-jpg',
  32. }, {
  33. name: '视频管理',
  34. path: 'video',
  35. icon: 'video-camera',
  36. }],
  37. }, {
  38. name: '产品加工',
  39. icon: 'appstore-o',
  40. path: 'product',
  41. children: [{
  42. name: '制作课件',
  43. path: 'ware',
  44. }, {
  45. name: '制作课',
  46. path: 'lesson',
  47. }, {
  48. name: '制作课程',
  49. path: 'course',
  50. }, {
  51. name: '制作配套',
  52. path: 'support',
  53. }, {
  54. name: '制作套装包',
  55. path: 'package',
  56. }],
  57. }, {
  58. name: '产品出售',
  59. icon: 'shop',
  60. path: 'goods',
  61. children: [{
  62. name: '虚拟课程',
  63. path: 'virtual',
  64. }, {
  65. name: '实体物品',
  66. path: 'entity',
  67. }, {
  68. name: '打包套装',
  69. path: 'package',
  70. }],
  71. }, {
  72. name: '前端配置',
  73. icon: 'android-o',
  74. path: 'app',
  75. children: [{
  76. name: '首页入口',
  77. path: 'tagGroup',
  78. }, {
  79. name: '标签栏目',
  80. path: 'tag',
  81. }, {
  82. name: '推荐位配置',
  83. path: 'recommend',
  84. }],
  85. }, {
  86. name: '订单系统',
  87. icon: 'trademark',
  88. path: 'trade',
  89. children: [{
  90. name: '购物车',
  91. icon: 'shopping-cart',
  92. path: 'shopcart',
  93. }, {
  94. name: '订单列表',
  95. icon: <RBIcon type="order" />,
  96. }]
  97. }, {
  98. name: '厂商管理',
  99. icon: 'team',
  100. path: 'merchant',
  101. }, {
  102. name: '校区管理',
  103. icon: <RBIcon type="campus" />,
  104. path: 'campus',
  105. }, {
  106. name: '终端用户',
  107. path: 'terminal',
  108. icon: <RBIcon type="terminal" />
  109. }, {
  110. name: '系统用户',
  111. path: 'system',
  112. icon: <RBIcon type="systemuser" />
  113. }];
  114. } else if ('PJ' === plantform) {
  115. return [{
  116. name: '统计概览',
  117. icon: 'dashboard',
  118. path: 'dashboard',
  119. children: [{
  120. name: '运行监控',
  121. path: 'analysis',
  122. icon: <RBIcon type="apprun" />,
  123. }, {
  124. name: '营销统计',
  125. path: 'monitor',
  126. icon: <RBIcon type="monitor" />,
  127. }, {
  128. name: '行为分析',
  129. path: 'workplace',
  130. icon: <RBIcon type="action" />,
  131. }],
  132. }, {
  133. name: '产品库',
  134. icon: 'shop',
  135. path: 'goods',
  136. children: [{
  137. name: '虚拟课程',
  138. path: 'virtual',
  139. }, {
  140. name: '实体物品',
  141. path: 'entity',
  142. }, {
  143. name: '打包套装',
  144. path: 'package',
  145. }],
  146. }, {
  147. name: '订单系统',
  148. icon: 'trademark',
  149. path: 'trade',
  150. children: [{
  151. name: '购物车',
  152. icon: 'shopping-cart',
  153. path: 'shopcart',
  154. }, {
  155. name: '订单列表',
  156. icon: <RBIcon type="order" />,
  157. }]
  158. }, {
  159. name: '校区管理',
  160. icon: <RBIcon type="campus" />,
  161. path: 'campus',
  162. }, {
  163. name: '终端用户',
  164. path: 'terminal',
  165. icon: <RBIcon type="terminal" />
  166. }, {
  167. name: '账户信息',
  168. icon: 'team',
  169. path: 'merchant',
  170. }];
  171. } else if ('CP' === plantform) {
  172. return [{
  173. name: '统计概览',
  174. icon: 'dashboard',
  175. path: 'dashboard',
  176. children: [{
  177. name: '营销统计',
  178. path: 'monitor',
  179. icon: <RBIcon type="monitor" />,
  180. }]
  181. }, {
  182. name: '产品库',
  183. icon: 'shop',
  184. path: 'goods',
  185. children: [{
  186. name: '虚拟课程',
  187. path: 'virtual',
  188. }, {
  189. name: '实体物品',
  190. path: 'entity',
  191. }, {
  192. name: '打包套装',
  193. path: 'package',
  194. }],
  195. }, {
  196. name: '订单系统',
  197. icon: 'trademark',
  198. path: 'trade',
  199. children: [{
  200. name: '订单列表',
  201. icon: <RBIcon type="order" />,
  202. }]
  203. }, {
  204. name: '账户信息',
  205. icon: 'team',
  206. path: 'merchant',
  207. }];
  208. }
  209. };
  210. function formatter(data, parentPath = '/', parentAuthority) {
  211. return data.map((item) => {
  212. let { path } = item;
  213. if (!isUrl(path)) {
  214. path = parentPath + item.path;
  215. }
  216. const result = {
  217. ...item,
  218. path,
  219. authority: item.authority || parentAuthority,
  220. };
  221. if (item.children) {
  222. result.children = formatter(item.children, `${parentPath}${item.path}/`, item.authority);
  223. }
  224. return result;
  225. });
  226. }
  227. export const getMenuData = () => formatter(menuData());