This commit is contained in:
Leo
2026-01-19 14:11:26 +08:00
parent d8e71d9bf2
commit 5118598d83
2 changed files with 11 additions and 4 deletions

View File

@@ -86,7 +86,7 @@ export default {
type: 'warning'
}).then(() => {
this.$store.dispatch('LogOut').then(() => {
location.href = '/index'
this.$router.push('/login')
})
}).catch(() => {})
}

View File

@@ -144,9 +144,16 @@ export default {
Cookies.remove('rememberMe')
}
this.$store.dispatch("Login", this.loginForm).then(() => {
// 使用 replace 而不是 push避免路由历史问题
this.$nextTick(() => {
window.location.href = this.redirect || "/sloworder/index"
// 先获取用户信息和生成路由,然后再跳转
this.$store.dispatch('GetInfo').then(() => {
this.$store.dispatch('GenerateRoutes').then(() => {
// 使用 replace 而不是 push避免路由历史问题
const redirectPath = this.redirect || "/sloworder/index"
this.$router.replace(redirectPath).catch(() => {
// 如果目标路由不存在,跳转到默认路由
this.$router.replace("/sloworder/index")
})
})
})
}).catch(() => {
this.loading = false