mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/student-h5.git
synced 2025-12-10 11:26:48 +08:00
init 登录跳转
This commit is contained in:
@@ -18,8 +18,11 @@ const router = createRouter({
|
||||
})
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (!getCookie('token')) {
|
||||
to.path.includes('/login') ? next() : next({path: '/login', query: {returnUrl: to.fullPath}})
|
||||
return
|
||||
if (import.meta.env.MODE === "development" || import.meta.env.MODE === "test") {
|
||||
to.path.includes('/login') ? next() : next({path: '/login', query: {returnUrl: to.fullPath}})
|
||||
}else {
|
||||
window.location.href = import.meta.env.VITE_BASE_LOGIN_URL + import.meta.env.VITE_BASE+to.fullPath
|
||||
}
|
||||
}
|
||||
next()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user