routes.tsx 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. path: '/book',
  16. name: '小说中心',
  17. icon: 'icon-xiaoshuo',
  18. routes: [
  19. {
  20. path: '/book',
  21. redirect: '/book/bookManage/author',
  22. },
  23. {
  24. path: '/book/bookManage/author',
  25. name: '作者管理',
  26. icon: 'icon-gaojian-zuozhe',
  27. component: './book/bookManage/author',
  28. },
  29. {
  30. path: '/book/bookManage/bookTags',
  31. name: '标签管理',
  32. icon: 'icon-biaoqian',
  33. component: './book/bookManage/bookTags',
  34. },
  35. {
  36. path: '/book/bookManage/classifyList',
  37. name: '分类管理',
  38. icon: 'icon-fenlei',
  39. component: './book/bookManage/classifyList',
  40. },
  41. {
  42. path: '/book/bookManage/longbookList',
  43. name: '长篇小说',
  44. icon: 'icon-changpianxiaoshuo',
  45. component: './book/bookManage/longbookList',
  46. },
  47. {
  48. path: '/book/bookManage/shortbookList',
  49. name: '短篇小说',
  50. icon: 'icon-changpianxiaoshuo',
  51. component: './book/bookManage/shortbookList',
  52. },
  53. ],
  54. },
  55. {
  56. path: '/distribution',
  57. name: '分销中心',
  58. icon: 'icon-fenxiao',
  59. routes: [
  60. {
  61. path: '/distribution',
  62. redirect: '/distribution/distributor/info',
  63. },
  64. {
  65. path: '/distribution/distributor/info',
  66. name: '分销商信息',
  67. icon: 'icon-fenxiaoshangxiaoxi',
  68. component: './distribution/distributor/info',
  69. },
  70. {
  71. path: '/distribution/miniprogram',
  72. name: '小程序',
  73. icon: 'icon-xiaochengxu',
  74. routes: [
  75. {
  76. path: '/distribution/miniprogram',
  77. redirect: '/distribution/miniprogram/weChatInfo',
  78. },
  79. {
  80. path: '/distribution/miniprogram/weChatInfo',
  81. name: '小程序信息',
  82. component: './distribution/miniprogram/weChatInfo',
  83. },
  84. {
  85. path: '/distribution/miniprogram/mimiModule',
  86. name: '小程序组件配置',
  87. component: './distribution/miniprogram/mimiModule',
  88. },
  89. ],
  90. },
  91. {
  92. path: '/distribution/book',
  93. name: '小说信息',
  94. icon: 'icon-xiaoshuoxinxi',
  95. routes: [
  96. {
  97. path: '/distribution/book',
  98. redirect: '/distribution/book//longBook',
  99. },
  100. {
  101. path: '/distribution/book/longBook',
  102. name: '长篇小说',
  103. component: './distribution/book/longBook',
  104. },
  105. {
  106. path: '/distribution/book/shortBook',
  107. name: '短篇小说',
  108. component: './distribution/book/shortBook',
  109. },
  110. ],
  111. },
  112. {
  113. path: '/distribution/readLog',
  114. name: '阅读记录',
  115. icon: 'icon-yuedu-2',
  116. routes: [
  117. {
  118. path: '/distribution/readLog',
  119. redirect: '/distribution/readLog/long',
  120. },
  121. {
  122. path: '/distribution/readLog/long',
  123. name: '长篇小说',
  124. component: './distribution/readLog/long',
  125. },
  126. {
  127. path: '/distribution/readLog/short',
  128. name: '短篇小说',
  129. component: './distribution/readLog/short',
  130. },
  131. ],
  132. },
  133. {
  134. path: '/distribution/orderLog',
  135. name: '订单记录',
  136. icon: 'icon-xiaofei',
  137. routes: [
  138. {
  139. path: '/distribution/orderLog',
  140. redirect: '/distribution/orderLog/long',
  141. },
  142. {
  143. path: '/distribution/orderLog/long',
  144. name: '长篇小说',
  145. component: './distribution/orderLog/long',
  146. },
  147. {
  148. path: '/distribution/orderLog/short',
  149. name: '短篇小说',
  150. component: './distribution/orderLog/short',
  151. },
  152. ],
  153. },
  154. {
  155. path: '/distribution/payLog',
  156. name: '书币记录',
  157. icon: 'icon-shubi',
  158. routes: [
  159. {
  160. path: '/distribution/payLog',
  161. redirect: '/distribution/payLog/long',
  162. },
  163. {
  164. path: '/distribution/payLog/long',
  165. name: '长篇小说',
  166. component: './distribution/payLog/long',
  167. },
  168. {
  169. path: '/distribution/payLog/short',
  170. name: '短篇小说',
  171. component: './distribution/payLog/short',
  172. },
  173. ],
  174. },
  175. {
  176. path: '/distribution/system',
  177. name: '系统信息',
  178. icon: 'icon-xitong',
  179. component: './distribution/system',
  180. },
  181. ],
  182. },
  183. ];
  184. export default [
  185. {
  186. path: '/user',
  187. layout: false,
  188. routes: [
  189. {
  190. name: 'login',
  191. path: '/user/login',
  192. component: './User/Login',
  193. },
  194. ],
  195. },
  196. {
  197. //默认进入后打开哪个页面
  198. path: '/',
  199. redirect: '/book',
  200. },
  201. {
  202. path: '*',
  203. layout: false,
  204. component: './404',
  205. },
  206. ...newMenu,
  207. ];