mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/student-h5.git
synced 2025-12-09 10:56:47 +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 routesConfig from './config';
|
||||||
import {getCookie} from "@/api/utils";
|
import { getCookie } from "@/api/utils";
|
||||||
// console.log('routesConfig', routesConfig)
|
// console.log('routesConfig', routesConfig)
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
@@ -11,7 +10,6 @@ const routes = [
|
|||||||
},
|
},
|
||||||
...routesConfig
|
...routesConfig
|
||||||
]
|
]
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(import.meta.env.VITE_BASE),
|
history: createWebHistory(import.meta.env.VITE_BASE),
|
||||||
routes
|
routes
|
||||||
@@ -19,12 +17,11 @@ const router = createRouter({
|
|||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
if (!getCookie('token')) {
|
if (!getCookie('token')) {
|
||||||
if (import.meta.env.MODE === "development" || import.meta.env.MODE === "test") {
|
if (import.meta.env.MODE === "development" || import.meta.env.MODE === "test") {
|
||||||
to.path.includes('/login') ? next() : next({path: '/login', query: {returnUrl: to.fullPath}})
|
to.path.includes('/login') ? next() : next({ path: '/login', query: { returnUrl: to.fullPath } })
|
||||||
}else {
|
} else {
|
||||||
window.location.href = import.meta.env.VITE_BASE_LOGIN_URL + import.meta.env.VITE_BASE+to.fullPath
|
window.location.href = import.meta.env.VITE_BASE_LOGIN_URL + import.meta.env.VITE_BASE + to.fullPath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
|
||||||
export default router
|
export default router
|
||||||
Reference in New Issue
Block a user