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) => {