From bfb035821793e08b77ca7cf75b853dd3cdf14ecc Mon Sep 17 00:00:00 2001 From: iczer <1126263215@qq.com> Date: Wed, 29 Jul 2020 11:08:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20function=20of=20async=20router=20?= =?UTF-8?q?and=20async=20menu;=20:star2:=20=E6=96=B0=E5=A2=9E=EF=BC=9A?= =?UTF-8?q?=E5=BC=82=E6=AD=A5=E8=B7=AF=E7=94=B1=E5=92=8C=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 5 + .env.development | 5 + package.json | 1 - src/bootstrap.js | 18 ++ src/components/exception/ExceptionPage.vue | 12 +- src/config/default/setting.config.js | 1 + src/layouts/AdminLayout.vue | 9 +- src/layouts/header/HeaderlAvatar.vue | 4 +- src/layouts/tabs/index.js | 2 + src/main.js | 9 +- src/mock/index.js | 1 + src/mock/user/login.js | 2 + src/mock/user/routes.js | 26 ++ src/pages/dashboard/analysis/index.js | 2 + src/pages/dashboard/workplace/index.js | 2 + src/pages/exception/403.vue | 7 +- src/pages/exception/404.vue | 2 +- src/pages/exception/500.vue | 7 +- src/pages/form/advance/index.js | 2 + src/pages/form/basic/index.js | 2 + src/pages/form/step/index.js | 2 + src/pages/login/Login.vue | 30 +- src/pages/login/index.js | 2 + src/router/config.async.js | 24 ++ src/router/config.js | 48 +-- src/router/index.js | 34 +- src/router/router.map.js | 154 ++++++++++ src/services/api.js | 3 +- src/services/index.js | 5 +- src/services/user.js | 11 +- src/store/index.js | 8 - src/store/modules/account.js | 87 ++++-- src/store/modules/setting.js | 7 + src/utils/i18n.js | 32 +- src/utils/routerUtil.js | 157 ++++++++++ yarn.lock | 341 +-------------------- 36 files changed, 614 insertions(+), 450 deletions(-) create mode 100644 .env create mode 100644 .env.development create mode 100644 src/bootstrap.js create mode 100644 src/layouts/tabs/index.js create mode 100644 src/mock/user/routes.js create mode 100644 src/pages/dashboard/analysis/index.js create mode 100644 src/pages/dashboard/workplace/index.js create mode 100644 src/pages/form/advance/index.js create mode 100644 src/pages/form/basic/index.js create mode 100644 src/pages/form/step/index.js create mode 100644 src/pages/login/index.js create mode 100644 src/router/config.async.js create mode 100644 src/router/router.map.js create mode 100644 src/utils/routerUtil.js diff --git a/.env b/.env new file mode 100644 index 0000000..a776eb8 --- /dev/null +++ b/.env @@ -0,0 +1,5 @@ +VUE_APP_NAME=admin +VUE_APP_ROUTES_KEY=admin.routes +VUE_APP_PERMISSIONS_KEY=admin.permissions +VUE_APP_ROLES_KEY=admin.roles +VUE_APP_USER_KEY=admin.user diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..a776eb8 --- /dev/null +++ b/.env.development @@ -0,0 +1,5 @@ +VUE_APP_NAME=admin +VUE_APP_ROUTES_KEY=admin.routes +VUE_APP_PERMISSIONS_KEY=admin.permissions +VUE_APP_ROLES_KEY=admin.roles +VUE_APP_USER_KEY=admin.user diff --git a/package.json b/package.json index cae6313..13150ea 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,6 @@ "enquire.js": "^2.1.6", "js-cookie": "^2.2.1", "mockjs": "^1.1.0", - "pouchdb": "^7.2.1", "viser-vue": "^2.4.8", "vue": "^2.6.11", "vue-i18n": "^8.18.2", diff --git a/src/bootstrap.js b/src/bootstrap.js new file mode 100644 index 0000000..b3f0226 --- /dev/null +++ b/src/bootstrap.js @@ -0,0 +1,18 @@ +import {loadRoutes, loginGuard, authorityGuard} from '@/utils/routerUtil' + +/** + * 启动引导方法 + * 应用启动时需要执行的操作放在这里 + * @param router 应用的路由实例 + * @param store 应用的 vuex.store 实例 + * @param i18n 应用的 vue-i18n 实例 + */ +function bootstrap({router, store, i18n}) { + // 加载路由 + loadRoutes({router, store, i18n}) + // 添加路由守卫 + loginGuard(router) + authorityGuard(router, store) +} + +export default bootstrap diff --git a/src/components/exception/ExceptionPage.vue b/src/components/exception/ExceptionPage.vue index 5c5316b..f9fb84a 100644 --- a/src/components/exception/ExceptionPage.vue +++ b/src/components/exception/ExceptionPage.vue @@ -7,7 +7,7 @@