Commit 2087a7e9 by 张建朝

tj

parent 2e2fbe21
Showing with 13 additions and 6 deletions
...@@ -67,8 +67,9 @@ router.beforeEach((to, from, next) => { ...@@ -67,8 +67,9 @@ router.beforeEach((to, from, next) => {
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
const authcode = to.query.authCode || to.query.authcode; const authcode = to.query.authCode || to.query.authcode;
const appid = to.query.appId || to.query.appid; const appid = to.query.appId || to.query.appid;
const userId = to.query.userid || to.query.userId||0;
if (!!authcode && !!appid) { if (!!authcode && !!appid) {
localStorage.setItem('appid', appid);
var toPath = to.path || "/"; var toPath = to.path || "/";
for (let key in to.query) { for (let key in to.query) {
if (key == 'authcode') { if (key == 'authcode') {
...@@ -77,15 +78,21 @@ router.beforeEach((to, from, next) => { ...@@ -77,15 +78,21 @@ router.beforeEach((to, from, next) => {
toPath += toPath.indexOf("?") > -1 ? "&" : "?"; toPath += toPath.indexOf("?") > -1 ? "&" : "?";
toPath += `${key}=${to.query[key]}`; toPath += `${key}=${to.query[key]}`;
} }
const storeAppId = localStorage.getItem('appid');
store.dispatch("getOidcUser").then(oidcUser => { store.dispatch("getOidcUser").then(oidcUser => {
if (oidcUser) { if (oidcUser) {
//如果登录用户与当前登录用户不匹配,则保存登录参数,退出 if(storeAppId!= appid){
if (oidcUser.profile.sub != userId) { localStorage.setItem('appid',appid);
setAutoLogin({ autoCode: authcode, redirectPath: toPath }) setAutoLogin({ autoCode: authcode, redirectPath: toPath })
store.dispatch("signOutOidc") store.dispatch("signOutOidc")
} else { }else{
next() //如果登录用户与当前登录用户不匹配,则保存登录参数,退出
if (userId > 0 && oidcUser.profile.sub != userId) {
setAutoLogin({ autoCode: authcode, redirectPath: toPath })
store.dispatch("signOutOidc")
} else {
next()
}
} }
} else { } else {
autoLogin({ autoCode: authcode, redirectPath: toPath }) autoLogin({ autoCode: authcode, redirectPath: toPath })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment