routes.tsx 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. 
  2. /**
  3. * @name umi 的路由配置
  4. * @description 只支持 path,component,routes,redirect,wrappers,name,icon 的配置
  5. * @param path path 只支持两种占位符配置,第一种是动态参数 :id 的形式,第二种是 * 通配符,通配符只能出现路由字符串的最后。
  6. * @param component 配置 location 和 path 匹配后用于渲染的 React 组件路径。可以是绝对路径,也可以是相对路径,如果是相对路径,会从 src/pages 开始找起。
  7. * @param routes 配置子路由,通常在需要为多个路径增加 layout 组件时使用。
  8. * @param redirect 配置路由跳转
  9. * @param wrappers 配置路由组件的包装组件,通过包装组件可以为当前的路由组件组合进更多的功能。 比如,可以用于路由级别的权限校验
  10. * @param name 配置路由的标题,默认读取国际化文件 menu.ts 中 menu.xxxx 的值,如配置 name 为 login,则读取 menu.ts 中 menu.login 的取值作为标题
  11. * @param icon 配置路由的图标,取值参考 https://ant.design/components/icon-cn, 注意去除风格后缀和大小写,如想要配置图标为 <StepBackwardOutlined /> 则取值应为 stepBackward 或 StepBackward,如想要配置图标为 <UserOutlined /> 则取值应为 user 或者 User
  12. * @doc https://umijs.org/docs/guides/routes
  13. */
  14. const newMenu = [
  15. {
  16. path: '/book',
  17. name: "小说中心",
  18. icon: 'icon-xiaoshuo',
  19. routes: [
  20. {
  21. path: '/book',
  22. redirect: '/book/bookManage/author',
  23. },
  24. {
  25. path: '/book/bookManage/author',
  26. name: "作者管理",
  27. component: './book/bookManage/author',
  28. },
  29. {
  30. path: '/book/bookManage/bookTags',
  31. name: "标签管理",
  32. component: './book/bookManage/bookTags',
  33. },
  34. {
  35. path: '/book/bookManage/classifyList',
  36. name: "分类管理",
  37. component: './book/bookManage/classifyList',
  38. },
  39. {
  40. path: '/book/bookManage/longbookList',
  41. name: "长篇小说",
  42. component: './book/bookManage/longbookList',
  43. },
  44. {
  45. path: '/book/bookManage/shortbookList',
  46. name: "短篇小说",
  47. component: './book/bookManage/shortbookList',
  48. },
  49. ],
  50. },
  51. {
  52. path: '/distribution',
  53. name: "分销中心",
  54. routes: [
  55. {
  56. path: '/distribution',
  57. redirect: '/distribution/distributor/info',
  58. },
  59. {
  60. path: '/distribution/distributor/info',
  61. name: "分销商信息",
  62. component: './distribution/distributor/info',
  63. },
  64. {
  65. path: '/distribution/miniprogram',
  66. name: "小程序",
  67. routes: [
  68. {
  69. path: '/distribution/miniprogram',
  70. redirect: '/distribution/miniprogram/weChatInfo',
  71. },
  72. {
  73. path: '/distribution/miniprogram/weChatInfo',
  74. name: "小程序信息",
  75. component: './distribution/miniprogram/weChatInfo',
  76. },
  77. {
  78. path: '/distribution/miniprogram/mimiModule',
  79. name: "小程序组件配置",
  80. component: './distribution/miniprogram/mimiModule',
  81. },
  82. ]
  83. },
  84. {
  85. path: '/distribution/book',
  86. name: "小说信息",
  87. routes: [
  88. {
  89. path: '/distribution/book',
  90. redirect: '/distribution/book//longBook',
  91. },
  92. {
  93. path: '/distribution/book//longBook',
  94. name: "长篇小说",
  95. component: './distribution/book/longBook',
  96. },
  97. {
  98. path: '/distribution/book/shortBook',
  99. name: "短篇小说",
  100. component: './distribution/book/shortBook',
  101. },
  102. ]
  103. },
  104. {
  105. path: '/distribution/readLog',
  106. name: "阅读记录",
  107. routes: [
  108. {
  109. path: '/distribution/readLog',
  110. redirect: '/distribution/readLog/long',
  111. },
  112. {
  113. path: '/distribution/readLog//long',
  114. name: "长篇小说",
  115. component: './distribution/readLog/long',
  116. },
  117. {
  118. path: '/distribution/readLog/short',
  119. name: "短篇小说",
  120. component: './distribution/readLog/short',
  121. },
  122. ]
  123. },
  124. {
  125. path: '/distribution/orderLog',
  126. name: "订单记录",
  127. routes: [
  128. {
  129. path: '/distribution/orderLog',
  130. redirect: '/distribution/orderLog/long',
  131. },
  132. {
  133. path: '/distribution/orderLog//long',
  134. name: "长篇小说",
  135. component: './distribution/orderLog/long',
  136. },
  137. {
  138. path: '/distribution/orderLog/short',
  139. name: "短篇小说",
  140. component: './distribution/orderLog/short',
  141. },
  142. ]
  143. },
  144. {
  145. path: '/distribution/payLog',
  146. name: "消费记录",
  147. routes: [
  148. {
  149. path: '/distribution/payLog',
  150. redirect: '/distribution/payLog/long',
  151. },
  152. {
  153. path: '/distribution/payLog//long',
  154. name: "长篇小说",
  155. component: './distribution/payLog/long',
  156. },
  157. {
  158. path: '/distribution/payLog/short',
  159. name: "短篇小说",
  160. component: './distribution/payLog/short',
  161. },
  162. ]
  163. },
  164. {
  165. path: '/distribution/system',
  166. name: "系统信息",
  167. component: './distribution/system',
  168. },
  169. ],
  170. },
  171. ]
  172. export default [
  173. {
  174. path: '/user',
  175. layout: false,
  176. routes: [
  177. {
  178. name: 'login',
  179. path: '/user/login',
  180. component: './User/Login',
  181. },
  182. ],
  183. },
  184. {//默认进入后打开哪个页面
  185. path: '/',
  186. redirect: '/book',
  187. },
  188. {
  189. path: '*',
  190. layout: false,
  191. component: './404',
  192. },
  193. ...newMenu
  194. ];