zetan-cli-dev-template-vue-element-admin 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (303) hide show
  1. package/package.json +8 -0
  2. package/template/.editorconfig +14 -0
  3. package/template/.env.development +5 -0
  4. package/template/.env.production +6 -0
  5. package/template/.env.staging +8 -0
  6. package/template/.eslintignore +4 -0
  7. package/template/.eslintrc.js +198 -0
  8. package/template/.travis.yml +5 -0
  9. package/template/LICENSE +21 -0
  10. package/template/README.es.md +228 -0
  11. package/template/README.ja.md +224 -0
  12. package/template/README.md +250 -0
  13. package/template/README.zh-CN.md +273 -0
  14. package/template/babel.config.js +14 -0
  15. package/template/build/index.js +35 -0
  16. package/template/jest.config.js +24 -0
  17. package/template/jsconfig.json +9 -0
  18. package/template/mock/article.js +116 -0
  19. package/template/mock/index.js +60 -0
  20. package/template/mock/mock-server.js +81 -0
  21. package/template/mock/remote-search.js +51 -0
  22. package/template/mock/role/index.js +98 -0
  23. package/template/mock/role/routes.js +530 -0
  24. package/template/mock/user.js +84 -0
  25. package/template/mock/utils.js +48 -0
  26. package/template/package.json +111 -0
  27. package/template/plop-templates/component/index.hbs +26 -0
  28. package/template/plop-templates/component/prompt.js +55 -0
  29. package/template/plop-templates/store/index.hbs +16 -0
  30. package/template/plop-templates/store/prompt.js +62 -0
  31. package/template/plop-templates/utils.js +2 -0
  32. package/template/plop-templates/view/index.hbs +26 -0
  33. package/template/plop-templates/view/prompt.js +55 -0
  34. package/template/plopfile.js +9 -0
  35. package/template/postcss.config.js +5 -0
  36. package/template/public/favicon.ico +0 -0
  37. package/template/public/index.html +15 -0
  38. package/template/src/App.vue +11 -0
  39. package/template/src/api/article.js +41 -0
  40. package/template/src/api/qiniu.js +8 -0
  41. package/template/src/api/remote-search.js +17 -0
  42. package/template/src/api/role.js +38 -0
  43. package/template/src/api/user.js +24 -0
  44. package/template/src/assets/401_images/401.gif +0 -0
  45. package/template/src/assets/404_images/404.png +0 -0
  46. package/template/src/assets/404_images/404_cloud.png +0 -0
  47. package/template/src/assets/custom-theme/fonts/element-icons.ttf +0 -0
  48. package/template/src/assets/custom-theme/fonts/element-icons.woff +0 -0
  49. package/template/src/assets/custom-theme/index.css +1 -0
  50. package/template/src/components/BackToTop/index.vue +111 -0
  51. package/template/src/components/Breadcrumb/index.vue +82 -0
  52. package/template/src/components/Charts/Keyboard.vue +155 -0
  53. package/template/src/components/Charts/LineMarker.vue +227 -0
  54. package/template/src/components/Charts/MixChart.vue +271 -0
  55. package/template/src/components/Charts/mixins/resize.js +56 -0
  56. package/template/src/components/DndList/index.vue +166 -0
  57. package/template/src/components/DragSelect/index.vue +65 -0
  58. package/template/src/components/Dropzone/index.vue +297 -0
  59. package/template/src/components/ErrorLog/index.vue +78 -0
  60. package/template/src/components/GithubCorner/index.vue +54 -0
  61. package/template/src/components/Hamburger/index.vue +44 -0
  62. package/template/src/components/HeaderSearch/index.vue +180 -0
  63. package/template/src/components/ImageCropper/index.vue +1779 -0
  64. package/template/src/components/ImageCropper/utils/data2blob.js +19 -0
  65. package/template/src/components/ImageCropper/utils/effectRipple.js +39 -0
  66. package/template/src/components/ImageCropper/utils/language.js +232 -0
  67. package/template/src/components/ImageCropper/utils/mimes.js +7 -0
  68. package/template/src/components/JsonEditor/index.vue +77 -0
  69. package/template/src/components/Kanban/index.vue +99 -0
  70. package/template/src/components/MDinput/index.vue +360 -0
  71. package/template/src/components/MarkdownEditor/default-options.js +31 -0
  72. package/template/src/components/MarkdownEditor/index.vue +118 -0
  73. package/template/src/components/Pagination/index.vue +101 -0
  74. package/template/src/components/PanThumb/index.vue +142 -0
  75. package/template/src/components/RightPanel/index.vue +145 -0
  76. package/template/src/components/Screenfull/index.vue +60 -0
  77. package/template/src/components/Share/DropdownMenu.vue +103 -0
  78. package/template/src/components/SizeSelect/index.vue +57 -0
  79. package/template/src/components/Sticky/index.vue +91 -0
  80. package/template/src/components/SvgIcon/index.vue +62 -0
  81. package/template/src/components/TextHoverEffect/Mallki.vue +113 -0
  82. package/template/src/components/ThemePicker/index.vue +175 -0
  83. package/template/src/components/Tinymce/components/EditorImage.vue +111 -0
  84. package/template/src/components/Tinymce/dynamicLoadScript.js +59 -0
  85. package/template/src/components/Tinymce/index.vue +247 -0
  86. package/template/src/components/Tinymce/plugins.js +7 -0
  87. package/template/src/components/Tinymce/toolbar.js +6 -0
  88. package/template/src/components/Upload/SingleImage.vue +134 -0
  89. package/template/src/components/Upload/SingleImage2.vue +130 -0
  90. package/template/src/components/Upload/SingleImage3.vue +157 -0
  91. package/template/src/components/UploadExcel/index.vue +138 -0
  92. package/template/src/directive/clipboard/clipboard.js +49 -0
  93. package/template/src/directive/clipboard/index.js +13 -0
  94. package/template/src/directive/el-drag-dialog/drag.js +77 -0
  95. package/template/src/directive/el-drag-dialog/index.js +13 -0
  96. package/template/src/directive/el-table/adaptive.js +41 -0
  97. package/template/src/directive/el-table/index.js +13 -0
  98. package/template/src/directive/permission/index.js +13 -0
  99. package/template/src/directive/permission/permission.js +31 -0
  100. package/template/src/directive/sticky.js +91 -0
  101. package/template/src/directive/waves/index.js +13 -0
  102. package/template/src/directive/waves/waves.css +26 -0
  103. package/template/src/directive/waves/waves.js +72 -0
  104. package/template/src/filters/index.js +68 -0
  105. package/template/src/icons/index.js +9 -0
  106. package/template/src/icons/svg/404.svg +1 -0
  107. package/template/src/icons/svg/bug.svg +1 -0
  108. package/template/src/icons/svg/chart.svg +1 -0
  109. package/template/src/icons/svg/clipboard.svg +1 -0
  110. package/template/src/icons/svg/component.svg +1 -0
  111. package/template/src/icons/svg/dashboard.svg +1 -0
  112. package/template/src/icons/svg/documentation.svg +1 -0
  113. package/template/src/icons/svg/drag.svg +1 -0
  114. package/template/src/icons/svg/edit.svg +1 -0
  115. package/template/src/icons/svg/education.svg +1 -0
  116. package/template/src/icons/svg/email.svg +1 -0
  117. package/template/src/icons/svg/example.svg +1 -0
  118. package/template/src/icons/svg/excel.svg +1 -0
  119. package/template/src/icons/svg/exit-fullscreen.svg +1 -0
  120. package/template/src/icons/svg/eye-open.svg +1 -0
  121. package/template/src/icons/svg/eye.svg +1 -0
  122. package/template/src/icons/svg/form.svg +1 -0
  123. package/template/src/icons/svg/fullscreen.svg +1 -0
  124. package/template/src/icons/svg/guide.svg +1 -0
  125. package/template/src/icons/svg/icon.svg +1 -0
  126. package/template/src/icons/svg/international.svg +1 -0
  127. package/template/src/icons/svg/language.svg +1 -0
  128. package/template/src/icons/svg/link.svg +1 -0
  129. package/template/src/icons/svg/list.svg +1 -0
  130. package/template/src/icons/svg/lock.svg +1 -0
  131. package/template/src/icons/svg/message.svg +1 -0
  132. package/template/src/icons/svg/money.svg +1 -0
  133. package/template/src/icons/svg/nested.svg +1 -0
  134. package/template/src/icons/svg/password.svg +1 -0
  135. package/template/src/icons/svg/pdf.svg +1 -0
  136. package/template/src/icons/svg/people.svg +1 -0
  137. package/template/src/icons/svg/peoples.svg +1 -0
  138. package/template/src/icons/svg/qq.svg +1 -0
  139. package/template/src/icons/svg/search.svg +1 -0
  140. package/template/src/icons/svg/shopping.svg +1 -0
  141. package/template/src/icons/svg/size.svg +1 -0
  142. package/template/src/icons/svg/skill.svg +1 -0
  143. package/template/src/icons/svg/star.svg +1 -0
  144. package/template/src/icons/svg/tab.svg +1 -0
  145. package/template/src/icons/svg/table.svg +1 -0
  146. package/template/src/icons/svg/theme.svg +1 -0
  147. package/template/src/icons/svg/tree-table.svg +1 -0
  148. package/template/src/icons/svg/tree.svg +1 -0
  149. package/template/src/icons/svg/user.svg +1 -0
  150. package/template/src/icons/svg/wechat.svg +1 -0
  151. package/template/src/icons/svg/zip.svg +1 -0
  152. package/template/src/icons/svgo.yml +22 -0
  153. package/template/src/layout/components/AppMain.vue +57 -0
  154. package/template/src/layout/components/Navbar.vue +167 -0
  155. package/template/src/layout/components/Settings/index.vue +108 -0
  156. package/template/src/layout/components/Sidebar/FixiOSBug.js +26 -0
  157. package/template/src/layout/components/Sidebar/Item.vue +41 -0
  158. package/template/src/layout/components/Sidebar/Link.vue +43 -0
  159. package/template/src/layout/components/Sidebar/Logo.vue +82 -0
  160. package/template/src/layout/components/Sidebar/SidebarItem.vue +95 -0
  161. package/template/src/layout/components/Sidebar/index.vue +54 -0
  162. package/template/src/layout/components/TagsView/ScrollPane.vue +94 -0
  163. package/template/src/layout/components/TagsView/index.vue +292 -0
  164. package/template/src/layout/components/index.js +5 -0
  165. package/template/src/layout/index.vue +102 -0
  166. package/template/src/layout/mixin/ResizeHandler.js +45 -0
  167. package/template/src/main.js +53 -0
  168. package/template/src/permission.js +74 -0
  169. package/template/src/router/index.js +404 -0
  170. package/template/src/router/modules/charts.js +36 -0
  171. package/template/src/router/modules/components.js +102 -0
  172. package/template/src/router/modules/nested.js +66 -0
  173. package/template/src/router/modules/table.js +41 -0
  174. package/template/src/settings.js +35 -0
  175. package/template/src/store/getters.js +15 -0
  176. package/template/src/store/index.js +25 -0
  177. package/template/src/store/modules/app.js +56 -0
  178. package/template/src/store/modules/errorLog.js +28 -0
  179. package/template/src/store/modules/permission.js +69 -0
  180. package/template/src/store/modules/settings.js +35 -0
  181. package/template/src/store/modules/tagsView.js +160 -0
  182. package/template/src/store/modules/user.js +131 -0
  183. package/template/src/styles/btn.scss +99 -0
  184. package/template/src/styles/element-ui.scss +84 -0
  185. package/template/src/styles/element-variables.scss +31 -0
  186. package/template/src/styles/index.scss +191 -0
  187. package/template/src/styles/mixin.scss +66 -0
  188. package/template/src/styles/sidebar.scss +226 -0
  189. package/template/src/styles/transition.scss +48 -0
  190. package/template/src/styles/variables.scss +35 -0
  191. package/template/src/utils/auth.js +15 -0
  192. package/template/src/utils/clipboard.js +32 -0
  193. package/template/src/utils/error-log.js +35 -0
  194. package/template/src/utils/get-page-title.js +10 -0
  195. package/template/src/utils/index.js +357 -0
  196. package/template/src/utils/open-window.js +25 -0
  197. package/template/src/utils/permission.js +21 -0
  198. package/template/src/utils/request.js +85 -0
  199. package/template/src/utils/scroll-to.js +58 -0
  200. package/template/src/utils/validate.js +87 -0
  201. package/template/src/vendor/Export2Excel.js +220 -0
  202. package/template/src/vendor/Export2Zip.js +24 -0
  203. package/template/src/views/charts/keyboard.vue +23 -0
  204. package/template/src/views/charts/line.vue +23 -0
  205. package/template/src/views/charts/mix-chart.vue +23 -0
  206. package/template/src/views/clipboard/index.vue +49 -0
  207. package/template/src/views/components-demo/avatar-upload.vue +61 -0
  208. package/template/src/views/components-demo/back-to-top.vue +154 -0
  209. package/template/src/views/components-demo/count-to.vue +218 -0
  210. package/template/src/views/components-demo/dnd-list.vue +39 -0
  211. package/template/src/views/components-demo/drag-dialog.vue +61 -0
  212. package/template/src/views/components-demo/drag-kanban.vue +66 -0
  213. package/template/src/views/components-demo/drag-select.vue +43 -0
  214. package/template/src/views/components-demo/dropzone.vue +31 -0
  215. package/template/src/views/components-demo/json-editor.vue +36 -0
  216. package/template/src/views/components-demo/markdown.vue +101 -0
  217. package/template/src/views/components-demo/mixin.vue +169 -0
  218. package/template/src/views/components-demo/split-pane.vue +67 -0
  219. package/template/src/views/components-demo/sticky.vue +135 -0
  220. package/template/src/views/components-demo/tinymce.vue +36 -0
  221. package/template/src/views/dashboard/admin/components/BarChart.vue +102 -0
  222. package/template/src/views/dashboard/admin/components/BoxCard.vue +118 -0
  223. package/template/src/views/dashboard/admin/components/LineChart.vue +135 -0
  224. package/template/src/views/dashboard/admin/components/PanelGroup.vue +181 -0
  225. package/template/src/views/dashboard/admin/components/PieChart.vue +79 -0
  226. package/template/src/views/dashboard/admin/components/RaddarChart.vue +116 -0
  227. package/template/src/views/dashboard/admin/components/TodoList/Todo.vue +81 -0
  228. package/template/src/views/dashboard/admin/components/TodoList/index.scss +320 -0
  229. package/template/src/views/dashboard/admin/components/TodoList/index.vue +127 -0
  230. package/template/src/views/dashboard/admin/components/TransactionTable.vue +55 -0
  231. package/template/src/views/dashboard/admin/components/mixins/resize.js +55 -0
  232. package/template/src/views/dashboard/admin/index.vue +124 -0
  233. package/template/src/views/dashboard/editor/index.vue +74 -0
  234. package/template/src/views/dashboard/index.vue +31 -0
  235. package/template/src/views/documentation/index.vue +57 -0
  236. package/template/src/views/error-log/components/ErrorTestA.vue +13 -0
  237. package/template/src/views/error-log/components/ErrorTestB.vue +11 -0
  238. package/template/src/views/error-log/index.vue +32 -0
  239. package/template/src/views/error-page/401.vue +99 -0
  240. package/template/src/views/error-page/404.vue +228 -0
  241. package/template/src/views/example/components/ArticleDetail.vue +289 -0
  242. package/template/src/views/example/components/Dropdown/Comment.vue +41 -0
  243. package/template/src/views/example/components/Dropdown/Platform.vue +46 -0
  244. package/template/src/views/example/components/Dropdown/SourceUrl.vue +38 -0
  245. package/template/src/views/example/components/Dropdown/index.js +3 -0
  246. package/template/src/views/example/components/Warning.vue +13 -0
  247. package/template/src/views/example/create.vue +13 -0
  248. package/template/src/views/example/edit.vue +13 -0
  249. package/template/src/views/example/list.vue +112 -0
  250. package/template/src/views/excel/components/AutoWidthOption.vue +34 -0
  251. package/template/src/views/excel/components/BookTypeOption.vue +39 -0
  252. package/template/src/views/excel/components/FilenameOption.vue +27 -0
  253. package/template/src/views/excel/export-excel.vue +116 -0
  254. package/template/src/views/excel/merge-header.vue +101 -0
  255. package/template/src/views/excel/select-excel.vue +107 -0
  256. package/template/src/views/excel/upload-excel.vue +42 -0
  257. package/template/src/views/guide/index.vue +36 -0
  258. package/template/src/views/guide/steps.js +53 -0
  259. package/template/src/views/icons/element-icons.js +3 -0
  260. package/template/src/views/icons/index.vue +101 -0
  261. package/template/src/views/icons/svg-icons.js +10 -0
  262. package/template/src/views/login/auth-redirect.vue +15 -0
  263. package/template/src/views/login/components/SocialSignin.vue +72 -0
  264. package/template/src/views/login/index.vue +324 -0
  265. package/template/src/views/nested/menu1/index.vue +7 -0
  266. package/template/src/views/nested/menu1/menu1-1/index.vue +7 -0
  267. package/template/src/views/nested/menu1/menu1-2/index.vue +7 -0
  268. package/template/src/views/nested/menu1/menu1-2/menu1-2-1/index.vue +5 -0
  269. package/template/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue +5 -0
  270. package/template/src/views/nested/menu1/menu1-3/index.vue +5 -0
  271. package/template/src/views/nested/menu2/index.vue +5 -0
  272. package/template/src/views/pdf/content.js +58 -0
  273. package/template/src/views/pdf/download.vue +201 -0
  274. package/template/src/views/pdf/index.vue +13 -0
  275. package/template/src/views/permission/components/SwitchRoles.vue +32 -0
  276. package/template/src/views/permission/directive.vue +111 -0
  277. package/template/src/views/permission/page.vue +19 -0
  278. package/template/src/views/permission/role.vue +270 -0
  279. package/template/src/views/profile/components/Account.vue +38 -0
  280. package/template/src/views/profile/components/Activity.vue +185 -0
  281. package/template/src/views/profile/components/Timeline.vue +43 -0
  282. package/template/src/views/profile/components/UserCard.vue +134 -0
  283. package/template/src/views/profile/index.vue +68 -0
  284. package/template/src/views/qiniu/upload.vue +41 -0
  285. package/template/src/views/redirect/index.vue +12 -0
  286. package/template/src/views/tab/components/TabPane.vue +103 -0
  287. package/template/src/views/tab/index.vue +57 -0
  288. package/template/src/views/table/complex-table.vue +379 -0
  289. package/template/src/views/table/drag-table.vue +153 -0
  290. package/template/src/views/table/dynamic-table/components/FixedThead.vue +62 -0
  291. package/template/src/views/table/dynamic-table/components/UnfixedThead.vue +50 -0
  292. package/template/src/views/table/dynamic-table/index.vue +24 -0
  293. package/template/src/views/table/inline-edit-table.vue +149 -0
  294. package/template/src/views/theme/index.vue +120 -0
  295. package/template/src/views/zip/index.vue +77 -0
  296. package/template/tests/unit/.eslintrc.js +5 -0
  297. package/template/tests/unit/components/Hamburger.spec.js +18 -0
  298. package/template/tests/unit/components/SvgIcon.spec.js +22 -0
  299. package/template/tests/unit/utils/formatTime.spec.js +29 -0
  300. package/template/tests/unit/utils/param2Obj.spec.js +14 -0
  301. package/template/tests/unit/utils/parseTime.spec.js +37 -0
  302. package/template/tests/unit/utils/validate.spec.js +28 -0
  303. package/template/vue.config.js +124 -0
