mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/student-h5.git
synced 2025-12-09 10:56:47 +08:00
feat:增加直播外链评估等
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
const routes = [];
|
||||
const context = require.context('@/views', true, /\.vue$/, 'lazy');
|
||||
context.keys().forEach(path => {
|
||||
// console.log('path', path)
|
||||
const context =import.meta.glob("../views/*/*.vue", {eager: true})
|
||||
Object.keys(context).forEach(path => {
|
||||
const componentName = path.replace(/.*\/([^\\.\\/]*)\.vue$/, '$1');
|
||||
routes.push({
|
||||
path: `/${componentName.toLowerCase()}`,
|
||||
name: componentName,
|
||||
component: () => context(path),
|
||||
component: context[path].default,
|
||||
meta: {
|
||||
isLink: true
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
export default routes;
|
||||
@@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
/*
|
||||
* @Author: 李晓鸽 lixg@dongwu-inc.com
|
||||
* @Date: 2022-11-21 18:45:34
|
||||
@@ -7,21 +8,40 @@
|
||||
* @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 routesConfig from './config';
|
||||
import {getCookie} from "@/api/utils";
|
||||
// console.log('routesConfig', routesConfig)
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: '首页',
|
||||
redirect: routesConfig[0].path
|
||||
},
|
||||
...routesConfig
|
||||
{
|
||||
path: '/',
|
||||
name: '首页',
|
||||
redirect: routesConfig[0].path
|
||||
},
|
||||
...routesConfig
|
||||
]
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
next()
|
||||
>>>>>>> origin/develop
|
||||
})
|
||||
|
||||
export default router
|
||||
Reference in New Issue
Block a user