routes.tsx 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. import route from "mock/route";
  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. icon: 'icon-gaojian-zuozhe',
  28. component: './book/bookManage/author',
  29. },
  30. {
  31. path: '/book/bookManage/bookTags',
  32. name: '标签管理',
  33. icon: 'icon-biaoqian',
  34. component: './book/bookManage/bookTags',
  35. },
  36. {
  37. path: '/book/bookManage/classifyList',
  38. name: '分类管理',
  39. icon: 'icon-fenlei',
  40. component: './book/bookManage/classifyList',
  41. },
  42. {
  43. path: '/book/bookManage/longbookList',
  44. name: '长篇小说',
  45. icon: 'icon-changpianxiaoshuo',
  46. component: './book/bookManage/longbookList',
  47. },
  48. {
  49. path: '/book/bookManage/shortbookList',
  50. name: '短篇小说',
  51. icon: 'icon-changpianxiaoshuo',
  52. component: './book/bookManage/shortbookList',
  53. },
  54. ],
  55. },
  56. {
  57. path: '/distribution',
  58. name: '分销中心',
  59. icon: 'icon-fenxiao',
  60. routes: [
  61. {
  62. path: '/distribution',
  63. redirect: '/distribution/distributor/info',
  64. },
  65. {
  66. path: '/distribution/distributor/info',
  67. name: '分销商信息',
  68. icon: 'icon-fenxiaoshangxiaoxi',
  69. component: './distribution/distributor/info',
  70. },
  71. {
  72. path: '/distribution/miniprogram',
  73. name: '小程序',
  74. icon: 'icon-xiaochengxu',
  75. routes: [
  76. {
  77. path: '/distribution/miniprogram',
  78. redirect: '/distribution/miniprogram/weChatInfo',
  79. },
  80. {
  81. path: '/distribution/miniprogram/weChatInfo',
  82. name: '小程序信息',
  83. component: './distribution/miniprogram/weChatInfo',
  84. },
  85. {
  86. path: '/distribution/miniprogram/mimiModule',
  87. name: '小程序组件配置',
  88. component: './distribution/miniprogram/mimiModule',
  89. },
  90. {
  91. path: '/distribution/miniprogram/pagesManage',
  92. name: '页面模板管理',
  93. component: './distribution/miniprogram/pagesManage',
  94. },
  95. ],
  96. },
  97. {
  98. path: '/distribution/book',
  99. name: '小说信息',
  100. icon: 'icon-xiaoshuoxinxi',
  101. routes: [
  102. {
  103. path: '/distribution/book',
  104. redirect: '/distribution/book//longBook',
  105. },
  106. {
  107. path: '/distribution/book/longBook',
  108. name: '长篇小说',
  109. component: './distribution/book/longBook',
  110. },
  111. {
  112. path: '/distribution/book/shortBook',
  113. name: '短篇小说',
  114. component: './distribution/book/shortBook',
  115. },
  116. ],
  117. },
  118. {
  119. path: '/distribution/readLog',
  120. name: '阅读记录',
  121. icon: 'icon-yuedu-2',
  122. routes: [
  123. {
  124. path: '/distribution/readLog',
  125. redirect: '/distribution/readLog/long',
  126. },
  127. {
  128. path: '/distribution/readLog/long',
  129. name: '长篇小说',
  130. component: './distribution/readLog/long',
  131. },
  132. {
  133. path: '/distribution/readLog/short',
  134. name: '短篇小说',
  135. component: './distribution/readLog/short',
  136. },
  137. ],
  138. },
  139. {
  140. path: '/distribution/orderLog',
  141. name: '订单记录',
  142. icon: 'icon-xiaofei',
  143. routes: [
  144. {
  145. path: '/distribution/orderLog',
  146. redirect: '/distribution/orderLog/long',
  147. },
  148. {
  149. path: '/distribution/orderLog/long',
  150. name: '长篇小说',
  151. component: './distribution/orderLog/long',
  152. },
  153. {
  154. path: '/distribution/orderLog/short',
  155. name: '短篇小说',
  156. component: './distribution/orderLog/short',
  157. },
  158. ],
  159. },
  160. {
  161. path: '/distribution/payLog',
  162. name: '书币记录',
  163. icon: 'icon-shubi',
  164. routes: [
  165. {
  166. path: '/distribution/payLog',
  167. redirect: '/distribution/payLog/long',
  168. },
  169. {
  170. path: '/distribution/payLog/long',
  171. name: '长篇小说',
  172. component: './distribution/payLog/long',
  173. },
  174. {
  175. path: '/distribution/payLog/short',
  176. name: '短篇小说',
  177. component: './distribution/payLog/short',
  178. },
  179. ],
  180. },
  181. {
  182. path: '/distribution/system',
  183. name: '系统信息',
  184. icon: 'icon-xitong',
  185. component: './distribution/system',
  186. },
  187. ],
  188. },
  189. {
  190. path: '/ai',
  191. name: '小说AI',
  192. icon: 'icon-xitong',
  193. routes: [
  194. {
  195. path: '/ai',
  196. redirect: '/ai/custom',
  197. },
  198. {
  199. path: '/ai/custom',
  200. name: '自定义生成器',
  201. component: './ai',
  202. },
  203. {
  204. path: '/ai/expand',
  205. name: '小说扩写',
  206. component: './ai',
  207. },
  208. {
  209. path: '/ai/mainPlot',
  210. name: '主线剧情设定',
  211. component: './ai',
  212. },
  213. {
  214. path: "/ai/branchPlot",
  215. name: '支线剧情分解',
  216. component: './ai',
  217. },
  218. {
  219. path: "/ai/outline",
  220. name: '小说大纲生成',
  221. component: './ai',
  222. },
  223. {
  224. path: "/ai/chapterOutline",
  225. name: '章节细纲生成',
  226. component: './ai',
  227. },
  228. {
  229. path: "/ai/reversePlot",
  230. name: '剧情反转设定',
  231. component: './ai',
  232. },
  233. {
  234. path: "/ai/plot",
  235. name: '剧情创作',
  236. component: './ai',
  237. },
  238. {
  239. path: "/ai/character",
  240. name: '人物创作',
  241. component: './ai',
  242. },
  243. ],
  244. }
  245. ];
  246. export default [
  247. {
  248. path: '/user',
  249. layout: false,
  250. routes: [
  251. {
  252. name: 'login',
  253. path: '/user/login',
  254. component: './User/Login',
  255. },
  256. ],
  257. },
  258. {
  259. //默认进入后打开哪个页面
  260. path: '/',
  261. redirect: '/book',
  262. },
  263. {
  264. path: '*',
  265. layout: false,
  266. component: './404',
  267. },
  268. ...newMenu,
  269. ];