|
|
|
@ -76,14 +76,21 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
} else {
|
|
|
|
|
// 没有token
|
|
|
|
|
if(window.location.href.includes('?code')){
|
|
|
|
|
// console.log(window.location.href)
|
|
|
|
|
var reg = new RegExp(/[?&]code=([^&#]+)/)
|
|
|
|
|
var r = window.location.href.match(reg)
|
|
|
|
|
// console.log('有code')
|
|
|
|
|
const code = window.location.href.split("?")[1].split('=')[1];
|
|
|
|
|
// const code = window.location.href.split("?")[1].split('=')[1];
|
|
|
|
|
const code = r && r[1]
|
|
|
|
|
// console.log(code)
|
|
|
|
|
getUseInfo({code:code}).then(user=>{
|
|
|
|
|
console.log(user,'用户信息')
|
|
|
|
|
localStorage.setItem('isGovernmentAffairsNetwork','1')
|
|
|
|
|
store.dispatch('LoginNoCaptcha',{username:'admin',password:'admin@123Jichuang'}).then((res) => {
|
|
|
|
|
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'
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
// console.log('没code')
|
|
|
|
@ -97,7 +104,7 @@ router.beforeEach((to, from, next) => {
|
|
|
|
|
} else {
|
|
|
|
|
console.log('路由拦截跳转登录页')
|
|
|
|
|
// next()
|
|
|
|
|
location.href = 'http://180.108.205.123:8090/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'
|
|
|
|
|
}
|
|
|
|
|
NProgress.done()
|
|
|
|
|
}
|
|
|
|
|