routes.tsx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /**
  2. * @name umi 的路由配置
  3. * @description 只支持 path,component,routes,redirect,wrappers,name,icon 的配置
  4. * @param path path 只支持两种占位符配置,第一种是动态参数 :id 的形式,第二种是 * 通配符,通配符只能出现路由字符串的最后。
  5. * @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径,也可以是相对路径,如果是相对路径,会从 src/pages 开始找起。
  6. * @param routes 配置子路由,通常在需要为多个路径增加 layout 组件时使用。
  7. * @param redirect 配置路由跳转
  8. * @param wrappers 配置路由组件的包装组件,通过包装组件可以为当前的路由组件组合进更多的功能。 比如,可以用于路由级别的权限校验
  9. * @param name 配置路由的标题,默认读取国际化文件 menu.ts 中 menu.xxxx 的值,如配置 name 为 login,则读取 menu.ts 中 menu.login 的取值作为标题
  10. * @param icon 配置路由的图标,取值参考 https://ant.design/components/icon-cn, 注意去除风格后缀和大小写,如想要配置图标为 <StepBackwardOutlined /> 则取值应为 stepBackward 或 StepBackward,如想要配置图标为 <UserOutlined /> 则取值应为 user 或者 User
  11. * @doc https://umijs.org/docs/guides/routes
  12. */
  13. const newMenu = [
  14. // 分销商页面
  15. {
  16. path: '/distributor',
  17. redirect: '/distributor/miniApp',
  18. },
  19. {
  20. name: 'distributor.account',
  21. icon: 'icon-zhanghaoguanli',
  22. path: '/distributor/account',
  23. access: "isShow",
  24. component: './Distributor/Account',
  25. },
  26. {
  27. name: 'distributor.miniApp',
  28. icon: 'icon-xiaochengxu',
  29. path: '/distributor/miniApp',
  30. access: "isShow",
  31. component: './Distributor/MiniApp',
  32. },
  33. // 小程序页面
  34. {
  35. path: '/miniApp',
  36. redirect: '/miniApp/book',
  37. },
  38. // 小说管理
  39. {
  40. path: '/miniApp/book',
  41. name: 'miniApp.book',
  42. icon: 'icon-xiaoshuo-wx',
  43. access: 'isShow',
  44. routes: [
  45. {
  46. path: '/miniApp/book',
  47. redirect: '/miniApp/book/short',
  48. },
  49. {
  50. path: '/miniApp/book/short',
  51. name: "short",
  52. component: './MiniApp/BookManage/Short',
  53. },
  54. {
  55. path: '/miniApp/book/long',
  56. name: 'long',
  57. component: './MiniApp/BookManage/Long',
  58. },
  59. ],
  60. },
  61. // 阅读记录
  62. {
  63. path: '/miniApp/readLog',
  64. name: 'miniApp.readLog',
  65. icon: 'icon-yuedu-2-wx',
  66. access: 'isShow',
  67. routes: [
  68. {
  69. path: '/miniApp/readLog',
  70. redirect: '/miniApp/readLog/short',
  71. },
  72. {
  73. path: '/miniApp/readLog/short',
  74. name: "short",
  75. component: './MiniApp/ReadLog/Short',
  76. },
  77. {
  78. path: '/miniApp/readLog/long',
  79. name: 'long',
  80. component: './MiniApp/ReadLog/Long',
  81. },
  82. ],
  83. },
  84. // 充值记录
  85. {
  86. path: '/miniApp/payLog',
  87. name: 'miniApp.payLog',
  88. icon: 'icon-chongzhi01-wx',
  89. access: 'isShow',
  90. routes: [
  91. {
  92. path: '/miniApp/payLog',
  93. redirect: '/miniApp/payLog/short',
  94. },
  95. {
  96. path: '/miniApp/payLog/short',
  97. name: "short",
  98. component: './MiniApp/PayLog/Short',
  99. },
  100. {
  101. path: '/miniApp/payLog/long',
  102. name: 'long',
  103. component: './MiniApp/PayLog/Long',
  104. },
  105. ],
  106. },
  107. // 消费订单管理
  108. {
  109. name: 'miniApp.consume',
  110. icon: 'icon-xiaofei-wx',
  111. path: '/miniApp/consume',
  112. access: "isShow",
  113. component: './MiniApp/Consume',
  114. },
  115. // 小程序端管理
  116. {
  117. name: 'miniApp.appManage',
  118. icon: 'icon-xiaochengxu-wx',
  119. path: '/miniApp/moduleConfig',
  120. access: "isShow",
  121. component: './Admin',
  122. },
  123. // 书币充值模板
  124. {
  125. name: 'miniApp.payModuleConfig',
  126. icon: 'icon-taojinbi-wx',
  127. path: '/miniApp/payModuleConfig',
  128. access: "isShow",
  129. component: './MiniApp/ModuleConfig',
  130. },
  131. ]
  132. export default [
  133. {
  134. path: '/user',
  135. layout: false,
  136. routes: [
  137. {
  138. name: 'login',
  139. path: '/user/login',
  140. component: './User/Login',
  141. },
  142. ],
  143. },
  144. {
  145. path: '/',
  146. redirect: '/distributor/miniApp',
  147. },
  148. {
  149. path: '*',
  150. layout: false,
  151. component: './404',
  152. },
  153. ...newMenu
  154. ];