|
|
|
|
@ -27,6 +27,7 @@ router.beforeEach((to, from, next) => { |
|
|
|
|
next({ path: '/newlogin' }) |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
console.log('登录重新刷新======',to,from) |
|
|
|
|
const value = to.query.src || to.fullPath; |
|
|
|
|
const label = to.query.name || to.name; |
|
|
|
|
const meta = to.meta || router.$avueRouter.meta || {}; |
|
|
|
|
@ -54,13 +55,13 @@ router.beforeEach((to, from, next) => { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
console.log('nologin===permission===========', to,from) |
|
|
|
|
// console.log('nologin===permission===========', to,from)
|
|
|
|
|
const ssotoken = to.query.SSOToken; |
|
|
|
|
if (process.env.NODE_ENV == "production" && to.path != '/newlogin') { |
|
|
|
|
if (process.env.NODE_ENV == "production" && to.path != '/newlogin' && to.path != '/login' && to.path != '/') { |
|
|
|
|
//过滤ssotoken重新拼接回调地址
|
|
|
|
|
let newQuery = JSON.parse(JSON.stringify(to.query)); |
|
|
|
|
delete newQuery.SSOToken; |
|
|
|
|
let fallbackUrl = window.location.href.substring(0, window.location.href.indexOf("?")); |
|
|
|
|
let fallbackUrl = window.location.href.indexOf("?") > -1 ? window.location.href.substring(0, window.location.href.indexOf("?")) : window.location.href; |
|
|
|
|
let keys = Object.keys(newQuery); |
|
|
|
|
for (let i = 0; i < keys.length; i++) { |
|
|
|
|
if (i === 0) { |
|
|
|
|
@ -70,13 +71,30 @@ router.beforeEach((to, from, next) => { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// alert(fallbackUrl)
|
|
|
|
|
// router.replace({path: fallbackUrl})
|
|
|
|
|
// let loginForm = {
|
|
|
|
|
// "tenantId": "000000",
|
|
|
|
|
// "deptId": "",
|
|
|
|
|
// "roleId": "",
|
|
|
|
|
// "username": "admin",
|
|
|
|
|
// "password": "admin",
|
|
|
|
|
// "type": "account",
|
|
|
|
|
// "code": "",
|
|
|
|
|
// "key": "",
|
|
|
|
|
// "image": "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
|
|
|
|
|
// }
|
|
|
|
|
// store.dispatch("LoginByUsername",loginForm).then(() => {
|
|
|
|
|
// const src = fallbackUrl.substring(fallbackUrl.indexOf('#/')+1);
|
|
|
|
|
// router.replace({path:'/wel/index',query:{redirect:src}})
|
|
|
|
|
// })
|
|
|
|
|
store.dispatch("LoginBySso", { SSOToken: ssotoken, grantType: 'yawei', fallbackUrl: fallbackUrl }) |
|
|
|
|
.then(() => { |
|
|
|
|
// alert("登录成功1")
|
|
|
|
|
// this.loading = false;
|
|
|
|
|
console.log('=============登录成功') |
|
|
|
|
router.replace({ path: fallbackUrl }) |
|
|
|
|
const src = fallbackUrl.substring(fallbackUrl.indexOf('#/')+1); |
|
|
|
|
router.replace({path:'/wel/index',query:{redirect:src}}) |
|
|
|
|
}, err => { |
|
|
|
|
// alert(JSON.stringify(err))
|
|
|
|
|
// this.loading = false;
|
|
|
|
|
console.log('err=======res', err) |
|
|
|
|
if (err.error == 'invalid_request') { |
|
|
|
|
|