Commit 2087a7e9 by 张建朝

tj

parent 2e2fbe21
Showing with 10 additions and 3 deletions
......@@ -67,8 +67,9 @@ router.beforeEach((to, from, next) => {
router.beforeEach((to, from, next) => {
const authcode = to.query.authCode || to.query.authcode;
const appid = to.query.appId || to.query.appid;
const userId = to.query.userid || to.query.userId||0;
if (!!authcode && !!appid) {
localStorage.setItem('appid', appid);
var toPath = to.path || "/";
for (let key in to.query) {
if (key == 'authcode') {
......@@ -77,16 +78,22 @@ router.beforeEach((to, from, next) => {
toPath += toPath.indexOf("?") > -1 ? "&" : "?";
toPath += `${key}=${to.query[key]}`;
}
const storeAppId = localStorage.getItem('appid');
store.dispatch("getOidcUser").then(oidcUser => {
if (oidcUser) {
if(storeAppId!= appid){
localStorage.setItem('appid',appid);
setAutoLogin({ autoCode: authcode, redirectPath: toPath })
store.dispatch("signOutOidc")
}else{
//如果登录用户与当前登录用户不匹配,则保存登录参数,退出
if (oidcUser.profile.sub != userId) {
if (userId > 0 && oidcUser.profile.sub != userId) {
setAutoLogin({ autoCode: authcode, redirectPath: toPath })
store.dispatch("signOutOidc")
} else {
next()
}
}
} else {
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