routes.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. // Just a mock data
  2. const constantRoutes = [
  3. {
  4. path: '/redirect',
  5. component: 'layout/Layout',
  6. hidden: true,
  7. children: [
  8. {
  9. path: '/redirect/:path*',
  10. component: 'views/redirect/index'
  11. }
  12. ]
  13. },
  14. {
  15. path: '/login',
  16. component: 'views/login/index',
  17. hidden: true
  18. },
  19. {
  20. path: '/auth-redirect',
  21. component: 'views/login/auth-redirect',
  22. hidden: true
  23. },
  24. {
  25. path: '/404',
  26. component: 'views/error-page/404',
  27. hidden: true
  28. },
  29. {
  30. path: '/401',
  31. component: 'views/error-page/401',
  32. hidden: true
  33. },
  34. {
  35. path: '',
  36. component: 'layout/Layout',
  37. redirect: 'dashboard',
  38. children: [
  39. {
  40. path: 'dashboard',
  41. component: 'views/dashboard/index',
  42. name: 'Dashboard',
  43. meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
  44. }
  45. ]
  46. },
  47. {
  48. path: '/documentation',
  49. component: 'layout/Layout',
  50. children: [
  51. {
  52. path: 'index',
  53. component: 'views/documentation/index',
  54. name: 'Documentation',
  55. meta: { title: 'Documentation', icon: 'documentation', affix: true }
  56. }
  57. ]
  58. },
  59. {
  60. path: '/guide',
  61. component: 'layout/Layout',
  62. redirect: '/guide/index',
  63. children: [
  64. {
  65. path: 'index',
  66. component: 'views/guide/index',
  67. name: 'Guide',
  68. meta: { title: 'Guide', icon: 'guide', noCache: true }
  69. }
  70. ]
  71. }
  72. ]
  73. const asyncRoutes = [
  74. {
  75. path: '/permission',
  76. component: 'layout/Layout',
  77. redirect: '/permission/index',
  78. alwaysShow: true,
  79. meta: {
  80. title: 'Permission',
  81. icon: 'lock',
  82. roles: ['admin', 'editor']
  83. },
  84. children: [
  85. {
  86. path: 'page',
  87. component: 'views/permission/page',
  88. name: 'PagePermission',
  89. meta: {
  90. title: 'Page Permission',
  91. roles: ['admin']
  92. }
  93. },
  94. {
  95. path: 'directive',
  96. component: 'views/permission/directive',
  97. name: 'DirectivePermission',
  98. meta: {
  99. title: 'Directive Permission'
  100. }
  101. },
  102. {
  103. path: 'role',
  104. component: 'views/permission/role',
  105. name: 'RolePermission',
  106. meta: {
  107. title: 'Role Permission',
  108. roles: ['admin']
  109. }
  110. }
  111. ]
  112. },
  113. {
  114. path: '/icon',
  115. component: 'layout/Layout',
  116. children: [
  117. {
  118. path: 'index',
  119. component: 'views/icons/index',
  120. name: 'Icons',
  121. meta: { title: 'Icons', icon: 'icon', noCache: true }
  122. }
  123. ]
  124. },
  125. {
  126. path: '/components',
  127. component: 'layout/Layout',
  128. redirect: 'noRedirect',
  129. name: 'ComponentDemo',
  130. meta: {
  131. title: 'Components',
  132. icon: 'component'
  133. },
  134. children: [
  135. {
  136. path: 'tinymce',
  137. component: 'views/components-demo/tinymce',
  138. name: 'TinymceDemo',
  139. meta: { title: 'Tinymce' }
  140. },
  141. {
  142. path: 'markdown',
  143. component: 'views/components-demo/markdown',
  144. name: 'MarkdownDemo',
  145. meta: { title: 'Markdown' }
  146. },
  147. {
  148. path: 'json-editor',
  149. component: 'views/components-demo/json-editor',
  150. name: 'JsonEditorDemo',
  151. meta: { title: 'Json Editor' }
  152. },
  153. {
  154. path: 'split-pane',
  155. component: 'views/components-demo/split-pane',
  156. name: 'SplitpaneDemo',
  157. meta: { title: 'SplitPane' }
  158. },
  159. {
  160. path: 'avatar-upload',
  161. component: 'views/components-demo/avatar-upload',
  162. name: 'AvatarUploadDemo',
  163. meta: { title: 'Avatar Upload' }
  164. },
  165. {
  166. path: 'dropzone',
  167. component: 'views/components-demo/dropzone',
  168. name: 'DropzoneDemo',
  169. meta: { title: 'Dropzone' }
  170. },
  171. {
  172. path: 'sticky',
  173. component: 'views/components-demo/sticky',
  174. name: 'StickyDemo',
  175. meta: { title: 'Sticky' }
  176. },
  177. {
  178. path: 'count-to',
  179. component: 'views/components-demo/count-to',
  180. name: 'CountToDemo',
  181. meta: { title: 'Count To' }
  182. },
  183. {
  184. path: 'mixin',
  185. component: 'views/components-demo/mixin',
  186. name: 'ComponentMixinDemo',
  187. meta: { title: 'componentMixin' }
  188. },
  189. {
  190. path: 'back-to-top',
  191. component: 'views/components-demo/back-to-top',
  192. name: 'BackToTopDemo',
  193. meta: { title: 'Back To Top' }
  194. },
  195. {
  196. path: 'drag-dialog',
  197. component: 'views/components-demo/drag-dialog',
  198. name: 'DragDialogDemo',
  199. meta: { title: 'Drag Dialog' }
  200. },
  201. {
  202. path: 'drag-select',
  203. component: 'views/components-demo/drag-select',
  204. name: 'DragSelectDemo',
  205. meta: { title: 'Drag Select' }
  206. },
  207. {
  208. path: 'dnd-list',
  209. component: 'views/components-demo/dnd-list',
  210. name: 'DndListDemo',
  211. meta: { title: 'Dnd List' }
  212. },
  213. {
  214. path: 'drag-kanban',
  215. component: 'views/components-demo/drag-kanban',
  216. name: 'DragKanbanDemo',
  217. meta: { title: 'Drag Kanban' }
  218. }
  219. ]
  220. },
  221. {
  222. path: '/charts',
  223. component: 'layout/Layout',
  224. redirect: 'noRedirect',
  225. name: 'Charts',
  226. meta: {
  227. title: 'Charts',
  228. icon: 'chart'
  229. },
  230. children: [
  231. {
  232. path: 'keyboard',
  233. component: 'views/charts/keyboard',
  234. name: 'KeyboardChart',
  235. meta: { title: 'Keyboard Chart', noCache: true }
  236. },
  237. {
  238. path: 'line',
  239. component: 'views/charts/line',
  240. name: 'LineChart',
  241. meta: { title: 'Line Chart', noCache: true }
  242. },
  243. {
  244. path: 'mixchart',
  245. component: 'views/charts/mixChart',
  246. name: 'MixChart',
  247. meta: { title: 'Mix Chart', noCache: true }
  248. }
  249. ]
  250. },
  251. {
  252. path: '/nested',
  253. component: 'layout/Layout',
  254. redirect: '/nested/menu1/menu1-1',
  255. name: 'Nested',
  256. meta: {
  257. title: 'Nested',
  258. icon: 'nested'
  259. },
  260. children: [
  261. {
  262. path: 'menu1',
  263. component: 'views/nested/menu1/index',
  264. name: 'Menu1',
  265. meta: { title: 'Menu1' },
  266. redirect: '/nested/menu1/menu1-1',
  267. children: [
  268. {
  269. path: 'menu1-1',
  270. component: 'views/nested/menu1/menu1-1',
  271. name: 'Menu1-1',
  272. meta: { title: 'Menu1-1' }
  273. },
  274. {
  275. path: 'menu1-2',
  276. component: 'views/nested/menu1/menu1-2',
  277. name: 'Menu1-2',
  278. redirect: '/nested/menu1/menu1-2/menu1-2-1',
  279. meta: { title: 'Menu1-2' },
  280. children: [
  281. {
  282. path: 'menu1-2-1',
  283. component: 'views/nested/menu1/menu1-2/menu1-2-1',
  284. name: 'Menu1-2-1',
  285. meta: { title: 'Menu1-2-1' }
  286. },
  287. {
  288. path: 'menu1-2-2',
  289. component: 'views/nested/menu1/menu1-2/menu1-2-2',
  290. name: 'Menu1-2-2',
  291. meta: { title: 'Menu1-2-2' }
  292. }
  293. ]
  294. },
  295. {
  296. path: 'menu1-3',
  297. component: 'views/nested/menu1/menu1-3',
  298. name: 'Menu1-3',
  299. meta: { title: 'Menu1-3' }
  300. }
  301. ]
  302. },
  303. {
  304. path: 'menu2',
  305. name: 'Menu2',
  306. component: 'views/nested/menu2/index',
  307. meta: { title: 'Menu2' }
  308. }
  309. ]
  310. },
  311. {
  312. path: '/example',
  313. component: 'layout/Layout',
  314. redirect: '/example/list',
  315. name: 'Example',
  316. meta: {
  317. title: 'Example',
  318. icon: 'example'
  319. },
  320. children: [
  321. {
  322. path: 'create',
  323. component: 'views/example/create',
  324. name: 'CreateArticle',
  325. meta: { title: 'Create Article', icon: 'edit' }
  326. },
  327. {
  328. path: 'edit/:id(\\d+)',
  329. component: 'views/example/edit',
  330. name: 'EditArticle',
  331. meta: { title: 'Edit Article', noCache: true },
  332. hidden: true
  333. },
  334. {
  335. path: 'list',
  336. component: 'views/example/list',
  337. name: 'ArticleList',
  338. meta: { title: 'Article List', icon: 'list' }
  339. }
  340. ]
  341. },
  342. {
  343. path: '/tab',
  344. component: 'layout/Layout',
  345. children: [
  346. {
  347. path: 'index',
  348. component: 'views/tab/index',
  349. name: 'Tab',
  350. meta: { title: 'Tab', icon: 'tab' }
  351. }
  352. ]
  353. },
  354. {
  355. path: '/error',
  356. component: 'layout/Layout',
  357. redirect: 'noRedirect',
  358. name: 'ErrorPages',
  359. meta: {
  360. title: 'Error Pages',
  361. icon: '404'
  362. },
  363. children: [
  364. {
  365. path: '401',
  366. component: 'views/error-page/401',
  367. name: 'Page401',
  368. meta: { title: 'Page 401', noCache: true }
  369. },
  370. {
  371. path: '404',
  372. component: 'views/error-page/404',
  373. name: 'Page404',
  374. meta: { title: 'Page 404', noCache: true }
  375. }
  376. ]
  377. },
  378. {
  379. path: '/error-log',
  380. component: 'layout/Layout',
  381. redirect: 'noRedirect',
  382. children: [
  383. {
  384. path: 'log',
  385. component: 'views/error-log/index',
  386. name: 'ErrorLog',
  387. meta: { title: 'Error Log', icon: 'bug' }
  388. }
  389. ]
  390. },
  391. {
  392. path: '/excel',
  393. component: 'layout/Layout',
  394. redirect: '/excel/export-excel',
  395. name: 'Excel',
  396. meta: {
  397. title: 'Excel',
  398. icon: 'excel'
  399. },
  400. children: [
  401. {
  402. path: 'export-excel',
  403. component: 'views/excel/export-excel',
  404. name: 'ExportExcel',
  405. meta: { title: 'Export Excel' }
  406. },
  407. {
  408. path: 'export-selected-excel',
  409. component: 'views/excel/select-excel',
  410. name: 'SelectExcel',
  411. meta: { title: 'Select Excel' }
  412. },
  413. {
  414. path: 'export-merge-header',
  415. component: 'views/excel/merge-header',
  416. name: 'MergeHeader',
  417. meta: { title: 'Merge Header' }
  418. },
  419. {
  420. path: 'upload-excel',
  421. component: 'views/excel/upload-excel',
  422. name: 'UploadExcel',
  423. meta: { title: 'Upload Excel' }
  424. }
  425. ]
  426. },
  427. {
  428. path: '/zip',
  429. component: 'layout/Layout',
  430. redirect: '/zip/download',
  431. alwaysShow: true,
  432. meta: { title: 'Zip', icon: 'zip' },
  433. children: [
  434. {
  435. path: 'download',
  436. component: 'views/zip/index',
  437. name: 'ExportZip',
  438. meta: { title: 'Export Zip' }
  439. }
  440. ]
  441. },
  442. {
  443. path: '/pdf',
  444. component: 'layout/Layout',
  445. redirect: '/pdf/index',
  446. children: [
  447. {
  448. path: 'index',
  449. component: 'views/pdf/index',
  450. name: 'PDF',
  451. meta: { title: 'PDF', icon: 'pdf' }
  452. }
  453. ]
  454. },
  455. {
  456. path: '/pdf/download',
  457. component: 'views/pdf/download',
  458. hidden: true
  459. },
  460. {
  461. path: '/theme',
  462. component: 'layout/Layout',
  463. redirect: 'noRedirect',
  464. children: [
  465. {
  466. path: 'index',
  467. component: 'views/theme/index',
  468. name: 'Theme',
  469. meta: { title: 'Theme', icon: 'theme' }
  470. }
  471. ]
  472. },
  473. {
  474. path: '/clipboard',
  475. component: 'layout/Layout',
  476. redirect: 'noRedirect',
  477. children: [
  478. {
  479. path: 'index',
  480. component: 'views/clipboard/index',
  481. name: 'ClipboardDemo',
  482. meta: { title: 'Clipboard Demo', icon: 'clipboard' }
  483. }
  484. ]
  485. },
  486. {
  487. path: '/i18n',
  488. component: 'layout/Layout',
  489. children: [
  490. {
  491. path: 'index',
  492. component: 'views/i18n-demo/index',
  493. name: 'I18n',
  494. meta: { title: 'I18n', icon: 'international' }
  495. }
  496. ]
  497. },
  498. {
  499. path: 'external-link',
  500. component: 'layout/Layout',
  501. children: [
  502. {
  503. path: 'https://github.com/PanJiaChen/vue-element-admin',
  504. meta: { title: 'External Link', icon: 'link' }
  505. }
  506. ]
  507. },
  508. { path: '*', redirect: '/404', hidden: true }
  509. ]
  510. module.exports = {
  511. constantRoutes,
  512. asyncRoutes
  513. }