diff --git a/src/router/index.js b/src/router/index.js index 31f9581..7884067 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,18 +1,6 @@ -<<<<<<< HEAD -/* - * @Author: 李晓鸽 lixg@dongwu-inc.com - * @Date: 2022-11-21 18:45:34 - * @LastEditors: 李晓鸽 lixg@dongwu-inc.com - * @LastEditTime: 2022-11-21 18:47:43 - * @FilePath: \stu_h5\src\router\index.js - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - */ -import { createRouter, createWebHashHistory } from 'vue-router'; -======= -import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router'; ->>>>>>> origin/develop +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 = [ @@ -25,23 +13,18 @@ const routes = [ ] const router = createRouter({ -<<<<<<< HEAD - history: createWebHashHistory("/student-h5/"), - routes -======= history: createWebHistory(import.meta.env.VITE_BASE), routes }) 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() ->>>>>>> origin/develop }) export default router \ No newline at end of file