1
This commit is contained in:
@@ -86,7 +86,7 @@ export default {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$store.dispatch('LogOut').then(() => {
|
||||
location.href = '/index'
|
||||
this.$router.push('/login')
|
||||
})
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user