diff --git a/cmdb-ui/src/store/global/user.js b/cmdb-ui/src/store/global/user.js index 914682b..0285660 100644 --- a/cmdb-ui/src/store/global/user.js +++ b/cmdb-ui/src/store/global/user.js @@ -184,7 +184,16 @@ const user = { }).catch(() => { resolve() }).finally(() => { - window.location.href = '/user/logout' + let logoutURL = '/user/logout' + const fullPath = window.location.pathname + window.location.search + if ( + fullPath && + fullPath !== '/' + ) { + logoutURL += `?redirect=${fullPath}` + } + + window.location.href = logoutURL }) }) }, diff --git a/cmdb-ui/src/views/user/Logout.vue b/cmdb-ui/src/views/user/Logout.vue index 2fff238..d2a75cb 100644 --- a/cmdb-ui/src/views/user/Logout.vue +++ b/cmdb-ui/src/views/user/Logout.vue @@ -64,7 +64,13 @@ export default { await this.GetAuthDataEnable() this.loading = false if (!this._enable_list.length || this._enable_list.length > 1) { - this.$router.push('/user/login') + let loginURL = '/user/login' + const redirect = this.$route?.query?.redirect + if (redirect) { + loginURL += `?redirect=${redirect}` + } + + this.$router.push(loginURL) } if (this.auth_auto_redirect) { this.time = 0