feat:合并

This commit is contained in:
lixg
2023-01-18 10:00:49 +08:00
2 changed files with 10 additions and 22 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

View File

@@ -1,20 +1,15 @@
<<<<<<< HEAD
/* /*
* @Author: 李晓鸽 lixg@dongwu-inc.com * @Author: lixg lixg@dongwu-inc.com
* @Date: 2022-11-21 18:45:34 * @Date: 2023-01-18 09:59:12
* @LastEditors: 李晓鸽 lixg@dongwu-inc.com * @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2022-11-21 18:47:43 * @LastEditTime: 2023-01-18 10:00:36
* @FilePath: \stu_h5\src\router\index.js * @FilePath: /stu_h5/src/router/index.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @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';
=======
import {createRouter, createWebHashHistory, createWebHistory} from 'vue-router';
>>>>>>> origin/develop
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: '/',
@@ -23,25 +18,18 @@ const routes = [
}, },
...routesConfig ...routesConfig
] ]
const router = createRouter({ const router = createRouter({
<<<<<<< HEAD
history: createWebHashHistory("/student-h5/"),
routes
=======
history: createWebHistory(import.meta.env.VITE_BASE), history: createWebHistory(import.meta.env.VITE_BASE),
routes routes
}) })
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()
>>>>>>> origin/develop
}) })
export default router export default router