routes.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  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: "pagePermission",
  91. roles: ["admin"],
  92. },
  93. },
  94. {
  95. path: "directive",
  96. component: "views/permission/directive",
  97. name: "DirectivePermission",
  98. meta: {
  99. title: "directivePermission",
  100. },
  101. },
  102. {
  103. path: "role",
  104. component: "views/permission/role",
  105. name: "RolePermission",
  106. meta: {
  107. title: "rolePermission",
  108. roles: ["admin"],
  109. },
  110. },
  111. ],
  112. },
  113. {
  114. path: "/icon",
  115. component: "layout/Layout",
  116. children: [
  117. {
  118. path: "index",
  119. component: "views/categoryList/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: "jsonEditor" },
  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: "avatarUpload" },
  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: "countTo" },
  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: "backToTop" },
  194. },
  195. {
  196. path: "drag-dialog",
  197. component: "views/components-demo/drag-dialog",
  198. name: "DragDialogDemo",
  199. meta: { title: "dragDialog" },
  200. },
  201. {
  202. path: "drag-select",
  203. component: "views/components-demo/drag-select",
  204. name: "DragSelectDemo",
  205. meta: { title: "dragSelect" },
  206. },
  207. {
  208. path: "dnd-list",
  209. component: "views/components-demo/dnd-list",
  210. name: "DndListDemo",
  211. meta: { title: "dndList" },
  212. },
  213. {
  214. path: "drag-kanban",
  215. component: "views/components-demo/drag-kanban",
  216. name: "DragKanbanDemo",
  217. meta: { title: "dragKanban" },
  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: "keyboardChart", noCache: true },
  236. },
  237. {
  238. path: "line",
  239. component: "views/charts/line",
  240. name: "LineChart",
  241. meta: { title: "lineChart", noCache: true },
  242. },
  243. {
  244. path: "mixchart",
  245. component: "views/charts/mixChart",
  246. name: "MixChart",
  247. meta: { title: "mixChart", 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: "/conditionManagement",
  263. component: "layout/Layout",
  264. children: [
  265. {
  266. path: "index",
  267. component: "views/conditionManagement/index",
  268. name: "conditionManagement",
  269. meta: { title: "conditionManagement", icon: "order" },
  270. },
  271. ],
  272. },
  273. {
  274. path: "/order",
  275. component: "layout/Layout",
  276. children: [
  277. {
  278. path: "index",
  279. component: "views/order/index",
  280. name: "Order",
  281. meta: { title: "order", icon: "order" },
  282. },
  283. ],
  284. },
  285. {
  286. path: "menu1",
  287. name: "Menu",
  288. component: "views/userManagement/bossManagement/index",
  289. meta: { title: "bossManagement" },
  290. },
  291. {
  292. path: "menu2",
  293. name: "Menu2",
  294. component: "views/userManagement/serverManagement/index",
  295. meta: { title: "serverManagement" },
  296. },
  297. ],
  298. },
  299. {
  300. path: "/order",
  301. component: "layout/Layout",
  302. children: [
  303. {
  304. path: "index",
  305. component: "views/order/index",
  306. name: "Order",
  307. meta: { title: "order", icon: "order" },
  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: "createArticle", icon: "edit" },
  326. },
  327. {
  328. path: "edit/:id(\\d+)",
  329. component: "views/example/edit",
  330. name: "EditArticle",
  331. meta: { title: "editArticle", noCache: true },
  332. hidden: true,
  333. },
  334. {
  335. path: "list",
  336. component: "views/example/list",
  337. name: "ArticleList",
  338. meta: { title: "articleList", 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: "errorPages",
  361. icon: "404",
  362. },
  363. children: [
  364. {
  365. path: "401",
  366. component: "views/error-page/401",
  367. name: "Page401",
  368. meta: { title: "page401", noCache: true },
  369. },
  370. {
  371. path: "404",
  372. component: "views/error-page/404",
  373. name: "Page404",
  374. meta: { title: "page404", 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: "errorLog", 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: "exportExcel" },
  406. },
  407. {
  408. path: "export-selected-excel",
  409. component: "views/excel/select-excel",
  410. name: "SelectExcel",
  411. meta: { title: "selectExcel" },
  412. },
  413. {
  414. path: "export-merge-header",
  415. component: "views/excel/merge-header",
  416. name: "MergeHeader",
  417. meta: { title: "mergeHeader" },
  418. },
  419. {
  420. path: "upload-excel",
  421. component: "views/excel/upload-excel",
  422. name: "UploadExcel",
  423. meta: { title: "uploadExcel" },
  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: "exportZip" },
  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: "clipboardDemo", 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: "externalLink", icon: "link" },
  505. },
  506. ],
  507. },
  508. { path: "*", redirect: "/404", hidden: true },
  509. ];
  510. module.exports = {
  511. constantRoutes,
  512. asyncRoutes,
  513. };