From edf40adb18b54802a9705d1023f77c3ccaa8cd7a Mon Sep 17 00:00:00 2001 From: TiaStars Date: Thu, 12 Oct 2023 09:28:58 +0800 Subject: [PATCH] 9:28 --- src/layout/components/Navbar.vue | 4 ++-- src/layout/newyjLayout.vue | 4 ++-- src/permission.js | 33 ++++---------------------------- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index c2a2265..6d93825 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -145,9 +145,9 @@ export default { let isGovernmentAffairsNetwork = localStorage.getItem('isGovernmentAffairsNetwork') if(process.env.NODE_ENV === "production") { if(isGovernmentAffairsNetwork == '1') { - location.href = process.env.VUE_APP_LOCATION + '/sso-server/oauth2/login?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' + location.href = process.env.VUE_APP_LOCATION + '/sso-server/oauth2/login?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code' } else { - location.href = "/" + location.href = "/login" } } else { location.href = "/" diff --git a/src/layout/newyjLayout.vue b/src/layout/newyjLayout.vue index 6514167..d169905 100644 --- a/src/layout/newyjLayout.vue +++ b/src/layout/newyjLayout.vue @@ -120,9 +120,9 @@ export default { console.log('production') if(isGovernmentAffairsNetwork == '1') { console.log('进入跳转政务网的登录页') - location.href = process.env.VUE_APP_LOCATION + '/sso-server/oauth2/login?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' + location.href = process.env.VUE_APP_LOCATION + '/sso-server/oauth2/login?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code' } else { - location.href = "/" + location.href = "/login" } } else { location.href = "/" diff --git a/src/permission.js b/src/permission.js index 595d056..e56ba21 100644 --- a/src/permission.js +++ b/src/permission.js @@ -13,26 +13,6 @@ const whiteList = ['/login', '/register'] router.beforeEach((to, from, next) => { NProgress.start() - // window.location.href = 'http://localhost:80/?code=4581bffa1e8b4d9eb1f92e3250bea1cf' - // if(getCode()){ - // next() - // } else { - // // const params = new URLSearchParams(location.search); - // //最后结果想获取那个参数直接get - // // const code = params.get("code") - // let url = window.location.href - // var splitted = url.split("?"); - // var paramPart = splitted[1].split("#")[0]; - // var paramArray = paramPart.split("="); - // // var paramName = paramArray[0]; - // const code = paramArray[1]; - // setCode(code) - // console.log(code,'code') - // getUseInfo({code}).then(user=>{ - // console.log(user,'用户信息') - // next() - // }) - // } if (getToken()) { to.meta.title && store.dispatch('settings/setTitle', to.meta.title) /* has token*/ @@ -90,22 +70,17 @@ router.beforeEach((to, from, next) => { next('/home') }) }).catch(err=>{ - location.href = process.env.VUE_APP_LOCATION + '/sso-server/oauth2/login?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' + location.href = process.env.VUE_APP_LOCATION + '/sso-server/oauth2/login?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code' }) } else { // console.log('没code') + // location.href = process.env.VUE_APP_LOCATION + '/sso-server/oauth2/login?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' if (whiteList.indexOf(to.path) !== -1) { // 在免登录白名单,直接进入 next() + NProgress.done() } else { - let isGovernmentAffairsNetwork = localStorage.getItem('isGovernmentAffairsNetwork') - if(isGovernmentAffairsNetwork !== '1') { - next(`/login`) // 否则全部重定向到登录页 - } else { - console.log('路由拦截跳转登录页') - // next() - location.href = process.env.VUE_APP_LOCATION + '/sso-server/oauth2/login?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F' - } + location.href = process.env.VUE_APP_LOCATION + '/sso-server/oauth2/login?aid=17847210&cbu=http%3A%2F%2F180.108.205.123%3A13001%2F&response_type=code' NProgress.done() } }