Jiarenxiang | 38dcb05 | 2025-03-13 16:40:09 +0800 | [diff] [blame] | 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: '/', |
| 16 | redirect: '/account/center', |
| 17 | }, |
| 18 | { |
| 19 | path: '*', |
| 20 | layout: false, |
| 21 | component: './404', |
| 22 | }, |
| 23 | { |
| 24 | path: '/user', |
| 25 | layout: false, |
| 26 | routes: [ |
| 27 | { |
| 28 | name: 'login', |
| 29 | path: '/user/login', |
| 30 | component: './User/Login', |
| 31 | }, |
| 32 | ], |
| 33 | }, |
| 34 | { |
| 35 | path: '/account', |
| 36 | routes: [ |
| 37 | { |
| 38 | name: 'acenter', |
| 39 | path: '/account/center', |
| 40 | component: './User/Center', |
| 41 | }, |
| 42 | { |
| 43 | name: 'asettings', |
| 44 | path: '/account/settings', |
| 45 | component: './User/Settings', |
| 46 | }, |
| 47 | ], |
| 48 | }, |
| 49 | { |
| 50 | name: 'system', |
| 51 | path: '/system', |
| 52 | routes: [ |
| 53 | { |
| 54 | name: '字典数据', |
| 55 | path: '/system/dict-data/index/:id', |
| 56 | component: './System/DictData', |
| 57 | }, |
| 58 | { |
| 59 | name: '分配用户', |
| 60 | path: '/system/role-auth/user/:id', |
| 61 | component: './System/Role/authUser', |
| 62 | }, |
| 63 | ] |
| 64 | }, |
| 65 | { |
| 66 | name: 'monitor', |
| 67 | path: '/monitor', |
| 68 | routes: [ |
| 69 | { |
| 70 | name: '任务日志', |
| 71 | path: '/monitor/job-log/index/:id', |
| 72 | component: './Monitor/JobLog', |
| 73 | }, |
| 74 | ] |
| 75 | }, |
| 76 | { |
| 77 | name: 'tool', |
| 78 | path: '/tool', |
| 79 | routes: [ |
| 80 | { |
| 81 | name: '导入表', |
| 82 | path: '/tool/gen/import', |
| 83 | component: './Tool/Gen/import', |
| 84 | }, |
| 85 | { |
| 86 | name: '编辑表', |
| 87 | path: '/tool/gen/edit', |
| 88 | component: './Tool/Gen/edit', |
| 89 | }, |
| 90 | ] |
| 91 | }, |
meisiyu | 1d4aade | 2025-06-02 20:10:36 +0800 | [diff] [blame] | 92 | { |
崔向南 | 464e19d | 2025-06-05 17:46:27 +0800 | [diff] [blame] | 93 | path: '/bounty', |
| 94 | name: '悬赏管理', |
| 95 | icon: 'read', |
| 96 | routes: [ |
| 97 | { |
| 98 | path: '/bounty/list', |
| 99 | component: '@/pages/Bounty/List', |
| 100 | }, |
| 101 | { |
| 102 | path: '/bounty/detail/:id', |
| 103 | component: '@/pages/Bounty/Detail', |
| 104 | }, |
| 105 | { |
| 106 | name: 'bountyPublish', // 发布悬赏页面名称 |
| 107 | path: '/bounty/publish', // 访问路径 |
| 108 | component: './Bounty/BountyPublish' // 对应页面文件路径(相对于 src/pages) |
| 109 | }, |
| 110 | { |
| 111 | name: 'bountyReply', // 回复悬赏页面名称 |
| 112 | path: '/bounty/reply', // 访问路径 |
| 113 | component: './Bounty/BountyReply' // 对应页面文件路径 |
| 114 | } |
| 115 | |
| 116 | ], |
| 117 | }, |
| 118 | |
| 119 | |
| 120 | { |
meisiyu | 1d4aade | 2025-06-02 20:10:36 +0800 | [diff] [blame] | 121 | name: '帖子中心', |
| 122 | icon: 'read', |
| 123 | path: '/post/center', |
| 124 | component: './PostCenter/index.tsx', |
| 125 | }, |
| 126 | { |
| 127 | name: '帖子详情', |
| 128 | path: '/post-detail/:id', |
| 129 | component: './PostCenter/PostDetail.tsx', |
| 130 | hideInMenu: true, |
| 131 | }, |
| 132 | { |
| 133 | name: '个人中心', |
| 134 | path: '/user-center', |
| 135 | component: './UserCenter/index.tsx', |
| 136 | hideInMenu: true, |
| 137 | }, |
| 138 | { |
| 139 | name: '帖子审核', |
| 140 | path: '/post-review', |
| 141 | component: './PostReview/index.tsx', |
| 142 | hideInMenu: true, |
| 143 | } |
Jiarenxiang | 38dcb05 | 2025-03-13 16:40:09 +0800 | [diff] [blame] | 144 | ]; |