From d5144abc2189daf103d3883d5d05de5a0ce63401 Mon Sep 17 00:00:00 2001 From: lixg Date: Wed, 18 Jan 2023 10:01:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) 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