1
This commit is contained in:
@@ -67,6 +67,8 @@
|
||||
import { getCodeImg } from "@/api/login"
|
||||
import Cookies from "js-cookie"
|
||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||
import store from '@/store'
|
||||
import { firstLeafPathFromSidebarRoutes } from '@/utils/route-nav'
|
||||
|
||||
export default {
|
||||
name: "Login",
|
||||
@@ -147,11 +149,10 @@ export default {
|
||||
// 先获取用户信息和生成路由,然后再跳转
|
||||
this.$store.dispatch('GetInfo').then(() => {
|
||||
this.$store.dispatch('GenerateRoutes').then(() => {
|
||||
// 使用 replace 而不是 push,避免路由历史问题
|
||||
const redirectPath = this.redirect || "/sloworder/index"
|
||||
const fallback = firstLeafPathFromSidebarRoutes(store.getters.sidebarRouters) || '/user/profile'
|
||||
const redirectPath = this.redirect || fallback
|
||||
this.$router.replace(redirectPath).catch(() => {
|
||||
// 如果目标路由不存在,跳转到默认路由
|
||||
this.$router.replace("/sloworder/index")
|
||||
this.$router.replace(fallback)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user