feat : 测试sso单点登录之后的重定向路径4
This commit is contained in:
@@ -188,7 +188,12 @@ router.beforeEach(async (to, form, next) => {
|
||||
next()
|
||||
NProgress.done()
|
||||
} else {
|
||||
sessionStorage.setItem('toView', JSON.stringify(to))
|
||||
let path = window.location.pathname;
|
||||
let query = window.location.search
|
||||
sessionStorage.setItem('toView', JSON.stringify({
|
||||
path: path,
|
||||
query: query
|
||||
}))
|
||||
window.location.href = `${window.location.origin}/api/auth/cas/login`
|
||||
// next({path: '/api/auth/cas/login'})
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ serveice.interceptors.response.use(response => {
|
||||
if (response.request.responseType === 'blob' || response.request.responseType === 'arraybuffer') {
|
||||
return response.data
|
||||
}
|
||||
console.log("windows", window.location.pathname)
|
||||
console.log("window.location.pathname", window.location.pathname)
|
||||
console.log("windows", window.location.search)
|
||||
return response.data
|
||||
}, error => {
|
||||
let response = error.response
|
||||
@@ -43,8 +44,13 @@ serveice.interceptors.response.use(response => {
|
||||
closeOnClickModal: false
|
||||
}).then(() => {
|
||||
removeToken()
|
||||
sessionStorage.setItem('toView', window.location.pathname)
|
||||
window.location = '/api/auth/cas/login'
|
||||
let path = window.location.pathname;
|
||||
let query = window.location.search
|
||||
sessionStorage.setItem('toView', JSON.stringify({
|
||||
path: path,
|
||||
query: query
|
||||
}))
|
||||
window.location.href = `${window.location.origin}/api/auth/cas/login`
|
||||
})
|
||||
return Promise.reject('会话已过期,请重新登录')
|
||||
case 402:
|
||||
|
||||
@@ -15,9 +15,16 @@ const init = () => {
|
||||
})
|
||||
if (authStore.casToken(tokenValue)) {
|
||||
loading.close()
|
||||
const toView = sessionStorage.getItem('toView')
|
||||
console.log(toView, 'toView');
|
||||
if (toView) {
|
||||
let parse = JSON.parse(toView);
|
||||
window.location.href = window.location.origin + parse.path + parse.query
|
||||
} else {
|
||||
router.push('/')
|
||||
}
|
||||
}
|
||||
}
|
||||
init()
|
||||
</script>
|
||||
|
||||
|
||||
@@ -178,11 +178,12 @@ const init = () => {
|
||||
const redirectView = () => {
|
||||
const toView = sessionStorage.getItem('toView')
|
||||
console.log(toView, 'toView');
|
||||
let jsonView = JSON.parse(toView)
|
||||
toView ?
|
||||
router.push({
|
||||
path: JSON.parse(toView).path,
|
||||
path: jsonView.path,
|
||||
query: {
|
||||
...JSON.parse(toView).query
|
||||
...jsonView.query
|
||||
}
|
||||
}) :
|
||||
null
|
||||
@@ -242,12 +243,14 @@ window.addEventListener('resize', () => {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.statistics {
|
||||
//display: flex;
|
||||
.block {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.container {
|
||||
height: calc((100vh / 2) - 150px);
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user