routes.tsx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. {
  16. path: '/distributor',
  17. redirect: '/distributor/wxMiniApp',
  18. },
  19. {
  20. name: 'distributor.account',
  21. icon: 'icon-zhanghaoguanli',
  22. path: '/distributor/account',
  23. access: "isShow",
  24. component: './Distributor/Account',
  25. },
  26. {
  27. name: 'distributor.wxMiniApp',
  28. icon: 'icon-weixin',
  29. path: '/distributor/wxMiniApp',
  30. access: "isShow",
  31. component: './Distributor/WxMiniApp',
  32. },
  33. {
  34. name: 'distributor.dyMiniApp',
  35. icon: 'icon-douyinzhanghao',
  36. path: '/distributor/dyMiniApp',
  37. access: "isShow",
  38. component: './Distributor/DyMiniApp',
  39. },
  40. // 小程序页面
  41. {
  42. path: '/miniApp',
  43. redirect: '/miniApp/book',
  44. },
  45. // 小说管理
  46. {
  47. path: '/miniApp/book',
  48. name: 'miniApp.book',
  49. icon: 'icon-xiaoshuo-wx',
  50. access: 'isShow',
  51. component: './MiniApp/BookManage',
  52. },
  53. // 小程序端管理
  54. {
  55. name: 'miniApp.appManage',
  56. icon: 'icon-xiaochengxu-wx',
  57. path: '/miniApp/moduleConfig',
  58. access: "isShow",
  59. component: './Admin',
  60. },
  61. // 书币充值模板
  62. {
  63. name: 'miniApp.payModuleConfig',
  64. icon: 'icon-taojinbi-wx',
  65. path: '/miniApp/payModuleConfig',
  66. access: "isShow",
  67. component: './MiniApp/ModuleConfig',
  68. },
  69. {
  70. name:"miniApp.dataManage",
  71. icon: 'icon-shuju-wx',
  72. path: '/miniApp/dataManage',
  73. access: "isShow",
  74. routes: [
  75. {
  76. path: '/miniApp/dataManage',
  77. redirect: '/miniApp/dataManage/payLog',
  78. },
  79. {
  80. path: '/miniApp/dataManage/payLog',
  81. name: "payLog",
  82. component: './MiniApp/PayLog',
  83. },
  84. {
  85. path: '/miniApp/dataManage/readLog',
  86. name: "readLog",
  87. component: './MiniApp/ReadLog',
  88. },
  89. {
  90. name: 'consume',
  91. path: '/miniApp/dataManage/consume',
  92. component: './MiniApp/Consume',
  93. }
  94. ],
  95. }
  96. ]
  97. export default [
  98. {
  99. path: '/user',
  100. layout: false,
  101. routes: [
  102. {
  103. name: 'login',
  104. path: '/user/login',
  105. component: './User/Login',
  106. },
  107. ],
  108. },
  109. {
  110. path: '/',
  111. redirect: '/distributor/wxMiniApp',
  112. },
  113. {
  114. path: '*',
  115. layout: false,
  116. component: './404',
  117. },
  118. ...newMenu
  119. ];