|
@@ -18,7 +18,7 @@ const routes = [
|
|
|
]
|
|
|
|
|
|
const router = createRouter({
|
|
|
- history: createWebHistory(),
|
|
|
+ history: createWebHistory(import.meta.env.BASE_URL),
|
|
|
routes,
|
|
|
});
|
|
|
|
|
@@ -39,7 +39,7 @@ router.beforeEach((to, from , next) => {
|
|
|
}
|
|
|
document.title = to.meta?.title || ThemeStore.title || import.meta.env.VITE_TITLE
|
|
|
next()
|
|
|
- } else if (to.path === '/login') {
|
|
|
+ } else if (to.path === `/login`) {
|
|
|
next()
|
|
|
} else {
|
|
|
ElMessage.error('用户信息获取失败!')
|
|
@@ -67,7 +67,7 @@ export const initMainRouter = async () => {
|
|
|
themeConfig = theme.data.themeStyle ? JSON.parse(theme.data.themeStyle) : {}
|
|
|
loading.close()
|
|
|
})
|
|
|
- } else if (location.pathname !== '/login') {
|
|
|
+ } else if (location.pathname !== `/${import.meta.env.VITE_BASE}/login`) {
|
|
|
toLogin()
|
|
|
}
|
|
|
}
|