routes.tsx 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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/account',
  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',
  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. name: 'miniApp.appManage',
  64. icon: 'icon-xiaochengxu',
  65. path: '/miniApp/appManage',
  66. access: "isShow",
  67. routes: [
  68. {//小程序组件配置
  69. path: '/miniApp/appManage/moduleConfig',
  70. name: "moduleConfig",
  71. component: './Admin',
  72. },
  73. {//小程序组件信息
  74. path: '/miniApp/appManage/moduleInfo',
  75. name: "moduleInfo",
  76. component: './Admin',
  77. },
  78. {//短篇小说书架管理
  79. path: '/miniApp/appManage/shortBookShelf',
  80. name: "shortBookShelf",
  81. component: './Admin',
  82. },
  83. {//短篇小说管理
  84. path: '/miniApp/appManage/shortBook',
  85. name: "shortBook",
  86. component: './Admin',
  87. },
  88. {//长篇篇小说管理
  89. path: '/miniApp/appManage/longtBook',
  90. name: "longBook",
  91. component: './Admin',
  92. },
  93. {//分类管理
  94. path: '/miniApp/appManage/classify',
  95. name: "classify",
  96. component: './Admin',
  97. },
  98. ],
  99. },
  100. // 阅读记录
  101. {
  102. path: '/miniApp/readLog',
  103. name: 'miniApp.readLog',
  104. icon: 'icon-yuedu-2',
  105. access: 'isShow',
  106. routes: [
  107. {
  108. path: '/miniApp/readLog',
  109. redirect: '/miniApp/readLog/short',
  110. },
  111. {
  112. path: '/miniApp/readLog/short',
  113. name: "short",
  114. component: './MiniApp/ReadLog/Short',
  115. },
  116. {
  117. path: '/miniApp/readLog/long',
  118. name: 'long',
  119. component: './MiniApp/ReadLog/Long',
  120. },
  121. ],
  122. },
  123. // 充值记录
  124. {
  125. path: '/miniApp/payLog',
  126. name: 'miniApp.payLog',
  127. icon: 'icon-chongzhi01',
  128. access: 'isShow',
  129. routes: [
  130. {
  131. path: '/miniApp/payLog',
  132. redirect: '/miniApp/payLog/short',
  133. },
  134. {
  135. path: '/miniApp/payLog/short',
  136. name: "short",
  137. component: './MiniApp/PayLog/Short',
  138. },
  139. {
  140. path: '/miniApp/payLog/long',
  141. name: 'long',
  142. component: './MiniApp/PayLog/Long',
  143. },
  144. ],
  145. },
  146. // 消费订单管理
  147. {
  148. name: 'miniApp.consume',
  149. icon: 'icon-xiaofei',
  150. path: '/miniApp/consume',
  151. access: "isShow",
  152. component: './MiniApp/Consume',
  153. },
  154. // 书币充值模板
  155. {
  156. name: 'miniApp.payModuleConfig',
  157. icon: 'icon-shubi',
  158. path: '/miniApp/payModuleConfig',
  159. access: "isShow",
  160. component: './MiniApp/ModuleConfig',
  161. },
  162. ]
  163. export default [
  164. {
  165. path: '/user',
  166. layout: false,
  167. routes: [
  168. {
  169. name: 'login',
  170. path: '/user/login',
  171. component: './User/Login',
  172. },
  173. ],
  174. },
  175. {
  176. path: '/',
  177. redirect: '/distributor/miniApp',
  178. },
  179. {
  180. path: '*',
  181. layout: false,
  182. component: './404',
  183. },
  184. ...newMenu
  185. ];