routes.tsx 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. path: '/distribution/miniprogram/pagesManage',
  91. name: '页面模板管理',
  92. component: './distribution/miniprogram/pagesManage',
  93. },
  94. ],
  95. },
  96. {
  97. path: '/distribution/book',
  98. name: '小说信息',
  99. icon: 'icon-xiaoshuoxinxi',
  100. routes: [
  101. {
  102. path: '/distribution/book',
  103. redirect: '/distribution/book//longBook',
  104. },
  105. {
  106. path: '/distribution/book/longBook',
  107. name: '长篇小说',
  108. component: './distribution/book/longBook',
  109. },
  110. {
  111. path: '/distribution/book/shortBook',
  112. name: '短篇小说',
  113. component: './distribution/book/shortBook',
  114. },
  115. ],
  116. },
  117. {
  118. path: '/distribution/readLog',
  119. name: '阅读记录',
  120. icon: 'icon-yuedu-2',
  121. routes: [
  122. {
  123. path: '/distribution/readLog',
  124. redirect: '/distribution/readLog/long',
  125. },
  126. {
  127. path: '/distribution/readLog/long',
  128. name: '长篇小说',
  129. component: './distribution/readLog/long',
  130. },
  131. {
  132. path: '/distribution/readLog/short',
  133. name: '短篇小说',
  134. component: './distribution/readLog/short',
  135. },
  136. ],
  137. },
  138. {
  139. path: '/distribution/orderLog',
  140. name: '订单记录',
  141. icon: 'icon-xiaofei',
  142. routes: [
  143. {
  144. path: '/distribution/orderLog',
  145. redirect: '/distribution/orderLog/long',
  146. },
  147. {
  148. path: '/distribution/orderLog/long',
  149. name: '长篇小说',
  150. component: './distribution/orderLog/long',
  151. },
  152. {
  153. path: '/distribution/orderLog/short',
  154. name: '短篇小说',
  155. component: './distribution/orderLog/short',
  156. },
  157. ],
  158. },
  159. {
  160. path: '/distribution/payLog',
  161. name: '书币记录',
  162. icon: 'icon-shubi',
  163. routes: [
  164. {
  165. path: '/distribution/payLog',
  166. redirect: '/distribution/payLog/long',
  167. },
  168. {
  169. path: '/distribution/payLog/long',
  170. name: '长篇小说',
  171. component: './distribution/payLog/long',
  172. },
  173. {
  174. path: '/distribution/payLog/short',
  175. name: '短篇小说',
  176. component: './distribution/payLog/short',
  177. },
  178. ],
  179. },
  180. {
  181. path: '/distribution/system',
  182. name: '系统信息',
  183. icon: 'icon-xitong',
  184. component: './distribution/system',
  185. },
  186. ],
  187. },
  188. ];
  189. export default [
  190. {
  191. path: '/user',
  192. layout: false,
  193. routes: [
  194. {
  195. name: 'login',
  196. path: '/user/login',
  197. component: './User/Login',
  198. },
  199. ],
  200. },
  201. {
  202. //默认进入后打开哪个页面
  203. path: '/',
  204. redirect: '/book',
  205. },
  206. {
  207. path: '*',
  208. layout: false,
  209. component: './404',
  210. },
  211. ...newMenu,
  212. ];