From e55a0de42f9d5b72aa98e9be68a7b14de8f6e14d Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Wed, 12 Oct 2022 16:44:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/permission.js | 3 ++- src/store/modules/permission.js | 5 ++++- src/store/modules/projectConfig.js | 2 +- src/views/login/index.vue | 8 ++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/permission.js b/src/permission.js index 972ac5a5c..f5cf13904 100644 --- a/src/permission.js +++ b/src/permission.js @@ -114,7 +114,7 @@ router.beforeEach( async (to, from, next) => { // } const response = await getFrontProjectConfigByLogin(project); if (response.data) { - const {browserTitle, loginProLogo, baseApiUrl, baseSite, ossUrl} = response.data.viewSetting; + const {browserTitle, loginProLogo, baseApiUrl, baseSite, caseShow, ossUrl} = response.data.viewSetting; if (!store.state.user.baseUrl && project) { const urlData = handlerUrl(); store.dispatch('setBaseUrl', baseApiUrl || urlData.BASE_API); @@ -124,6 +124,7 @@ router.beforeEach( async (to, from, next) => { } document.title = browserTitle; document.querySelector("link[rel*='icon']").href = loginProLogo ? '/oss-rtss/logo/' + loginProLogo : ''; + store.commit('setCaseShow', caseShow); NProgress.start(); const loginPath = getRouteInfo(to, response.data.markKey); const token = to.query.token; diff --git a/src/store/modules/permission.js b/src/store/modules/permission.js index 145ccd55d..918aca4f5 100644 --- a/src/store/modules/permission.js +++ b/src/store/modules/permission.js @@ -94,7 +94,7 @@ const permission = { }, actions: { // 生成其他权限路由 - GenerateRoutes({ commit }, data) { + GenerateRoutes({ commit, rootState }, data) { return new Promise(resolve => { const { roles } = data; if (roles.includes(superAdmin) && !roles.includes(admin)) { // 只拥有超级管理员 没有管理员权限 @@ -110,6 +110,9 @@ const permission = { if (route.children && route.children.length == 0) { route.hidden = true; } + if (route.path == '/case') { + route.hidden = !rootState.projectConfig.caseShow; + } }); commit('SET_ROUTERS', accessedRouters); resolve(); diff --git a/src/store/modules/projectConfig.js b/src/store/modules/projectConfig.js index 86da36e3b..533e519b1 100644 --- a/src/store/modules/projectConfig.js +++ b/src/store/modules/projectConfig.js @@ -3,7 +3,7 @@ const user = { homeProLogoWidth:0, loginProLogo:'', homeTitle:'', - setCaseShow:true + caseShow:true }, mutations: { setHomeProLogoWidth: (state, homeProLogoWidth) => { diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 330149b4d..ce0e210ec 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -79,10 +79,10 @@ export default { this.loginProLogo = loginProLogo ? this.$store.state.user.ossUrl + '/logo/' + loginProLogo : ''; document.title = browserTitle; document.querySelector("link[rel*='icon']").href = this.loginProLogo; - this.$store.dispatch('projectConfig/setHomeProLogoWidth', homeProLogoWidth); - this.$store.dispatch('projectConfig/setLoginProLogo', this.loginProLogo); - this.$store.dispatch('projectConfig/setHomeTitle', homeTitle); - this.$store.dispatch('projectConfig/setCaseShow', caseShow); + this.$store.dispatch('setHomeProLogoWidth', homeProLogoWidth); + this.$store.dispatch('setLoginProLogo', this.loginProLogo); + this.$store.dispatch('setHomeTitle', homeTitle); + this.$store.dispatch('setCaseShow', caseShow); setSessionStorage('project', this.project); // aboutSystem:"主体:北京玖琏科技有限公司 备案号:京ICP备2021039716号" // baseDevelopment