From 983b773a9cb773b7a9f355d7586eb19ec8daa388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E6=AC=A7=EF=BC=88=E6=9E=97=E5=B9=B3=E5=87=A1?= =?UTF-8?q?=EF=BC=89?= Date: Fri, 19 Sep 2025 17:14:04 +0800 Subject: [PATCH] 1 --- src/permission.js | 4 ++-- src/views/login.vue | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/permission.js b/src/permission.js index 5a345e7..f0ee3f1 100644 --- a/src/permission.js +++ b/src/permission.js @@ -21,7 +21,7 @@ router.beforeEach((to, from, next) => { to.meta.title && store.dispatch('settings/setTitle', to.meta.title) /* has token*/ if (to.path === '/login') { - next({ path: '/sloworder/index' }) + next({ path: '/user/profile' }) NProgress.done() } else if (isWhiteList(to.path)) { next() @@ -39,7 +39,7 @@ router.beforeEach((to, from, next) => { }).catch(err => { store.dispatch('LogOut').then(() => { Message.error(err) - next({ path: '/sloworder/index' }) + next({ path: '/user/profile' }) }) }) } else { diff --git a/src/views/login.vue b/src/views/login.vue index c86ed67..eb5ae72 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -142,7 +142,14 @@ export default { Cookies.remove('rememberMe') } this.$store.dispatch("Login", this.loginForm).then(() => { - this.$router.push({ path: this.redirect || "/sloworder/index" }).catch(()=>{}) + // 获取用户信息和生成路由后再跳转 + this.$store.dispatch('GetInfo').then(() => { + this.$store.dispatch('GenerateRoutes').then(() => { + this.$router.push({ path: this.redirect || "/sloworder/index" }).catch(()=>{}) + }) + }).catch(() => { + this.$router.push({ path: this.redirect || "/user/profile" }).catch(()=>{}) + }) }).catch(() => { this.loading = false if (this.captchaEnabled) {