From 8816e72c751c6d4a1e3de1e6f697d6739996c897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B0=B4=E8=90=BD=28YangLei=29?= Date: Mon, 5 Jul 2021 15:10:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=A3=E5=86=B3=E5=AD=90=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/index.js | 1 + src/pages/frame/store/accountModule.js | 16 ---------------- .../frame/view/template/PageTemplateView.vue | 6 +++--- src/router/config.js | 4 ++++ 4 files changed, 8 insertions(+), 19 deletions(-) create mode 100644 src/layout/index.js diff --git a/src/layout/index.js b/src/layout/index.js new file mode 100644 index 0000000..f664151 --- /dev/null +++ b/src/layout/index.js @@ -0,0 +1 @@ +export const RouterView = { render: h => h('router-view') }; diff --git a/src/pages/frame/store/accountModule.js b/src/pages/frame/store/accountModule.js index 0724955..4319880 100644 --- a/src/pages/frame/store/accountModule.js +++ b/src/pages/frame/store/accountModule.js @@ -1,24 +1,12 @@ export default { namespaced: true, state: { - user: undefined, permissions: null, roles: null, routesConfig: null, }, //大量共享的方法 getters: { - user: state => { - if (!state.user) { - try { - const user = '{}'; - state.user = JSON.parse(user); - } catch (e) { - console.error(e); - } - } - return state.user; - }, permissions: state => { if (!state.permissions) { try { @@ -53,10 +41,6 @@ export default { }, }, mutations: { - setUser(state, user) { - state.user = user; - localStorage.setItem(process.env.VUE_APP_USER_KEY, JSON.stringify(user)); - }, setPermissions(state, permissions) { state.permissions = permissions; localStorage.setItem(process.env.VUE_APP_PERMISSIONS_KEY, JSON.stringify(permissions)); diff --git a/src/pages/frame/view/template/PageTemplateView.vue b/src/pages/frame/view/template/PageTemplateView.vue index 524b019..590b390 100644 --- a/src/pages/frame/view/template/PageTemplateView.vue +++ b/src/pages/frame/view/template/PageTemplateView.vue @@ -22,13 +22,13 @@ export default { computed: { ...mapState('settingModule', ['isMobile', 'multiPage']), desc() { - return this.page.desc; + return this.page?.desc; }, linkList() { - return this.page.linkList; + return this.page?.linkList; }, extraImage() { - return this.page.extraImage; + return this.page?.extraImage; }, }, mounted() { diff --git a/src/router/config.js b/src/router/config.js index 47c85d4..2e676be 100644 --- a/src/router/config.js +++ b/src/router/config.js @@ -1,4 +1,5 @@ import { PageTemplateView, TabsTemplateView } from '@/pages/frame/view/template'; +import { RouterView } from '@/layout'; export const globalRoutes = [ { @@ -74,6 +75,7 @@ const hasAuthorityRoutes = [ { path: 'organization', name: '组织管理', + component: RouterView, children: [ { path: 'job', @@ -103,6 +105,7 @@ const hasAuthorityRoutes = [ { path: 'parameter', name: '参数管理', + component: RouterView, children: [ { path: 'business', @@ -119,6 +122,7 @@ const hasAuthorityRoutes = [ { path: 'log', name: '日志管理', + component: RouterView, children: [ { path: 'login', -- GitLab