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