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.
- package/package.json +8 -0
- package/template/.editorconfig +14 -0
- package/template/.env.development +5 -0
- package/template/.env.production +6 -0
- package/template/.env.staging +8 -0
- package/template/.eslintignore +4 -0
- package/template/.eslintrc.js +198 -0
- package/template/.travis.yml +5 -0
- package/template/LICENSE +21 -0
- package/template/README.es.md +228 -0
- package/template/README.ja.md +224 -0
- package/template/README.md +250 -0
- package/template/README.zh-CN.md +273 -0
- package/template/babel.config.js +14 -0
- package/template/build/index.js +35 -0
- package/template/jest.config.js +24 -0
- package/template/jsconfig.json +9 -0
- package/template/mock/article.js +116 -0
- package/template/mock/index.js +60 -0
- package/template/mock/mock-server.js +81 -0
- package/template/mock/remote-search.js +51 -0
- package/template/mock/role/index.js +98 -0
- package/template/mock/role/routes.js +530 -0
- package/template/mock/user.js +84 -0
- package/template/mock/utils.js +48 -0
- package/template/package.json +111 -0
- package/template/plop-templates/component/index.hbs +26 -0
- package/template/plop-templates/component/prompt.js +55 -0
- package/template/plop-templates/store/index.hbs +16 -0
- package/template/plop-templates/store/prompt.js +62 -0
- package/template/plop-templates/utils.js +2 -0
- package/template/plop-templates/view/index.hbs +26 -0
- package/template/plop-templates/view/prompt.js +55 -0
- package/template/plopfile.js +9 -0
- package/template/postcss.config.js +5 -0
- package/template/public/favicon.ico +0 -0
- package/template/public/index.html +15 -0
- package/template/src/App.vue +11 -0
- package/template/src/api/article.js +41 -0
- package/template/src/api/qiniu.js +8 -0
- package/template/src/api/remote-search.js +17 -0
- package/template/src/api/role.js +38 -0
- package/template/src/api/user.js +24 -0
- package/template/src/assets/401_images/401.gif +0 -0
- package/template/src/assets/404_images/404.png +0 -0
- package/template/src/assets/404_images/404_cloud.png +0 -0
- package/template/src/assets/custom-theme/fonts/element-icons.ttf +0 -0
- package/template/src/assets/custom-theme/fonts/element-icons.woff +0 -0
- package/template/src/assets/custom-theme/index.css +1 -0
- package/template/src/components/BackToTop/index.vue +111 -0
- package/template/src/components/Breadcrumb/index.vue +82 -0
- package/template/src/components/Charts/Keyboard.vue +155 -0
- package/template/src/components/Charts/LineMarker.vue +227 -0
- package/template/src/components/Charts/MixChart.vue +271 -0
- package/template/src/components/Charts/mixins/resize.js +56 -0
- package/template/src/components/DndList/index.vue +166 -0
- package/template/src/components/DragSelect/index.vue +65 -0
- package/template/src/components/Dropzone/index.vue +297 -0
- package/template/src/components/ErrorLog/index.vue +78 -0
- package/template/src/components/GithubCorner/index.vue +54 -0
- package/template/src/components/Hamburger/index.vue +44 -0
- package/template/src/components/HeaderSearch/index.vue +180 -0
- package/template/src/components/ImageCropper/index.vue +1779 -0
- package/template/src/components/ImageCropper/utils/data2blob.js +19 -0
- package/template/src/components/ImageCropper/utils/effectRipple.js +39 -0
- package/template/src/components/ImageCropper/utils/language.js +232 -0
- package/template/src/components/ImageCropper/utils/mimes.js +7 -0
- package/template/src/components/JsonEditor/index.vue +77 -0
- package/template/src/components/Kanban/index.vue +99 -0
- package/template/src/components/MDinput/index.vue +360 -0
- package/template/src/components/MarkdownEditor/default-options.js +31 -0
- package/template/src/components/MarkdownEditor/index.vue +118 -0
- package/template/src/components/Pagination/index.vue +101 -0
- package/template/src/components/PanThumb/index.vue +142 -0
- package/template/src/components/RightPanel/index.vue +145 -0
- package/template/src/components/Screenfull/index.vue +60 -0
- package/template/src/components/Share/DropdownMenu.vue +103 -0
- package/template/src/components/SizeSelect/index.vue +57 -0
- package/template/src/components/Sticky/index.vue +91 -0
- package/template/src/components/SvgIcon/index.vue +62 -0
- package/template/src/components/TextHoverEffect/Mallki.vue +113 -0
- package/template/src/components/ThemePicker/index.vue +175 -0
- package/template/src/components/Tinymce/components/EditorImage.vue +111 -0
- package/template/src/components/Tinymce/dynamicLoadScript.js +59 -0
- package/template/src/components/Tinymce/index.vue +247 -0
- package/template/src/components/Tinymce/plugins.js +7 -0
- package/template/src/components/Tinymce/toolbar.js +6 -0
- package/template/src/components/Upload/SingleImage.vue +134 -0
- package/template/src/components/Upload/SingleImage2.vue +130 -0
- package/template/src/components/Upload/SingleImage3.vue +157 -0
- package/template/src/components/UploadExcel/index.vue +138 -0
- package/template/src/directive/clipboard/clipboard.js +49 -0
- package/template/src/directive/clipboard/index.js +13 -0
- package/template/src/directive/el-drag-dialog/drag.js +77 -0
- package/template/src/directive/el-drag-dialog/index.js +13 -0
- package/template/src/directive/el-table/adaptive.js +41 -0
- package/template/src/directive/el-table/index.js +13 -0
- package/template/src/directive/permission/index.js +13 -0
- package/template/src/directive/permission/permission.js +31 -0
- package/template/src/directive/sticky.js +91 -0
- package/template/src/directive/waves/index.js +13 -0
- package/template/src/directive/waves/waves.css +26 -0
- package/template/src/directive/waves/waves.js +72 -0
- package/template/src/filters/index.js +68 -0
- package/template/src/icons/index.js +9 -0
- package/template/src/icons/svg/404.svg +1 -0
- package/template/src/icons/svg/bug.svg +1 -0
- package/template/src/icons/svg/chart.svg +1 -0
- package/template/src/icons/svg/clipboard.svg +1 -0
- package/template/src/icons/svg/component.svg +1 -0
- package/template/src/icons/svg/dashboard.svg +1 -0
- package/template/src/icons/svg/documentation.svg +1 -0
- package/template/src/icons/svg/drag.svg +1 -0
- package/template/src/icons/svg/edit.svg +1 -0
- package/template/src/icons/svg/education.svg +1 -0
- package/template/src/icons/svg/email.svg +1 -0
- package/template/src/icons/svg/example.svg +1 -0
- package/template/src/icons/svg/excel.svg +1 -0
- package/template/src/icons/svg/exit-fullscreen.svg +1 -0
- package/template/src/icons/svg/eye-open.svg +1 -0
- package/template/src/icons/svg/eye.svg +1 -0
- package/template/src/icons/svg/form.svg +1 -0
- package/template/src/icons/svg/fullscreen.svg +1 -0
- package/template/src/icons/svg/guide.svg +1 -0
- package/template/src/icons/svg/icon.svg +1 -0
- package/template/src/icons/svg/international.svg +1 -0
- package/template/src/icons/svg/language.svg +1 -0
- package/template/src/icons/svg/link.svg +1 -0
- package/template/src/icons/svg/list.svg +1 -0
- package/template/src/icons/svg/lock.svg +1 -0
- package/template/src/icons/svg/message.svg +1 -0
- package/template/src/icons/svg/money.svg +1 -0
- package/template/src/icons/svg/nested.svg +1 -0
- package/template/src/icons/svg/password.svg +1 -0
- package/template/src/icons/svg/pdf.svg +1 -0
- package/template/src/icons/svg/people.svg +1 -0
- package/template/src/icons/svg/peoples.svg +1 -0
- package/template/src/icons/svg/qq.svg +1 -0
- package/template/src/icons/svg/search.svg +1 -0
- package/template/src/icons/svg/shopping.svg +1 -0
- package/template/src/icons/svg/size.svg +1 -0
- package/template/src/icons/svg/skill.svg +1 -0
- package/template/src/icons/svg/star.svg +1 -0
- package/template/src/icons/svg/tab.svg +1 -0
- package/template/src/icons/svg/table.svg +1 -0
- package/template/src/icons/svg/theme.svg +1 -0
- package/template/src/icons/svg/tree-table.svg +1 -0
- package/template/src/icons/svg/tree.svg +1 -0
- package/template/src/icons/svg/user.svg +1 -0
- package/template/src/icons/svg/wechat.svg +1 -0
- package/template/src/icons/svg/zip.svg +1 -0
- package/template/src/icons/svgo.yml +22 -0
- package/template/src/layout/components/AppMain.vue +57 -0
- package/template/src/layout/components/Navbar.vue +167 -0
- package/template/src/layout/components/Settings/index.vue +108 -0
- package/template/src/layout/components/Sidebar/FixiOSBug.js +26 -0
- package/template/src/layout/components/Sidebar/Item.vue +41 -0
- package/template/src/layout/components/Sidebar/Link.vue +43 -0
- package/template/src/layout/components/Sidebar/Logo.vue +82 -0
- package/template/src/layout/components/Sidebar/SidebarItem.vue +95 -0
- package/template/src/layout/components/Sidebar/index.vue +54 -0
- package/template/src/layout/components/TagsView/ScrollPane.vue +94 -0
- package/template/src/layout/components/TagsView/index.vue +292 -0
- package/template/src/layout/components/index.js +5 -0
- package/template/src/layout/index.vue +102 -0
- package/template/src/layout/mixin/ResizeHandler.js +45 -0
- package/template/src/main.js +53 -0
- package/template/src/permission.js +74 -0
- package/template/src/router/index.js +404 -0
- package/template/src/router/modules/charts.js +36 -0
- package/template/src/router/modules/components.js +102 -0
- package/template/src/router/modules/nested.js +66 -0
- package/template/src/router/modules/table.js +41 -0
- package/template/src/settings.js +35 -0
- package/template/src/store/getters.js +15 -0
- package/template/src/store/index.js +25 -0
- package/template/src/store/modules/app.js +56 -0
- package/template/src/store/modules/errorLog.js +28 -0
- package/template/src/store/modules/permission.js +69 -0
- package/template/src/store/modules/settings.js +35 -0
- package/template/src/store/modules/tagsView.js +160 -0
- package/template/src/store/modules/user.js +131 -0
- package/template/src/styles/btn.scss +99 -0
- package/template/src/styles/element-ui.scss +84 -0
- package/template/src/styles/element-variables.scss +31 -0
- package/template/src/styles/index.scss +191 -0
- package/template/src/styles/mixin.scss +66 -0
- package/template/src/styles/sidebar.scss +226 -0
- package/template/src/styles/transition.scss +48 -0
- package/template/src/styles/variables.scss +35 -0
- package/template/src/utils/auth.js +15 -0
- package/template/src/utils/clipboard.js +32 -0
- package/template/src/utils/error-log.js +35 -0
- package/template/src/utils/get-page-title.js +10 -0
- package/template/src/utils/index.js +357 -0
- package/template/src/utils/open-window.js +25 -0
- package/template/src/utils/permission.js +21 -0
- package/template/src/utils/request.js +85 -0
- package/template/src/utils/scroll-to.js +58 -0
- package/template/src/utils/validate.js +87 -0
- package/template/src/vendor/Export2Excel.js +220 -0
- package/template/src/vendor/Export2Zip.js +24 -0
- package/template/src/views/charts/keyboard.vue +23 -0
- package/template/src/views/charts/line.vue +23 -0
- package/template/src/views/charts/mix-chart.vue +23 -0
- package/template/src/views/clipboard/index.vue +49 -0
- package/template/src/views/components-demo/avatar-upload.vue +61 -0
- package/template/src/views/components-demo/back-to-top.vue +154 -0
- package/template/src/views/components-demo/count-to.vue +218 -0
- package/template/src/views/components-demo/dnd-list.vue +39 -0
- package/template/src/views/components-demo/drag-dialog.vue +61 -0
- package/template/src/views/components-demo/drag-kanban.vue +66 -0
- package/template/src/views/components-demo/drag-select.vue +43 -0
- package/template/src/views/components-demo/dropzone.vue +31 -0
- package/template/src/views/components-demo/json-editor.vue +36 -0
- package/template/src/views/components-demo/markdown.vue +101 -0
- package/template/src/views/components-demo/mixin.vue +169 -0
- package/template/src/views/components-demo/split-pane.vue +67 -0
- package/template/src/views/components-demo/sticky.vue +135 -0
- package/template/src/views/components-demo/tinymce.vue +36 -0
- package/template/src/views/dashboard/admin/components/BarChart.vue +102 -0
- package/template/src/views/dashboard/admin/components/BoxCard.vue +118 -0
- package/template/src/views/dashboard/admin/components/LineChart.vue +135 -0
- package/template/src/views/dashboard/admin/components/PanelGroup.vue +181 -0
- package/template/src/views/dashboard/admin/components/PieChart.vue +79 -0
- package/template/src/views/dashboard/admin/components/RaddarChart.vue +116 -0
- package/template/src/views/dashboard/admin/components/TodoList/Todo.vue +81 -0
- package/template/src/views/dashboard/admin/components/TodoList/index.scss +320 -0
- package/template/src/views/dashboard/admin/components/TodoList/index.vue +127 -0
- package/template/src/views/dashboard/admin/components/TransactionTable.vue +55 -0
- package/template/src/views/dashboard/admin/components/mixins/resize.js +55 -0
- package/template/src/views/dashboard/admin/index.vue +124 -0
- package/template/src/views/dashboard/editor/index.vue +74 -0
- package/template/src/views/dashboard/index.vue +31 -0
- package/template/src/views/documentation/index.vue +57 -0
- package/template/src/views/error-log/components/ErrorTestA.vue +13 -0
- package/template/src/views/error-log/components/ErrorTestB.vue +11 -0
- package/template/src/views/error-log/index.vue +32 -0
- package/template/src/views/error-page/401.vue +99 -0
- package/template/src/views/error-page/404.vue +228 -0
- package/template/src/views/example/components/ArticleDetail.vue +289 -0
- package/template/src/views/example/components/Dropdown/Comment.vue +41 -0
- package/template/src/views/example/components/Dropdown/Platform.vue +46 -0
- package/template/src/views/example/components/Dropdown/SourceUrl.vue +38 -0
- package/template/src/views/example/components/Dropdown/index.js +3 -0
- package/template/src/views/example/components/Warning.vue +13 -0
- package/template/src/views/example/create.vue +13 -0
- package/template/src/views/example/edit.vue +13 -0
- package/template/src/views/example/list.vue +112 -0
- package/template/src/views/excel/components/AutoWidthOption.vue +34 -0
- package/template/src/views/excel/components/BookTypeOption.vue +39 -0
- package/template/src/views/excel/components/FilenameOption.vue +27 -0
- package/template/src/views/excel/export-excel.vue +116 -0
- package/template/src/views/excel/merge-header.vue +101 -0
- package/template/src/views/excel/select-excel.vue +107 -0
- package/template/src/views/excel/upload-excel.vue +42 -0
- package/template/src/views/guide/index.vue +36 -0
- package/template/src/views/guide/steps.js +53 -0
- package/template/src/views/icons/element-icons.js +3 -0
- package/template/src/views/icons/index.vue +101 -0
- package/template/src/views/icons/svg-icons.js +10 -0
- package/template/src/views/login/auth-redirect.vue +15 -0
- package/template/src/views/login/components/SocialSignin.vue +72 -0
- package/template/src/views/login/index.vue +324 -0
- package/template/src/views/nested/menu1/index.vue +7 -0
- package/template/src/views/nested/menu1/menu1-1/index.vue +7 -0
- package/template/src/views/nested/menu1/menu1-2/index.vue +7 -0
- package/template/src/views/nested/menu1/menu1-2/menu1-2-1/index.vue +5 -0
- package/template/src/views/nested/menu1/menu1-2/menu1-2-2/index.vue +5 -0
- package/template/src/views/nested/menu1/menu1-3/index.vue +5 -0
- package/template/src/views/nested/menu2/index.vue +5 -0
- package/template/src/views/pdf/content.js +58 -0
- package/template/src/views/pdf/download.vue +201 -0
- package/template/src/views/pdf/index.vue +13 -0
- package/template/src/views/permission/components/SwitchRoles.vue +32 -0
- package/template/src/views/permission/directive.vue +111 -0
- package/template/src/views/permission/page.vue +19 -0
- package/template/src/views/permission/role.vue +270 -0
- package/template/src/views/profile/components/Account.vue +38 -0
- package/template/src/views/profile/components/Activity.vue +185 -0
- package/template/src/views/profile/components/Timeline.vue +43 -0
- package/template/src/views/profile/components/UserCard.vue +134 -0
- package/template/src/views/profile/index.vue +68 -0
- package/template/src/views/qiniu/upload.vue +41 -0
- package/template/src/views/redirect/index.vue +12 -0
- package/template/src/views/tab/components/TabPane.vue +103 -0
- package/template/src/views/tab/index.vue +57 -0
- package/template/src/views/table/complex-table.vue +379 -0
- package/template/src/views/table/drag-table.vue +153 -0
- package/template/src/views/table/dynamic-table/components/FixedThead.vue +62 -0
- package/template/src/views/table/dynamic-table/components/UnfixedThead.vue +50 -0
- package/template/src/views/table/dynamic-table/index.vue +24 -0
- package/template/src/views/table/inline-edit-table.vue +149 -0
- package/template/src/views/theme/index.vue +120 -0
- package/template/src/views/zip/index.vue +77 -0
- package/template/tests/unit/.eslintrc.js +5 -0
- package/template/tests/unit/components/Hamburger.spec.js +18 -0
- package/template/tests/unit/components/SvgIcon.spec.js +22 -0
- package/template/tests/unit/utils/formatTime.spec.js +29 -0
- package/template/tests/unit/utils/param2Obj.spec.js +14 -0
- package/template/tests/unit/utils/parseTime.spec.js +37 -0
- package/template/tests/unit/utils/validate.spec.js +28 -0
- package/template/vue.config.js +124 -0
@@ -0,0 +1,74 @@
|
|
1
|
+
import router from './router'
|
2
|
+
import store from './store'
|
3
|
+
import { Message } from 'element-ui'
|
4
|
+
import NProgress from 'nprogress' // progress bar
|
5
|
+
import 'nprogress/nprogress.css' // progress bar style
|
6
|
+
import { getToken } from '@/utils/auth' // get token from cookie
|
7
|
+
import getPageTitle from '@/utils/get-page-title'
|
8
|
+
|
9
|
+
NProgress.configure({ showSpinner: false }) // NProgress Configuration
|
10
|
+
|
11
|
+
const whiteList = ['/login', '/auth-redirect'] // no redirect whitelist
|
12
|
+
|
13
|
+
router.beforeEach(async(to, from, next) => {
|
14
|
+
// start progress bar
|
15
|
+
NProgress.start()
|
16
|
+
|
17
|
+
// set page title
|
18
|
+
document.title = getPageTitle(to.meta.title)
|
19
|
+
|
20
|
+
// determine whether the user has logged in
|
21
|
+
const hasToken = getToken()
|
22
|
+
|
23
|
+
if (hasToken) {
|
24
|
+
if (to.path === '/login') {
|
25
|
+
// if is logged in, redirect to the home page
|
26
|
+
next({ path: '/' })
|
27
|
+
NProgress.done() // hack: https://github.com/PanJiaChen/vue-element-admin/pull/2939
|
28
|
+
} else {
|
29
|
+
// determine whether the user has obtained his permission roles through getInfo
|
30
|
+
const hasRoles = store.getters.roles && store.getters.roles.length > 0
|
31
|
+
if (hasRoles) {
|
32
|
+
next()
|
33
|
+
} else {
|
34
|
+
try {
|
35
|
+
// get user info
|
36
|
+
// note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
|
37
|
+
const { roles } = await store.dispatch('user/getInfo')
|
38
|
+
|
39
|
+
// generate accessible routes map based on roles
|
40
|
+
const accessRoutes = await store.dispatch('permission/generateRoutes', roles)
|
41
|
+
|
42
|
+
// dynamically add accessible routes
|
43
|
+
router.addRoutes(accessRoutes)
|
44
|
+
|
45
|
+
// hack method to ensure that addRoutes is complete
|
46
|
+
// set the replace: true, so the navigation will not leave a history record
|
47
|
+
next({ ...to, replace: true })
|
48
|
+
} catch (error) {
|
49
|
+
// remove token and go to login page to re-login
|
50
|
+
await store.dispatch('user/resetToken')
|
51
|
+
Message.error(error || 'Has Error')
|
52
|
+
next(`/login?redirect=${to.path}`)
|
53
|
+
NProgress.done()
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
} else {
|
58
|
+
/* has no token*/
|
59
|
+
|
60
|
+
if (whiteList.indexOf(to.path) !== -1) {
|
61
|
+
// in the free login whitelist, go directly
|
62
|
+
next()
|
63
|
+
} else {
|
64
|
+
// other pages that do not have permission to access are redirected to the login page.
|
65
|
+
next(`/login?redirect=${to.path}`)
|
66
|
+
NProgress.done()
|
67
|
+
}
|
68
|
+
}
|
69
|
+
})
|
70
|
+
|
71
|
+
router.afterEach(() => {
|
72
|
+
// finish progress bar
|
73
|
+
NProgress.done()
|
74
|
+
})
|
@@ -0,0 +1,404 @@
|
|
1
|
+
import Vue from 'vue'
|
2
|
+
import Router from 'vue-router'
|
3
|
+
|
4
|
+
Vue.use(Router)
|
5
|
+
|
6
|
+
/* Layout */
|
7
|
+
import Layout from '@/layout'
|
8
|
+
|
9
|
+
/* Router Modules */
|
10
|
+
import componentsRouter from './modules/components'
|
11
|
+
import chartsRouter from './modules/charts'
|
12
|
+
import tableRouter from './modules/table'
|
13
|
+
import nestedRouter from './modules/nested'
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Note: sub-menu only appear when route children.length >= 1
|
17
|
+
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
|
18
|
+
*
|
19
|
+
* hidden: true if set true, item will not show in the sidebar(default is false)
|
20
|
+
* alwaysShow: true if set true, will always show the root menu
|
21
|
+
* if not set alwaysShow, when item has more than one children route,
|
22
|
+
* it will becomes nested mode, otherwise not show the root menu
|
23
|
+
* redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
|
24
|
+
* name:'router-name' the name is used by <keep-alive> (must set!!!)
|
25
|
+
* meta : {
|
26
|
+
roles: ['admin','editor'] control the page roles (you can set multiple roles)
|
27
|
+
title: 'title' the name show in sidebar and breadcrumb (recommend set)
|
28
|
+
icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
|
29
|
+
noCache: true if set true, the page will no be cached(default is false)
|
30
|
+
affix: true if set true, the tag will affix in the tags-view
|
31
|
+
breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
|
32
|
+
activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
|
33
|
+
}
|
34
|
+
*/
|
35
|
+
|
36
|
+
/**
|
37
|
+
* constantRoutes
|
38
|
+
* a base page that does not have permission requirements
|
39
|
+
* all roles can be accessed
|
40
|
+
*/
|
41
|
+
export const constantRoutes = [
|
42
|
+
{
|
43
|
+
path: '/redirect',
|
44
|
+
component: Layout,
|
45
|
+
hidden: true,
|
46
|
+
children: [
|
47
|
+
{
|
48
|
+
path: '/redirect/:path(.*)',
|
49
|
+
component: () => import('@/views/redirect/index')
|
50
|
+
}
|
51
|
+
]
|
52
|
+
},
|
53
|
+
{
|
54
|
+
path: '/login',
|
55
|
+
component: () => import('@/views/login/index'),
|
56
|
+
hidden: true
|
57
|
+
},
|
58
|
+
{
|
59
|
+
path: '/auth-redirect',
|
60
|
+
component: () => import('@/views/login/auth-redirect'),
|
61
|
+
hidden: true
|
62
|
+
},
|
63
|
+
{
|
64
|
+
path: '/404',
|
65
|
+
component: () => import('@/views/error-page/404'),
|
66
|
+
hidden: true
|
67
|
+
},
|
68
|
+
{
|
69
|
+
path: '/401',
|
70
|
+
component: () => import('@/views/error-page/401'),
|
71
|
+
hidden: true
|
72
|
+
},
|
73
|
+
{
|
74
|
+
path: '/',
|
75
|
+
component: Layout,
|
76
|
+
redirect: '/dashboard',
|
77
|
+
children: [
|
78
|
+
{
|
79
|
+
path: 'dashboard',
|
80
|
+
component: () => import('@/views/dashboard/index'),
|
81
|
+
name: 'Dashboard',
|
82
|
+
meta: { title: 'Dashboard', icon: 'dashboard', affix: true }
|
83
|
+
}
|
84
|
+
]
|
85
|
+
},
|
86
|
+
{
|
87
|
+
path: '/documentation',
|
88
|
+
component: Layout,
|
89
|
+
children: [
|
90
|
+
{
|
91
|
+
path: 'index',
|
92
|
+
component: () => import('@/views/documentation/index'),
|
93
|
+
name: 'Documentation',
|
94
|
+
meta: { title: 'Documentation', icon: 'documentation', affix: true }
|
95
|
+
}
|
96
|
+
]
|
97
|
+
},
|
98
|
+
{
|
99
|
+
path: '/guide',
|
100
|
+
component: Layout,
|
101
|
+
redirect: '/guide/index',
|
102
|
+
children: [
|
103
|
+
{
|
104
|
+
path: 'index',
|
105
|
+
component: () => import('@/views/guide/index'),
|
106
|
+
name: 'Guide',
|
107
|
+
meta: { title: 'Guide', icon: 'guide', noCache: true }
|
108
|
+
}
|
109
|
+
]
|
110
|
+
},
|
111
|
+
{
|
112
|
+
path: '/profile',
|
113
|
+
component: Layout,
|
114
|
+
redirect: '/profile/index',
|
115
|
+
hidden: true,
|
116
|
+
children: [
|
117
|
+
{
|
118
|
+
path: 'index',
|
119
|
+
component: () => import('@/views/profile/index'),
|
120
|
+
name: 'Profile',
|
121
|
+
meta: { title: 'Profile', icon: 'user', noCache: true }
|
122
|
+
}
|
123
|
+
]
|
124
|
+
}
|
125
|
+
]
|
126
|
+
|
127
|
+
/**
|
128
|
+
* asyncRoutes
|
129
|
+
* the routes that need to be dynamically loaded based on user roles
|
130
|
+
*/
|
131
|
+
export const asyncRoutes = [
|
132
|
+
{
|
133
|
+
path: '/permission',
|
134
|
+
component: Layout,
|
135
|
+
redirect: '/permission/page',
|
136
|
+
alwaysShow: true, // will always show the root menu
|
137
|
+
name: 'Permission',
|
138
|
+
meta: {
|
139
|
+
title: 'Permission',
|
140
|
+
icon: 'lock',
|
141
|
+
roles: ['admin', 'editor'] // you can set roles in root nav
|
142
|
+
},
|
143
|
+
children: [
|
144
|
+
{
|
145
|
+
path: 'page',
|
146
|
+
component: () => import('@/views/permission/page'),
|
147
|
+
name: 'PagePermission',
|
148
|
+
meta: {
|
149
|
+
title: 'Page Permission',
|
150
|
+
roles: ['admin'] // or you can only set roles in sub nav
|
151
|
+
}
|
152
|
+
},
|
153
|
+
{
|
154
|
+
path: 'directive',
|
155
|
+
component: () => import('@/views/permission/directive'),
|
156
|
+
name: 'DirectivePermission',
|
157
|
+
meta: {
|
158
|
+
title: 'Directive Permission'
|
159
|
+
// if do not set roles, means: this page does not require permission
|
160
|
+
}
|
161
|
+
},
|
162
|
+
{
|
163
|
+
path: 'role',
|
164
|
+
component: () => import('@/views/permission/role'),
|
165
|
+
name: 'RolePermission',
|
166
|
+
meta: {
|
167
|
+
title: 'Role Permission',
|
168
|
+
roles: ['admin']
|
169
|
+
}
|
170
|
+
}
|
171
|
+
]
|
172
|
+
},
|
173
|
+
|
174
|
+
{
|
175
|
+
path: '/icon',
|
176
|
+
component: Layout,
|
177
|
+
children: [
|
178
|
+
{
|
179
|
+
path: 'index',
|
180
|
+
component: () => import('@/views/icons/index'),
|
181
|
+
name: 'Icons',
|
182
|
+
meta: { title: 'Icons', icon: 'icon', noCache: true }
|
183
|
+
}
|
184
|
+
]
|
185
|
+
},
|
186
|
+
|
187
|
+
/** when your routing map is too long, you can split it into small modules **/
|
188
|
+
componentsRouter,
|
189
|
+
chartsRouter,
|
190
|
+
nestedRouter,
|
191
|
+
tableRouter,
|
192
|
+
|
193
|
+
{
|
194
|
+
path: '/example',
|
195
|
+
component: Layout,
|
196
|
+
redirect: '/example/list',
|
197
|
+
name: 'Example',
|
198
|
+
meta: {
|
199
|
+
title: 'Example',
|
200
|
+
icon: 'el-icon-s-help'
|
201
|
+
},
|
202
|
+
children: [
|
203
|
+
{
|
204
|
+
path: 'create',
|
205
|
+
component: () => import('@/views/example/create'),
|
206
|
+
name: 'CreateArticle',
|
207
|
+
meta: { title: 'Create Article', icon: 'edit' }
|
208
|
+
},
|
209
|
+
{
|
210
|
+
path: 'edit/:id(\\d+)',
|
211
|
+
component: () => import('@/views/example/edit'),
|
212
|
+
name: 'EditArticle',
|
213
|
+
meta: { title: 'Edit Article', noCache: true, activeMenu: '/example/list' },
|
214
|
+
hidden: true
|
215
|
+
},
|
216
|
+
{
|
217
|
+
path: 'list',
|
218
|
+
component: () => import('@/views/example/list'),
|
219
|
+
name: 'ArticleList',
|
220
|
+
meta: { title: 'Article List', icon: 'list' }
|
221
|
+
}
|
222
|
+
]
|
223
|
+
},
|
224
|
+
|
225
|
+
{
|
226
|
+
path: '/tab',
|
227
|
+
component: Layout,
|
228
|
+
children: [
|
229
|
+
{
|
230
|
+
path: 'index',
|
231
|
+
component: () => import('@/views/tab/index'),
|
232
|
+
name: 'Tab',
|
233
|
+
meta: { title: 'Tab', icon: 'tab' }
|
234
|
+
}
|
235
|
+
]
|
236
|
+
},
|
237
|
+
|
238
|
+
{
|
239
|
+
path: '/error',
|
240
|
+
component: Layout,
|
241
|
+
redirect: 'noRedirect',
|
242
|
+
name: 'ErrorPages',
|
243
|
+
meta: {
|
244
|
+
title: 'Error Pages',
|
245
|
+
icon: '404'
|
246
|
+
},
|
247
|
+
children: [
|
248
|
+
{
|
249
|
+
path: '401',
|
250
|
+
component: () => import('@/views/error-page/401'),
|
251
|
+
name: 'Page401',
|
252
|
+
meta: { title: '401', noCache: true }
|
253
|
+
},
|
254
|
+
{
|
255
|
+
path: '404',
|
256
|
+
component: () => import('@/views/error-page/404'),
|
257
|
+
name: 'Page404',
|
258
|
+
meta: { title: '404', noCache: true }
|
259
|
+
}
|
260
|
+
]
|
261
|
+
},
|
262
|
+
|
263
|
+
{
|
264
|
+
path: '/error-log',
|
265
|
+
component: Layout,
|
266
|
+
children: [
|
267
|
+
{
|
268
|
+
path: 'log',
|
269
|
+
component: () => import('@/views/error-log/index'),
|
270
|
+
name: 'ErrorLog',
|
271
|
+
meta: { title: 'Error Log', icon: 'bug' }
|
272
|
+
}
|
273
|
+
]
|
274
|
+
},
|
275
|
+
|
276
|
+
{
|
277
|
+
path: '/excel',
|
278
|
+
component: Layout,
|
279
|
+
redirect: '/excel/export-excel',
|
280
|
+
name: 'Excel',
|
281
|
+
meta: {
|
282
|
+
title: 'Excel',
|
283
|
+
icon: 'excel'
|
284
|
+
},
|
285
|
+
children: [
|
286
|
+
{
|
287
|
+
path: 'export-excel',
|
288
|
+
component: () => import('@/views/excel/export-excel'),
|
289
|
+
name: 'ExportExcel',
|
290
|
+
meta: { title: 'Export Excel' }
|
291
|
+
},
|
292
|
+
{
|
293
|
+
path: 'export-selected-excel',
|
294
|
+
component: () => import('@/views/excel/select-excel'),
|
295
|
+
name: 'SelectExcel',
|
296
|
+
meta: { title: 'Export Selected' }
|
297
|
+
},
|
298
|
+
{
|
299
|
+
path: 'export-merge-header',
|
300
|
+
component: () => import('@/views/excel/merge-header'),
|
301
|
+
name: 'MergeHeader',
|
302
|
+
meta: { title: 'Merge Header' }
|
303
|
+
},
|
304
|
+
{
|
305
|
+
path: 'upload-excel',
|
306
|
+
component: () => import('@/views/excel/upload-excel'),
|
307
|
+
name: 'UploadExcel',
|
308
|
+
meta: { title: 'Upload Excel' }
|
309
|
+
}
|
310
|
+
]
|
311
|
+
},
|
312
|
+
|
313
|
+
{
|
314
|
+
path: '/zip',
|
315
|
+
component: Layout,
|
316
|
+
redirect: '/zip/download',
|
317
|
+
alwaysShow: true,
|
318
|
+
name: 'Zip',
|
319
|
+
meta: { title: 'Zip', icon: 'zip' },
|
320
|
+
children: [
|
321
|
+
{
|
322
|
+
path: 'download',
|
323
|
+
component: () => import('@/views/zip/index'),
|
324
|
+
name: 'ExportZip',
|
325
|
+
meta: { title: 'Export Zip' }
|
326
|
+
}
|
327
|
+
]
|
328
|
+
},
|
329
|
+
|
330
|
+
{
|
331
|
+
path: '/pdf',
|
332
|
+
component: Layout,
|
333
|
+
redirect: '/pdf/index',
|
334
|
+
children: [
|
335
|
+
{
|
336
|
+
path: 'index',
|
337
|
+
component: () => import('@/views/pdf/index'),
|
338
|
+
name: 'PDF',
|
339
|
+
meta: { title: 'PDF', icon: 'pdf' }
|
340
|
+
}
|
341
|
+
]
|
342
|
+
},
|
343
|
+
{
|
344
|
+
path: '/pdf/download',
|
345
|
+
component: () => import('@/views/pdf/download'),
|
346
|
+
hidden: true
|
347
|
+
},
|
348
|
+
|
349
|
+
{
|
350
|
+
path: '/theme',
|
351
|
+
component: Layout,
|
352
|
+
children: [
|
353
|
+
{
|
354
|
+
path: 'index',
|
355
|
+
component: () => import('@/views/theme/index'),
|
356
|
+
name: 'Theme',
|
357
|
+
meta: { title: 'Theme', icon: 'theme' }
|
358
|
+
}
|
359
|
+
]
|
360
|
+
},
|
361
|
+
|
362
|
+
{
|
363
|
+
path: '/clipboard',
|
364
|
+
component: Layout,
|
365
|
+
children: [
|
366
|
+
{
|
367
|
+
path: 'index',
|
368
|
+
component: () => import('@/views/clipboard/index'),
|
369
|
+
name: 'ClipboardDemo',
|
370
|
+
meta: { title: 'Clipboard', icon: 'clipboard' }
|
371
|
+
}
|
372
|
+
]
|
373
|
+
},
|
374
|
+
|
375
|
+
{
|
376
|
+
path: 'external-link',
|
377
|
+
component: Layout,
|
378
|
+
children: [
|
379
|
+
{
|
380
|
+
path: 'https://github.com/PanJiaChen/vue-element-admin',
|
381
|
+
meta: { title: 'External Link', icon: 'link' }
|
382
|
+
}
|
383
|
+
]
|
384
|
+
},
|
385
|
+
|
386
|
+
// 404 page must be placed at the end !!!
|
387
|
+
{ path: '*', redirect: '/404', hidden: true }
|
388
|
+
]
|
389
|
+
|
390
|
+
const createRouter = () => new Router({
|
391
|
+
// mode: 'history', // require service support
|
392
|
+
scrollBehavior: () => ({ y: 0 }),
|
393
|
+
routes: constantRoutes
|
394
|
+
})
|
395
|
+
|
396
|
+
const router = createRouter()
|
397
|
+
|
398
|
+
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
|
399
|
+
export function resetRouter() {
|
400
|
+
const newRouter = createRouter()
|
401
|
+
router.matcher = newRouter.matcher // reset router
|
402
|
+
}
|
403
|
+
|
404
|
+
export default router
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/** When your routing table is too long, you can split it into small modules**/
|
2
|
+
|
3
|
+
import Layout from '@/layout'
|
4
|
+
|
5
|
+
const chartsRouter = {
|
6
|
+
path: '/charts',
|
7
|
+
component: Layout,
|
8
|
+
redirect: 'noRedirect',
|
9
|
+
name: 'Charts',
|
10
|
+
meta: {
|
11
|
+
title: 'Charts',
|
12
|
+
icon: 'chart'
|
13
|
+
},
|
14
|
+
children: [
|
15
|
+
{
|
16
|
+
path: 'keyboard',
|
17
|
+
component: () => import('@/views/charts/keyboard'),
|
18
|
+
name: 'KeyboardChart',
|
19
|
+
meta: { title: 'Keyboard Chart', noCache: true }
|
20
|
+
},
|
21
|
+
{
|
22
|
+
path: 'line',
|
23
|
+
component: () => import('@/views/charts/line'),
|
24
|
+
name: 'LineChart',
|
25
|
+
meta: { title: 'Line Chart', noCache: true }
|
26
|
+
},
|
27
|
+
{
|
28
|
+
path: 'mix-chart',
|
29
|
+
component: () => import('@/views/charts/mix-chart'),
|
30
|
+
name: 'MixChart',
|
31
|
+
meta: { title: 'Mix Chart', noCache: true }
|
32
|
+
}
|
33
|
+
]
|
34
|
+
}
|
35
|
+
|
36
|
+
export default chartsRouter
|
@@ -0,0 +1,102 @@
|
|
1
|
+
/** When your routing table is too long, you can split it into small modules **/
|
2
|
+
|
3
|
+
import Layout from '@/layout'
|
4
|
+
|
5
|
+
const componentsRouter = {
|
6
|
+
path: '/components',
|
7
|
+
component: Layout,
|
8
|
+
redirect: 'noRedirect',
|
9
|
+
name: 'ComponentDemo',
|
10
|
+
meta: {
|
11
|
+
title: 'Components',
|
12
|
+
icon: 'component'
|
13
|
+
},
|
14
|
+
children: [
|
15
|
+
{
|
16
|
+
path: 'tinymce',
|
17
|
+
component: () => import('@/views/components-demo/tinymce'),
|
18
|
+
name: 'TinymceDemo',
|
19
|
+
meta: { title: 'Tinymce' }
|
20
|
+
},
|
21
|
+
{
|
22
|
+
path: 'markdown',
|
23
|
+
component: () => import('@/views/components-demo/markdown'),
|
24
|
+
name: 'MarkdownDemo',
|
25
|
+
meta: { title: 'Markdown' }
|
26
|
+
},
|
27
|
+
{
|
28
|
+
path: 'json-editor',
|
29
|
+
component: () => import('@/views/components-demo/json-editor'),
|
30
|
+
name: 'JsonEditorDemo',
|
31
|
+
meta: { title: 'JSON Editor' }
|
32
|
+
},
|
33
|
+
{
|
34
|
+
path: 'split-pane',
|
35
|
+
component: () => import('@/views/components-demo/split-pane'),
|
36
|
+
name: 'SplitpaneDemo',
|
37
|
+
meta: { title: 'SplitPane' }
|
38
|
+
},
|
39
|
+
{
|
40
|
+
path: 'avatar-upload',
|
41
|
+
component: () => import('@/views/components-demo/avatar-upload'),
|
42
|
+
name: 'AvatarUploadDemo',
|
43
|
+
meta: { title: 'Upload' }
|
44
|
+
},
|
45
|
+
{
|
46
|
+
path: 'dropzone',
|
47
|
+
component: () => import('@/views/components-demo/dropzone'),
|
48
|
+
name: 'DropzoneDemo',
|
49
|
+
meta: { title: 'Dropzone' }
|
50
|
+
},
|
51
|
+
{
|
52
|
+
path: 'sticky',
|
53
|
+
component: () => import('@/views/components-demo/sticky'),
|
54
|
+
name: 'StickyDemo',
|
55
|
+
meta: { title: 'Sticky' }
|
56
|
+
},
|
57
|
+
{
|
58
|
+
path: 'count-to',
|
59
|
+
component: () => import('@/views/components-demo/count-to'),
|
60
|
+
name: 'CountToDemo',
|
61
|
+
meta: { title: 'Count To' }
|
62
|
+
},
|
63
|
+
{
|
64
|
+
path: 'mixin',
|
65
|
+
component: () => import('@/views/components-demo/mixin'),
|
66
|
+
name: 'ComponentMixinDemo',
|
67
|
+
meta: { title: 'Component Mixin' }
|
68
|
+
},
|
69
|
+
{
|
70
|
+
path: 'back-to-top',
|
71
|
+
component: () => import('@/views/components-demo/back-to-top'),
|
72
|
+
name: 'BackToTopDemo',
|
73
|
+
meta: { title: 'Back To Top' }
|
74
|
+
},
|
75
|
+
{
|
76
|
+
path: 'drag-dialog',
|
77
|
+
component: () => import('@/views/components-demo/drag-dialog'),
|
78
|
+
name: 'DragDialogDemo',
|
79
|
+
meta: { title: 'Drag Dialog' }
|
80
|
+
},
|
81
|
+
{
|
82
|
+
path: 'drag-select',
|
83
|
+
component: () => import('@/views/components-demo/drag-select'),
|
84
|
+
name: 'DragSelectDemo',
|
85
|
+
meta: { title: 'Drag Select' }
|
86
|
+
},
|
87
|
+
{
|
88
|
+
path: 'dnd-list',
|
89
|
+
component: () => import('@/views/components-demo/dnd-list'),
|
90
|
+
name: 'DndListDemo',
|
91
|
+
meta: { title: 'Dnd List' }
|
92
|
+
},
|
93
|
+
{
|
94
|
+
path: 'drag-kanban',
|
95
|
+
component: () => import('@/views/components-demo/drag-kanban'),
|
96
|
+
name: 'DragKanbanDemo',
|
97
|
+
meta: { title: 'Drag Kanban' }
|
98
|
+
}
|
99
|
+
]
|
100
|
+
}
|
101
|
+
|
102
|
+
export default componentsRouter
|
@@ -0,0 +1,66 @@
|
|
1
|
+
/** When your routing table is too long, you can split it into small modules **/
|
2
|
+
|
3
|
+
import Layout from '@/layout'
|
4
|
+
|
5
|
+
const nestedRouter = {
|
6
|
+
path: '/nested',
|
7
|
+
component: Layout,
|
8
|
+
redirect: '/nested/menu1/menu1-1',
|
9
|
+
name: 'Nested',
|
10
|
+
meta: {
|
11
|
+
title: 'Nested Routes',
|
12
|
+
icon: 'nested'
|
13
|
+
},
|
14
|
+
children: [
|
15
|
+
{
|
16
|
+
path: 'menu1',
|
17
|
+
component: () => import('@/views/nested/menu1/index'), // Parent router-view
|
18
|
+
name: 'Menu1',
|
19
|
+
meta: { title: 'Menu 1' },
|
20
|
+
redirect: '/nested/menu1/menu1-1',
|
21
|
+
children: [
|
22
|
+
{
|
23
|
+
path: 'menu1-1',
|
24
|
+
component: () => import('@/views/nested/menu1/menu1-1'),
|
25
|
+
name: 'Menu1-1',
|
26
|
+
meta: { title: 'Menu 1-1' }
|
27
|
+
},
|
28
|
+
{
|
29
|
+
path: 'menu1-2',
|
30
|
+
component: () => import('@/views/nested/menu1/menu1-2'),
|
31
|
+
name: 'Menu1-2',
|
32
|
+
redirect: '/nested/menu1/menu1-2/menu1-2-1',
|
33
|
+
meta: { title: 'Menu 1-2' },
|
34
|
+
children: [
|
35
|
+
{
|
36
|
+
path: 'menu1-2-1',
|
37
|
+
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-1'),
|
38
|
+
name: 'Menu1-2-1',
|
39
|
+
meta: { title: 'Menu 1-2-1' }
|
40
|
+
},
|
41
|
+
{
|
42
|
+
path: 'menu1-2-2',
|
43
|
+
component: () => import('@/views/nested/menu1/menu1-2/menu1-2-2'),
|
44
|
+
name: 'Menu1-2-2',
|
45
|
+
meta: { title: 'Menu 1-2-2' }
|
46
|
+
}
|
47
|
+
]
|
48
|
+
},
|
49
|
+
{
|
50
|
+
path: 'menu1-3',
|
51
|
+
component: () => import('@/views/nested/menu1/menu1-3'),
|
52
|
+
name: 'Menu1-3',
|
53
|
+
meta: { title: 'Menu 1-3' }
|
54
|
+
}
|
55
|
+
]
|
56
|
+
},
|
57
|
+
{
|
58
|
+
path: 'menu2',
|
59
|
+
name: 'Menu2',
|
60
|
+
component: () => import('@/views/nested/menu2/index'),
|
61
|
+
meta: { title: 'Menu 2' }
|
62
|
+
}
|
63
|
+
]
|
64
|
+
}
|
65
|
+
|
66
|
+
export default nestedRouter
|