From 8cca1569556dfce71eca58ff0c4fd2b6af45e402 Mon Sep 17 00:00:00 2001 From: joshen <445497689@qq.com> Date: Thu, 11 Jul 2024 21:32:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A4=96=E9=83=A8=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PortalHeader.vue | 5 +++-- src/layout/components/TopNav/Index.vue | 2 +- src/security.js | 14 ++++++++++++-- src/store/modules/user.js | 4 ++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/components/PortalHeader.vue b/src/components/PortalHeader.vue index df788684..d46a653f 100644 --- a/src/components/PortalHeader.vue +++ b/src/components/PortalHeader.vue @@ -6,7 +6,7 @@ -
+
首页
@@ -65,7 +65,7 @@
-
+
@@ -208,6 +208,7 @@ export default { this.sex = this.userInfo.sex; this.$store.dispatch('refrashMsg'); this.loadBoeData(); + console.log('this.userInfo::',this.userInfo) //this.loadPopupConfig(); }, methods: { diff --git a/src/layout/components/TopNav/Index.vue b/src/layout/components/TopNav/Index.vue index 50b68eb6..968c3a92 100644 --- a/src/layout/components/TopNav/Index.vue +++ b/src/layout/components/TopNav/Index.vue @@ -6,7 +6,7 @@ -
+
diff --git a/src/security.js b/src/security.js index 644f843b..9788cc03 100644 --- a/src/security.js +++ b/src/security.js @@ -24,16 +24,26 @@ router.beforeEach((to, from, next) => { } NProgress.start(); - + // console.log('whiteList::',whiteList,to.path) if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入 next() }else{ if(getToken()){ if(to.path === '/login'){ - next({ path: process.env.VUE_APP_PUBLIC_PATH+'/index' }) + // 如果是外部用户,把配置的路由跳转到个人中心 + if(store.getters.userInfo.role === 2){ + next({ path: process.env.VUE_APP_PUBLIC_PATH+'/uc/study/courses' }) + }else{ + next({ path: process.env.VUE_APP_PUBLIC_PATH+'/index' }) + } NProgress.done(); } else { + //console.log('store.getters.userInfo:',store.getters.userInfo.role) + // 如果是外部用户,把配置的路由跳转到个人中心 + if(store.getters.userInfo.role === 2){ + if(to.path === '/index' || to.path === '/course' || to.path === '/case' || to.path === '/article' ) location.href = '/pc/uc/study/task' + } //后续这里需要增加一定的控制 if (!store.getters.init) { sessionStorage.removeItem(xpage.constants.localCaseFiltersKey); diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 6a25b875..7259546c 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -41,6 +41,10 @@ const user = { sessionStorage.setItem("curIdentity", iden); }, SET_UserInfo: (state, uinfo) => { + // 内部用户和外部用户测试用 + uinfo.role = uinfo.departFullName.indexOf('京东方科技集团股份有限公司')!=-1?1:2 + if(uinfo.name === '尹晓钦') uinfo.role = 2 + console.log('uinfo::',uinfo) state.info = uinfo }, SET_PERMISSIONS: (state, permissions) => { From 530dbf241d35a71300268e6a813b8b7659ccf9ed Mon Sep 17 00:00:00 2001 From: joshen <445497689@qq.com> Date: Fri, 12 Jul 2024 14:23:18 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=94=9F=E4=BA=A7=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=A4=96=E9=83=A8=E4=BC=81=E4=B8=9A=E6=9D=83=E9=99=90=E6=8E=A7?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 7259546c..0fb78964 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -41,10 +41,11 @@ const user = { sessionStorage.setItem("curIdentity", iden); }, SET_UserInfo: (state, uinfo) => { - // 内部用户和外部用户测试用 - uinfo.role = uinfo.departFullName.indexOf('京东方科技集团股份有限公司')!=-1?1:2 - if(uinfo.name === '尹晓钦') uinfo.role = 2 - console.log('uinfo::',uinfo) + // 内部用户和外部用户 测试外部企业ID:1811380709626150912 生产外部wyhgID:1811640937932288000 + uinfo.role = uinfo.departId === "1811640937932288000"? 2 : 1; + // uinfo.role = uinfo.departFullName.indexOf('京东方科技集团股份有限公司')!=-1?1:2 + //if(uinfo.name === '尹晓钦') uinfo.role = 2 + // console.log('uinfo::',uinfo) state.info = uinfo }, SET_PERMISSIONS: (state, permissions) => {