zhangtao
吕天方 1 year ago
parent 06eeff205e
commit edf40adb18

@ -145,9 +145,9 @@ export default {
let isGovernmentAffairsNetwork = localStorage.getItem('isGovernmentAffairsNetwork') let isGovernmentAffairsNetwork = localStorage.getItem('isGovernmentAffairsNetwork')
if(process.env.NODE_ENV === "production") { if(process.env.NODE_ENV === "production") {
if(isGovernmentAffairsNetwork == '1') { 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 { } else {
location.href = "/" location.href = "/login"
} }
} else { } else {
location.href = "/" location.href = "/"

@ -120,9 +120,9 @@ export default {
console.log('production') console.log('production')
if(isGovernmentAffairsNetwork == '1') { if(isGovernmentAffairsNetwork == '1') {
console.log('进入跳转政务网的登录页') 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 { } else {
location.href = "/" location.href = "/login"
} }
} else { } else {
location.href = "/" location.href = "/"

@ -13,26 +13,6 @@ const whiteList = ['/login', '/register']
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start() 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()) { if (getToken()) {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title) to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/ /* has token*/
@ -90,22 +70,17 @@ router.beforeEach((to, from, next) => {
next('/home') next('/home')
}) })
}).catch(err=>{ }).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 { } else {
// console.log('没code') // 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) { if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入 // 在免登录白名单,直接进入
next() next()
NProgress.done()
} else { } else {
let isGovernmentAffairsNetwork = localStorage.getItem('isGovernmentAffairsNetwork') 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'
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'
}
NProgress.done() NProgress.done()
} }
} }

Loading…
Cancel
Save