mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/student-h5.git
synced 2025-12-08 18:36:48 +08:00
Merge branch 'manage-release' of ssh://gitlab.dongwu-inc.com:10022/BOE/stu_h5 into manage-release
This commit is contained in:
BIN
src/assets/image/uploadimg.png
Normal file
BIN
src/assets/image/uploadimg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 722 B |
@@ -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
|
||||
Reference in New Issue
Block a user