routes.ts 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. export default [
  14. {
  15. path: '/user',
  16. layout: false,
  17. routes: [
  18. {
  19. name: 'login',
  20. path: '/user/login',
  21. component: './User/Login',
  22. },
  23. ],
  24. },
  25. {
  26. path: '/welcome',
  27. name: 'welcome',
  28. icon: 'smile',
  29. component: './Welcome',
  30. },
  31. {
  32. path: '/content',
  33. name: 'content',
  34. icon: 'table',
  35. routes: [
  36. {
  37. path: '/content',
  38. redirect: '/content/headlines',
  39. },
  40. {
  41. path: '/content/headlines',
  42. name: 'headlines',
  43. component: './Content/HeadLines',
  44. },
  45. ],
  46. },
  47. {
  48. path: '/peak',
  49. name: 'peak',
  50. icon: 'crown',
  51. routes: [
  52. {
  53. path: '/peak/peaks',
  54. name: 'peaks',
  55. component: './Peak/Peak',
  56. },
  57. {
  58. path: '/peak/peakLevel',
  59. name: 'peakLevel',
  60. component: './Peak/PeakLevel',
  61. },
  62. ],
  63. },
  64. {
  65. path: '/user',
  66. name: 'user',
  67. icon: 'crown',
  68. routes: [
  69. {
  70. path: '/user/users',
  71. name: 'users',
  72. component: './User/Users',
  73. },
  74. {
  75. path: '/user/userLevel',
  76. name: 'userLevel',
  77. component: './User/UserLevel',
  78. },
  79. {
  80. path: '/user/factionLevel',
  81. name: 'factionLevel',
  82. component: './User/FactionLevel',
  83. },
  84. ],
  85. },
  86. {
  87. path: '/settings/platform',
  88. name: 'settings.platform',
  89. icon: 'crown',
  90. routes: [
  91. {
  92. path: '/settings/platform/sign',
  93. name: 'sign',
  94. component: './Settings/Sign',
  95. },
  96. {
  97. path: '/settings/platform/vest',
  98. name: 'vest',
  99. component: './Settings/Vest',
  100. },
  101. {
  102. path: '/settings/platform/peak_weal',
  103. name: 'peakWeal',
  104. component: './Settings/PeakWeal',
  105. },
  106. {
  107. path: '/settings/platform/visit',
  108. name: 'visit',
  109. component: './Settings/Visit',
  110. },
  111. ],
  112. },
  113. {
  114. path: '/settings/chat',
  115. name: 'settings.chat',
  116. icon: 'crown',
  117. routes: [
  118. {
  119. path: '/settings/chat/redPacket',
  120. name: 'redPacket',
  121. component: './Settings/RedPacket',
  122. },
  123. {
  124. path: '/settings/chat/vest',
  125. name: 'vest',
  126. component: './Settings/Vest',
  127. },
  128. ],
  129. },
  130. {
  131. path: '/system',
  132. name: 'system',
  133. icon: 'crown',
  134. routes: [
  135. {
  136. path: '/system/staff',
  137. name: 'staff',
  138. component: './System/Staff',
  139. },
  140. {
  141. path: '/system/role',
  142. name: 'role',
  143. component: './System/Role',
  144. },
  145. {
  146. path: '/system/menu',
  147. name: 'menu',
  148. component: './System/Menu',
  149. },
  150. ],
  151. },
  152. {
  153. path: '/',
  154. redirect: '/welcome',
  155. },
  156. {
  157. path: '*',
  158. layout: false,
  159. component: './404',
  160. },
  161. ];