router.config.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. // eslint-disable-next-line
  2. import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
  3. import { bxAnaalyse } from '@/core/icons'
  4. const RouteView = {
  5. name: 'RouteView',
  6. render: (h) => h('router-view')
  7. }
  8. export const asyncRouterMap = [
  9. {
  10. path: '/',
  11. name: 'index',
  12. component: BasicLayout,
  13. meta: { title: 'menu.home' },
  14. redirect: '/dashboard/workplace',
  15. children: [
  16. // dashboard
  17. {
  18. path: '/dashboard',
  19. name: 'dashboard',
  20. redirect: '/dashboard/workplace',
  21. component: RouteView,
  22. meta: { title: 'menu.dashboard', keepAlive: true, icon: bxAnaalyse, permission: [ 'dashboard' ] },
  23. children: [
  24. {
  25. path: '/dashboard/analysis/:pageNo([1-9]\\d*)?',
  26. name: 'Analysis',
  27. component: () => import('@/views/dashboard/Analysis'),
  28. meta: { title: 'menu.dashboard.analysis', keepAlive: false, permission: [ 'dashboard' ] }
  29. },
  30. // 外部链接
  31. {
  32. path: 'https://www.baidu.com/',
  33. name: 'Monitor',
  34. meta: { title: 'menu.dashboard.monitor', target: '_blank' }
  35. },
  36. {
  37. path: '/dashboard/workplace',
  38. name: 'Workplace',
  39. component: () => import('@/views/dashboard/Workplace'),
  40. meta: { title: 'menu.dashboard.workplace', keepAlive: true, permission: [ 'dashboard' ] }
  41. }
  42. ]
  43. },
  44. // forms
  45. {
  46. path: '/form',
  47. redirect: '/form/base-form',
  48. component: RouteView,
  49. meta: { title: '表单页', icon: 'form', permission: [ 'form' ] },
  50. children: [
  51. {
  52. path: '/form/base-form',
  53. name: 'BaseForm',
  54. component: () => import('@/views/form/basicForm'),
  55. meta: { title: '基础表单', keepAlive: true, permission: [ 'form' ] }
  56. },
  57. {
  58. path: '/form/step-form',
  59. name: 'StepForm',
  60. component: () => import('@/views/form/stepForm/StepForm'),
  61. meta: { title: '分步表单', keepAlive: true, permission: [ 'form' ] }
  62. },
  63. {
  64. path: '/form/advanced-form',
  65. name: 'AdvanceForm',
  66. component: () => import('@/views/form/advancedForm/AdvancedForm'),
  67. meta: { title: '高级表单', keepAlive: true, permission: [ 'form' ] }
  68. }
  69. ]
  70. },
  71. // list
  72. {
  73. path: '/list',
  74. name: 'list',
  75. component: RouteView,
  76. redirect: '/list/table-list',
  77. meta: { title: '列表页', icon: 'table', permission: [ 'table' ] },
  78. children: [
  79. {
  80. path: '/list/table-list/:pageNo([1-9]\\d*)?',
  81. name: 'TableListWrapper',
  82. hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
  83. component: () => import('@/views/list/TableList'),
  84. meta: { title: '查询表格', keepAlive: true, permission: [ 'table' ] }
  85. },
  86. {
  87. path: '/list/basic-list',
  88. name: 'BasicList',
  89. component: () => import('@/views/list/BasicList'),
  90. meta: { title: '标准列表', keepAlive: true, permission: [ 'table' ] }
  91. },
  92. {
  93. path: '/list/card',
  94. name: 'CardList',
  95. component: () => import('@/views/list/CardList'),
  96. meta: { title: '卡片列表', keepAlive: true, permission: [ 'table' ] }
  97. },
  98. {
  99. path: '/list/search',
  100. name: 'SearchList',
  101. component: () => import('@/views/list/search/SearchLayout'),
  102. redirect: '/list/search/article',
  103. meta: { title: '搜索列表', keepAlive: true, permission: [ 'table' ] },
  104. children: [
  105. {
  106. path: '/list/search/article',
  107. name: 'SearchArticles',
  108. component: () => import('../views/list/search/Article'),
  109. meta: { title: '搜索列表(文章)', permission: [ 'table' ] }
  110. },
  111. {
  112. path: '/list/search/project',
  113. name: 'SearchProjects',
  114. component: () => import('../views/list/search/Projects'),
  115. meta: { title: '搜索列表(项目)', permission: [ 'table' ] }
  116. },
  117. {
  118. path: '/list/search/application',
  119. name: 'SearchApplications',
  120. component: () => import('../views/list/search/Applications'),
  121. meta: { title: '搜索列表(应用)', permission: [ 'table' ] }
  122. }
  123. ]
  124. }
  125. ]
  126. },
  127. // profile
  128. {
  129. path: '/profile',
  130. name: 'profile',
  131. component: RouteView,
  132. redirect: '/profile/basic',
  133. meta: { title: '详情页', icon: 'profile', permission: [ 'profile' ] },
  134. children: [
  135. {
  136. path: '/profile/basic',
  137. name: 'ProfileBasic',
  138. component: () => import('@/views/profile/basic'),
  139. meta: { title: '基础详情页', permission: [ 'profile' ] }
  140. },
  141. {
  142. path: '/profile/advanced',
  143. name: 'ProfileAdvanced',
  144. component: () => import('@/views/profile/advanced/Advanced'),
  145. meta: { title: '高级详情页', permission: [ 'profile' ] }
  146. }
  147. ]
  148. },
  149. // result
  150. {
  151. path: '/result',
  152. name: 'result',
  153. component: RouteView,
  154. redirect: '/result/success',
  155. meta: { title: '结果页', icon: 'check-circle-o', permission: [ 'result' ] },
  156. children: [
  157. {
  158. path: '/result/success',
  159. name: 'ResultSuccess',
  160. component: () => import(/* webpackChunkName: "result" */ '@/views/result/Success'),
  161. meta: { title: '成功', keepAlive: false, hiddenHeaderContent: true, permission: [ 'result' ] }
  162. },
  163. {
  164. path: '/result/fail',
  165. name: 'ResultFail',
  166. component: () => import(/* webpackChunkName: "result" */ '@/views/result/Error'),
  167. meta: { title: '失败', keepAlive: false, hiddenHeaderContent: true, permission: [ 'result' ] }
  168. }
  169. ]
  170. },
  171. // Exception
  172. {
  173. path: '/exception',
  174. name: 'exception',
  175. component: RouteView,
  176. redirect: '/exception/403',
  177. meta: { title: '异常页', icon: 'warning', permission: [ 'exception' ] },
  178. children: [
  179. {
  180. path: '/exception/403',
  181. name: 'Exception403',
  182. component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'),
  183. meta: { title: '403', permission: [ 'exception' ] }
  184. },
  185. {
  186. path: '/exception/404',
  187. name: 'Exception404',
  188. component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
  189. meta: { title: '404', permission: [ 'exception' ] }
  190. },
  191. {
  192. path: '/exception/500',
  193. name: 'Exception500',
  194. component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'),
  195. meta: { title: '500', permission: [ 'exception' ] }
  196. }
  197. ]
  198. },
  199. // account
  200. {
  201. path: '/account',
  202. component: RouteView,
  203. redirect: '/account/center',
  204. name: 'account',
  205. meta: { title: '个人页', icon: 'user', keepAlive: true, permission: [ 'user' ] },
  206. children: [
  207. {
  208. path: '/account/center',
  209. name: 'center',
  210. component: () => import('@/views/account/center'),
  211. meta: { title: '个人中心', keepAlive: true, permission: [ 'user' ] }
  212. },
  213. {
  214. path: '/account/settings',
  215. name: 'settings',
  216. component: () => import('@/views/account/settings/Index'),
  217. meta: { title: '个人设置', hideHeader: true, permission: [ 'user' ] },
  218. redirect: '/account/settings/base',
  219. hideChildrenInMenu: true,
  220. children: [
  221. {
  222. path: '/account/settings/base',
  223. name: 'BaseSettings',
  224. component: () => import('@/views/account/settings/BaseSetting'),
  225. meta: { title: '基本设置', hidden: true, permission: [ 'user' ] }
  226. },
  227. {
  228. path: '/account/settings/security',
  229. name: 'SecuritySettings',
  230. component: () => import('@/views/account/settings/Security'),
  231. meta: { title: '安全设置', hidden: true, keepAlive: true, permission: [ 'user' ] }
  232. },
  233. {
  234. path: '/account/settings/custom',
  235. name: 'CustomSettings',
  236. component: () => import('@/views/account/settings/Custom'),
  237. meta: { title: '个性化设置', hidden: true, keepAlive: true, permission: [ 'user' ] }
  238. },
  239. {
  240. path: '/account/settings/binding',
  241. name: 'BindingSettings',
  242. component: () => import('@/views/account/settings/Binding'),
  243. meta: { title: '账户绑定', hidden: true, keepAlive: true, permission: [ 'user' ] }
  244. },
  245. {
  246. path: '/account/settings/notification',
  247. name: 'NotificationSettings',
  248. component: () => import('@/views/account/settings/Notification'),
  249. meta: { title: '新消息通知', hidden: true, keepAlive: true, permission: [ 'user' ] }
  250. }
  251. ]
  252. }
  253. ]
  254. }
  255. // other
  256. /*
  257. {
  258. path: '/other',
  259. name: 'otherPage',
  260. component: PageView,
  261. meta: { title: '其他组件', icon: 'slack', permission: [ 'dashboard' ] },
  262. redirect: '/other/icon-selector',
  263. children: [
  264. {
  265. path: '/other/icon-selector',
  266. name: 'TestIconSelect',
  267. component: () => import('@/views/other/IconSelectorView'),
  268. meta: { title: 'IconSelector', icon: 'tool', keepAlive: true, permission: [ 'dashboard' ] }
  269. },
  270. {
  271. path: '/other/list',
  272. component: RouteView,
  273. meta: { title: '业务布局', icon: 'layout', permission: [ 'support' ] },
  274. redirect: '/other/list/tree-list',
  275. children: [
  276. {
  277. path: '/other/list/tree-list',
  278. name: 'TreeList',
  279. component: () => import('@/views/other/TreeList'),
  280. meta: { title: '树目录表格', keepAlive: true }
  281. },
  282. {
  283. path: '/other/list/edit-table',
  284. name: 'EditList',
  285. component: () => import('@/views/other/TableInnerEditList'),
  286. meta: { title: '内联编辑表格', keepAlive: true }
  287. },
  288. {
  289. path: '/other/list/user-list',
  290. name: 'UserList',
  291. component: () => import('@/views/other/UserList'),
  292. meta: { title: '用户列表', keepAlive: true }
  293. },
  294. {
  295. path: '/other/list/role-list',
  296. name: 'RoleList',
  297. component: () => import('@/views/other/RoleList'),
  298. meta: { title: '角色列表', keepAlive: true }
  299. },
  300. {
  301. path: '/other/list/system-role',
  302. name: 'SystemRole',
  303. component: () => import('@/views/role/RoleList'),
  304. meta: { title: '角色列表2', keepAlive: true }
  305. },
  306. {
  307. path: '/other/list/permission-list',
  308. name: 'PermissionList',
  309. component: () => import('@/views/other/PermissionList'),
  310. meta: { title: '权限列表', keepAlive: true }
  311. }
  312. ]
  313. }
  314. ]
  315. }
  316. */
  317. ]
  318. },
  319. {
  320. path: '*', redirect: '/404', hidden: true
  321. }
  322. ]
  323. /**
  324. * 基础路由
  325. * @type { *[] }
  326. */
  327. export const constantRouterMap = [
  328. {
  329. path: '/user',
  330. component: UserLayout,
  331. redirect: '/user/login',
  332. hidden: true,
  333. children: [
  334. {
  335. path: 'login',
  336. name: 'login',
  337. component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
  338. },
  339. {
  340. path: 'register',
  341. name: 'register',
  342. component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
  343. },
  344. {
  345. path: 'register-result',
  346. name: 'registerResult',
  347. component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
  348. },
  349. {
  350. path: 'recover',
  351. name: 'recover',
  352. component: undefined
  353. }
  354. ]
  355. },
  356. {
  357. path: '/404',
  358. component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  359. }
  360. ]