@@ -0,0 +1,98 @@
1
+ const Mock = require('mockjs')
2
+ const { deepClone } = require('../utils')
3
+ const { asyncRoutes, constantRoutes } = require('./routes.js')
4
+
5
+ const routes = deepClone([...constantRoutes, ...asyncRoutes])
6
+
7
+ const roles = [
8
+ {
9
+ key: 'admin',
10
+ name: 'admin',
11
+ description: 'Super Administrator. Have access to view all pages.',
12
+ routes: routes
13
+ },
14
+ {
15
+ key: 'editor',
16
+ name: 'editor',
17
+ description: 'Normal Editor. Can see all pages except permission page',
18
+ routes: routes.filter(i => i.path !== '/permission')// just a mock
19
+ },
20
+ {
21
+ key: 'visitor',
22
+ name: 'visitor',
23
+ description: 'Just a visitor. Can only see the home page and the document page',
24
+ routes: [{
25
+ path: '',
26
+ redirect: 'dashboard',
27
+ children: [
28
+ {
29
+ path: 'dashboard',
30
+ name: 'Dashboard',
31
+ meta: { title: 'dashboard', icon: 'dashboard' }
32
+ }
33
+ ]
34
+ }]
35
+ }
36
+ ]
37
+
38
+ module.exports = [
39
+ // mock get all routes form server
40
+ {
41
+ url: '/vue-element-admin/routes',
42
+ type: 'get',
43
+ response: _ => {
44
+ return {
45
+ code: 20000,
46
+ data: routes
47
+ }
48
+ }
49
+ },
50
+
51
+ // mock get all roles form server
52
+ {
53
+ url: '/vue-element-admin/roles',
54
+ type: 'get',
55
+ response: _ => {
56
+ return {
57
+ code: 20000,
58
+ data: roles
59
+ }
60
+ }
61
+ },
62
+
63
+ // add role
64
+ {
65
+ url: '/vue-element-admin/role',
66
+ type: 'post',
67
+ response: {
68
+ code: 20000,
69
+ data: {
70
+ key: Mock.mock('@integer(300, 5000)')
71
+ }
72
+ }
73
+ },
74
+
75
+ // update role
76
+ {
77
+ url: '/vue-element-admin/role/[A-Za-z0-9]',
78
+ type: 'put',
79
+ response: {
80
+ code: 20000,
81
+ data: {
82
+ status: 'success'
83
+ }
84
+ }
85
+ },
86
+
87
+ // delete role
88
+ {
89
+ url: '/vue-element-admin/role/[A-Za-z0-9]',
90
+ type: 'delete',
91
+ response: {
92
+ code: 20000,
93
+ data: {
94
+ status: 'success'
95
+ }
96
+ }
97
+ }
98
+ ]
@@ -0,0 +1,530 @@
1
+ // Just a mock data
2
+
3
+ const constantRoutes = [
4
+ {
5
+ path: '/redirect',
6
+ component: 'layout/Layout',
7
+ hidden: true,
8
+ children: [
9
+ {
10
+ path: '/redirect/:path*',
11
+ component: 'views/redirect/index'
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ path: '/login',
17
+ component: 'views/login/index',
18
+ hidden: true
19
+ },
20
+ {
21
+ path: '/auth-redirect',
22
+ component: 'views/login/auth-redirect',
23
+ hidden: true
24
+ },
25
+ {
26
+ path: '/404',
27
+ component: 'views/error-page/404',
28
+ hidden: true
29
+ },
30
+ {
31
+ path: '/401',
32
+ component: 'views/error-page/401',
33
+ hidden: true
34
+ },
35
+ {
36
+ path: '',
37
+ component: 'layout/Layout',
38
+ redirect: 'dashboard',
39
+ children: [
40
+ {
41
+ path: 'dashboard',
42
+ component: 'views/dashboard/index',
43
+ name: 'Dashboard',
44
+ meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
45
+ }
46
+ ]
47
+ },
48
+ {
49
+ path: '/documentation',
50
+ component: 'layout/Layout',
51
+ children: [
52
+ {
53
+ path: 'index',
54
+ component: 'views/documentation/index',
55
+ name: 'Documentation',
56
+ meta: { title: 'Documentation', icon: 'documentation', affix: true }
57
+ }
58
+ ]
59
+ },
60
+ {
61
+ path: '/guide',
62
+ component: 'layout/Layout',
63
+ redirect: '/guide/index',
64
+ children: [
65
+ {
66
+ path: 'index',
67
+ component: 'views/guide/index',
68
+ name: 'Guide',
69
+ meta: { title: 'Guide', icon: 'guide', noCache: true }
70
+ }
71
+ ]
72
+ }
73
+ ]
74
+
75
+ const asyncRoutes = [
76
+ {
77
+ path: '/permission',
78
+ component: 'layout/Layout',
79
+ redirect: '/permission/index',
80
+ alwaysShow: true,
81
+ meta: {
82
+ title: 'Permission',
83
+ icon: 'lock',
84
+ roles: ['admin', 'editor']
85
+ },
86
+ children: [
87
+ {
88
+ path: 'page',
89
+ component: 'views/permission/page',
90
+ name: 'PagePermission',
91
+ meta: {
92
+ title: 'Page Permission',
93
+ roles: ['admin']
94
+ }
95
+ },
96
+ {
97
+ path: 'directive',
98
+ component: 'views/permission/directive',
99
+ name: 'DirectivePermission',
100
+ meta: {
101
+ title: 'Directive Permission'
102
+ }
103
+ },
104
+ {
105
+ path: 'role',
106
+ component: 'views/permission/role',
107
+ name: 'RolePermission',
108
+ meta: {
109
+ title: 'Role Permission',
110
+ roles: ['admin']
111
+ }
112
+ }
113
+ ]
114
+ },
115
+
116
+ {
117
+ path: '/icon',
118
+ component: 'layout/Layout',
119
+ children: [
120
+ {
121
+ path: 'index',
122
+ component: 'views/icons/index',
123
+ name: 'Icons',
124
+ meta: { title: 'Icons', icon: 'icon', noCache: true }
125
+ }
126
+ ]
127
+ },
128
+
129
+ {
130
+ path: '/components',
131
+ component: 'layout/Layout',
132
+ redirect: 'noRedirect',
133
+ name: 'ComponentDemo',
134
+ meta: {
135
+ title: 'Components',
136
+ icon: 'component'
137
+ },
138
+ children: [
139
+ {
140
+ path: 'tinymce',
141
+ component: 'views/components-demo/tinymce',
142
+ name: 'TinymceDemo',
143
+ meta: { title: 'Tinymce' }
144
+ },
145
+ {
146
+ path: 'markdown',
147
+ component: 'views/components-demo/markdown',
148
+ name: 'MarkdownDemo',
149
+ meta: { title: 'Markdown' }
150
+ },
151
+ {
152
+ path: 'json-editor',
153
+ component: 'views/components-demo/json-editor',
154
+ name: 'JsonEditorDemo',
155
+ meta: { title: 'Json Editor' }
156
+ },
157
+ {
158
+ path: 'split-pane',
159
+ component: 'views/components-demo/split-pane',
160
+ name: 'SplitpaneDemo',
161
+ meta: { title: 'SplitPane' }
162
+ },
163
+ {
164
+ path: 'avatar-upload',
165
+ component: 'views/components-demo/avatar-upload',
166
+ name: 'AvatarUploadDemo',
167
+ meta: { title: 'Avatar Upload' }
168
+ },
169
+ {
170
+ path: 'dropzone',
171
+ component: 'views/components-demo/dropzone',
172
+ name: 'DropzoneDemo',
173
+ meta: { title: 'Dropzone' }
174
+ },
175
+ {
176
+ path: 'sticky',
177
+ component: 'views/components-demo/sticky',
178
+ name: 'StickyDemo',
179
+ meta: { title: 'Sticky' }
180
+ },
181
+ {
182
+ path: 'count-to',
183
+ component: 'views/components-demo/count-to',
184
+ name: 'CountToDemo',
185
+ meta: { title: 'Count To' }
186
+ },
187
+ {
188
+ path: 'mixin',
189
+ component: 'views/components-demo/mixin',
190
+ name: 'ComponentMixinDemo',
191
+ meta: { title: 'componentMixin' }
192
+ },
193
+ {
194
+ path: 'back-to-top',
195
+ component: 'views/components-demo/back-to-top',
196
+ name: 'BackToTopDemo',
197
+ meta: { title: 'Back To Top' }
198
+ },
199
+ {
200
+ path: 'drag-dialog',
201
+ component: 'views/components-demo/drag-dialog',
202
+ name: 'DragDialogDemo',
203
+ meta: { title: 'Drag Dialog' }
204
+ },
205
+ {
206
+ path: 'drag-select',
207
+ component: 'views/components-demo/drag-select',
208
+ name: 'DragSelectDemo',
209
+ meta: { title: 'Drag Select' }
210
+ },
211
+ {
212
+ path: 'dnd-list',
213
+ component: 'views/components-demo/dnd-list',
214
+ name: 'DndListDemo',
215
+ meta: { title: 'Dnd List' }
216
+ },
217
+ {
218
+ path: 'drag-kanban',
219
+ component: 'views/components-demo/drag-kanban',
220
+ name: 'DragKanbanDemo',
221
+ meta: { title: 'Drag Kanban' }
222
+ }
223
+ ]
224
+ },
225
+ {
226
+ path: '/charts',
227
+ component: 'layout/Layout',
228
+ redirect: 'noRedirect',
229
+ name: 'Charts',
230
+ meta: {
231
+ title: 'Charts',
232
+ icon: 'chart'
233
+ },
234
+ children: [
235
+ {
236
+ path: 'keyboard',
237
+ component: 'views/charts/keyboard',
238
+ name: 'KeyboardChart',
239
+ meta: { title: 'Keyboard Chart', noCache: true }
240
+ },
241
+ {
242
+ path: 'line',
243
+ component: 'views/charts/line',
244
+ name: 'LineChart',
245
+ meta: { title: 'Line Chart', noCache: true }
246
+ },
247
+ {
248
+ path: 'mixchart',
249
+ component: 'views/charts/mixChart',
250
+ name: 'MixChart',
251
+ meta: { title: 'Mix Chart', noCache: true }
252
+ }
253
+ ]
254
+ },
255
+ {
256
+ path: '/nested',
257
+ component: 'layout/Layout',
258
+ redirect: '/nested/menu1/menu1-1',
259
+ name: 'Nested',
260
+ meta: {
261
+ title: 'Nested',
262
+ icon: 'nested'
263
+ },
264
+ children: [
265
+ {
266
+ path: 'menu1',
267
+ component: 'views/nested/menu1/index',
268
+ name: 'Menu1',
269
+ meta: { title: 'Menu1' },
270
+ redirect: '/nested/menu1/menu1-1',
271
+ children: [
272
+ {
273
+ path: 'menu1-1',
274
+ component: 'views/nested/menu1/menu1-1',
275
+ name: 'Menu1-1',
276
+ meta: { title: 'Menu1-1' }
277
+ },
278
+ {
279
+ path: 'menu1-2',
280
+ component: 'views/nested/menu1/menu1-2',
281
+ name: 'Menu1-2',
282
+ redirect: '/nested/menu1/menu1-2/menu1-2-1',
283
+ meta: { title: 'Menu1-2' },
284
+ children: [
285
+ {
286
+ path: 'menu1-2-1',
287
+ component: 'views/nested/menu1/menu1-2/menu1-2-1',
288
+ name: 'Menu1-2-1',
289
+ meta: { title: 'Menu1-2-1' }
290
+ },
291
+ {
292
+ path: 'menu1-2-2',
293
+ component: 'views/nested/menu1/menu1-2/menu1-2-2',
294
+ name: 'Menu1-2-2',
295
+ meta: { title: 'Menu1-2-2' }
296
+ }
297
+ ]
298
+ },
299
+ {
300
+ path: 'menu1-3',
301
+ component: 'views/nested/menu1/menu1-3',
302
+ name: 'Menu1-3',
303
+ meta: { title: 'Menu1-3' }
304
+ }
305
+ ]
306
+ },
307
+ {
308
+ path: 'menu2',
309
+ name: 'Menu2',
310
+ component: 'views/nested/menu2/index',
311
+ meta: { title: 'Menu2' }
312
+ }
313
+ ]
314
+ },
315
+
316
+ {
317
+ path: '/example',
318
+ component: 'layout/Layout',
319
+ redirect: '/example/list',
320
+ name: 'Example',
321
+ meta: {
322
+ title: 'Example',
323
+ icon: 'example'
324
+ },
325
+ children: [
326
+ {
327
+ path: 'create',
328
+ component: 'views/example/create',
329
+ name: 'CreateArticle',
330
+ meta: { title: 'Create Article', icon: 'edit' }
331
+ },
332
+ {
333
+ path: 'edit/:id(\\d+)',
334
+ component: 'views/example/edit',
335
+ name: 'EditArticle',
336
+ meta: { title: 'Edit Article', noCache: true },
337
+ hidden: true
338
+ },
339
+ {
340
+ path: 'list',
341
+ component: 'views/example/list',
342
+ name: 'ArticleList',
343
+ meta: { title: 'Article List', icon: 'list' }
344
+ }
345
+ ]
346
+ },
347
+
348
+ {
349
+ path: '/tab',
350
+ component: 'layout/Layout',
351
+ children: [
352
+ {
353
+ path: 'index',
354
+ component: 'views/tab/index',
355
+ name: 'Tab',
356
+ meta: { title: 'Tab', icon: 'tab' }
357
+ }
358
+ ]
359
+ },
360
+
361
+ {
362
+ path: '/error',
363
+ component: 'layout/Layout',
364
+ redirect: 'noRedirect',
365
+ name: 'ErrorPages',
366
+ meta: {
367
+ title: 'Error Pages',
368
+ icon: '404'
369
+ },
370
+ children: [
371
+ {
372
+ path: '401',
373
+ component: 'views/error-page/401',
374
+ name: 'Page401',
375
+ meta: { title: 'Page 401', noCache: true }
376
+ },
377
+ {
378
+ path: '404',
379
+ component: 'views/error-page/404',
380
+ name: 'Page404',
381
+ meta: { title: 'Page 404', noCache: true }
382
+ }
383
+ ]
384
+ },
385
+
386
+ {
387
+ path: '/error-log',
388
+ component: 'layout/Layout',
389
+ redirect: 'noRedirect',
390
+ children: [
391
+ {
392
+ path: 'log',
393
+ component: 'views/error-log/index',
394
+ name: 'ErrorLog',
395
+ meta: { title: 'Error Log', icon: 'bug' }
396
+ }
397
+ ]
398
+ },
399
+
400
+ {
401
+ path: '/excel',
402
+ component: 'layout/Layout',
403
+ redirect: '/excel/export-excel',
404
+ name: 'Excel',
405
+ meta: {
406
+ title: 'Excel',
407
+ icon: 'excel'
408
+ },
409
+ children: [
410
+ {
411
+ path: 'export-excel',
412
+ component: 'views/excel/export-excel',
413
+ name: 'ExportExcel',
414
+ meta: { title: 'Export Excel' }
415
+ },
416
+ {
417
+ path: 'export-selected-excel',
418
+ component: 'views/excel/select-excel',
419
+ name: 'SelectExcel',
420
+ meta: { title: 'Select Excel' }
421
+ },
422
+ {
423
+ path: 'export-merge-header',
424
+ component: 'views/excel/merge-header',
425
+ name: 'MergeHeader',
426
+ meta: { title: 'Merge Header' }
427
+ },
428
+ {
429
+ path: 'upload-excel',
430
+ component: 'views/excel/upload-excel',
431
+ name: 'UploadExcel',
432
+ meta: { title: 'Upload Excel' }
433
+ }
434
+ ]
435
+ },
436
+
437
+ {
438
+ path: '/zip',
439
+ component: 'layout/Layout',
440
+ redirect: '/zip/download',
441
+ alwaysShow: true,
442
+ meta: { title: 'Zip', icon: 'zip' },
443
+ children: [
444
+ {
445
+ path: 'download',
446
+ component: 'views/zip/index',
447
+ name: 'ExportZip',
448
+ meta: { title: 'Export Zip' }
449
+ }
450
+ ]
451
+ },
452
+
453
+ {
454
+ path: '/pdf',
455
+ component: 'layout/Layout',
456
+ redirect: '/pdf/index',
457
+ children: [
458
+ {
459
+ path: 'index',
460
+ component: 'views/pdf/index',
461
+ name: 'PDF',
462
+ meta: { title: 'PDF', icon: 'pdf' }
463
+ }
464
+ ]
465
+ },
466
+ {
467
+ path: '/pdf/download',
468
+ component: 'views/pdf/download',
469
+ hidden: true
470
+ },
471
+
472
+ {
473
+ path: '/theme',
474
+ component: 'layout/Layout',
475
+ redirect: 'noRedirect',
476
+ children: [
477
+ {
478
+ path: 'index',
479
+ component: 'views/theme/index',
480
+ name: 'Theme',
481
+ meta: { title: 'Theme', icon: 'theme' }
482
+ }
483
+ ]
484
+ },
485
+
486
+ {
487
+ path: '/clipboard',
488
+ component: 'layout/Layout',
489
+ redirect: 'noRedirect',
490
+ children: [
491
+ {
492
+ path: 'index',
493
+ component: 'views/clipboard/index',
494
+ name: 'ClipboardDemo',
495
+ meta: { title: 'Clipboard Demo', icon: 'clipboard' }
496
+ }
497
+ ]
498
+ },
499
+
500
+ {
501
+ path: '/i18n',
502
+ component: 'layout/Layout',
503
+ children: [
504
+ {
505
+ path: 'index',
506
+ component: 'views/i18n-demo/index',
507
+ name: 'I18n',
508
+ meta: { title: 'I18n', icon: 'international' }
509
+ }
510
+ ]
511
+ },
512
+
513
+ {
514
+ path: 'external-link',
515
+ component: 'layout/Layout',
516
+ children: [
517
+ {
518
+ path: 'https://github.com/PanJiaChen/vue-element-admin',
519
+ meta: { title: 'External Link', icon: 'link' }
520
+ }
521
+ ]
522
+ },
523
+
524
+ { path: '*', redirect: '/404', hidden: true }
525
+ ]
526
+
527
+ module.exports = {
528
+ constantRoutes,
529
+ asyncRoutes
530
+ }
@@ -0,0 +1,84 @@
1
+
2
+ const tokens = {
3
+ admin: {
4
+ token: 'admin-token'
5
+ },
6
+ editor: {
7
+ token: 'editor-token'
8
+ }
9
+ }
10
+
11
+ const users = {
12
+ 'admin-token': {
13
+ roles: ['admin'],
14
+ introduction: 'I am a super administrator',
15
+ avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
16
+ name: 'Super Admin'
17
+ },
18
+ 'editor-token': {
19
+ roles: ['editor'],
20
+ introduction: 'I am an editor',
21
+ avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
22
+ name: 'Normal Editor'
23
+ }
24
+ }
25
+
26
+ module.exports = [
27
+ // user login
28
+ {
29
+ url: '/vue-element-admin/user/login',
30
+ type: 'post',
31
+ response: config => {
32
+ const { username } = config.body
33
+ const token = tokens[username]
34
+
35
+ // mock error
36
+ if (!token) {
37
+ return {
38
+ code: 60204,
39
+ message: 'Account and password are incorrect.'
40
+ }
41
+ }
42
+
43
+ return {
44
+ code: 20000,
45
+ data: token
46
+ }
47
+ }
48
+ },
49
+
50
+ // get user info
51
+ {
52
+ url: '/vue-element-admin/user/info\.*',
53
+ type: 'get',
54
+ response: config => {
55
+ const { token } = config.query
56
+ const info = users[token]
57
+
58
+ // mock error
59
+ if (!info) {
60
+ return {
61
+ code: 50008,
62
+ message: 'Login failed, unable to get user details.'
63
+ }
64
+ }
65
+
66
+ return {
67
+ code: 20000,
68
+ data: info
69
+ }
70
+ }
71
+ },
72
+
73
+ // user logout
74
+ {
75
+ url: '/vue-element-admin/user/logout',
76
+ type: 'post',
77
+ response: _ => {
78
+ return {
79
+ code: 20000,
80
+ data: 'success'
81
+ }
82
+ }
83
+ }
84
+ ]