This commit is contained in:
雷欧(林平凡)
2025-09-19 17:14:04 +08:00
parent e060b235dc
commit 983b773a9c
2 changed files with 10 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ router.beforeEach((to, from, next) => {
to.meta.title && store.dispatch('settings/setTitle', to.meta.title) to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/ /* has token*/
if (to.path === '/login') { if (to.path === '/login') {
next({ path: '/sloworder/index' }) next({ path: '/user/profile' })
NProgress.done() NProgress.done()
} else if (isWhiteList(to.path)) { } else if (isWhiteList(to.path)) {
next() next()
@@ -39,7 +39,7 @@ router.beforeEach((to, from, next) => {
}).catch(err => { }).catch(err => {
store.dispatch('LogOut').then(() => { store.dispatch('LogOut').then(() => {
Message.error(err) Message.error(err)
next({ path: '/sloworder/index' }) next({ path: '/user/profile' })
}) })
}) })
} else { } else {

View File

@@ -142,7 +142,14 @@ export default {
Cookies.remove('rememberMe') Cookies.remove('rememberMe')
} }
this.$store.dispatch("Login", this.loginForm).then(() => { this.$store.dispatch("Login", this.loginForm).then(() => {
// 获取用户信息和生成路由后再跳转
this.$store.dispatch('GetInfo').then(() => {
this.$store.dispatch('GenerateRoutes').then(() => {
this.$router.push({ path: this.redirect || "/sloworder/index" }).catch(()=>{}) this.$router.push({ path: this.redirect || "/sloworder/index" }).catch(()=>{})
})
}).catch(() => {
this.$router.push({ path: this.redirect || "/user/profile" }).catch(()=>{})
})
}).catch(() => { }).catch(() => {
this.loading = false this.loading = false
if (this.captchaEnabled) { if (this.captchaEnabled) {