Merge branch 'manage-release' of ssh://gitlab.dongwu-inc.com:10022/BOE/stu_h5 into manage-release

This commit is contained in:
wyx
2023-01-18 10:40:46 +08:00
2 changed files with 5 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

View File

@@ -1,8 +1,7 @@
import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router';
import { createRouter, createWebHashHistory, createWebHistory } from 'vue-router';
import routesConfig from './config';
import {getCookie} from "@/api/utils";
import { getCookie } from "@/api/utils";
// console.log('routesConfig', routesConfig)
const routes = [
{
path: '/',
@@ -11,7 +10,6 @@ const routes = [
},
...routesConfig
]
const router = createRouter({
history: createWebHistory(import.meta.env.VITE_BASE),
routes
@@ -19,12 +17,11 @@ const router = createRouter({
router.beforeEach((to, from, next) => {
if (!getCookie('token')) {
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
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()
})
export default router