From 7abd6ddeea9da31f1cce20b1434e0f4cf9ad1341 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Wed, 25 Sep 2019 13:45:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=88=86=E5=8C=96?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/permission.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 5f0a37e85..d7cb1b7a2 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -28,11 +28,18 @@ function hasPermission(roles, route, parentsRoles) { setHonePagePath(route, roles); if (route.meta && route.meta.roles) { // 如果存在本级路由,则使用自己的roles过滤 - if (getSessionStorage('design')&& route.meta.roles.indexOf(userDesign)===-1 ) { - route.hidden = true; + // debugger; + if (getSessionStorage('design')) { + if (route.meta.roles.indexOf(userDesign)===-1) { + route.hidden = true; + } else { + if (!(route.meta.roles.indexOf(admin)>=0 && roles.indexOf(admin)>=0)) { + route.hidden = true; + } + } + } else { - // debugger; - if (!getSessionStorage('design')&&route.meta.roles.indexOf(userDesign)>0) { + if (route.meta.roles.indexOf(userDesign)>0) { route.hidden = true; } } @@ -109,7 +116,6 @@ const permission = { // eslint-disable-next-line prefer-const accessedRouters = filterAsyncRouter(asyncRouter, roles); // } - commit('SET_ROUTERS', accessedRouters); resolve(); }); From 7f77c3d33f161d7c0a8c09c4c17aa2aea9e90ef2 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Wed, 25 Sep 2019 14:45:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=88=86=E5=8C=96=20?= =?UTF-8?q?=E6=A0=87=E9=A2=98,=E8=B7=AF=E7=94=B1=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/Navbar.vue | 4 +-- src/layout/components/Title.vue | 38 ++++++++++++++------ src/router/index.js | 61 +++++++++++++++++++++----------- 3 files changed, 69 insertions(+), 34 deletions(-) diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 65d299a48..bfb179b4e 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -8,7 +8,7 @@ text-color="#fff" active-text-color="#ffd04b" > - +