init 登录跳转

This commit is contained in:
yuping
2023-01-16 14:40:02 +08:00
parent 48411ddfff
commit 7b26e62787
2 changed files with 6 additions and 3 deletions

View File

@@ -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()
})

View File

@@ -61,7 +61,7 @@ const returnclick = () => {
};
const form = ref({
account: "00004409",
account: "10181457",
password: "1234567890Aa",
});