feat(ui): record the page path when logout

This commit is contained in:
LH_R
2025-08-15 16:09:41 +08:00
parent 290a79860c
commit 56a310c667
2 changed files with 17 additions and 2 deletions

View File

@@ -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
})
})
},

View File

@@ -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