diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index b457217..4d40dbf 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -94,7 +94,7 @@ export default { async logout() { this.$modal.confirm('确定注销并退出系统吗?', '提示').then(() => { this.$store.dispatch('LogOut').then(() => { - location.href = getPath('/index'); + this.$router.push({ path: 'login' }) }) }).catch(() => {}); } diff --git a/src/utils/request.js b/src/utils/request.js index 89cd58b..675b7f6 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -226,7 +226,7 @@ function handleAuthorized() { ).then(() => { isRelogin.show = false; store.dispatch('LogOut').then(() => { - location.href = getPath('/index'); + this.$router.push({ path: 'login' }) }) }).catch(() => { isRelogin.show = false; diff --git a/src/views/login.vue b/src/views/login.vue index 907bf84..e6e3a69 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -248,7 +248,7 @@ export default { // 发起登陆 // console.log("发起登录", this.loginForm); this.$store.dispatch(this.loginForm.loginType === "sms" ? "SmsLogin" : "Login", this.loginForm).then(() => { - this.$router.push({ path: this.redirect || "/" }).catch(() => { + this.$router.push({ path: "/" }).catch(() => { }); }).catch(() => { this.loading = false;