You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

282 lines
8.2 KiB
JavaScript

import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
/* Layout */
import Layout from '@/layout'
import Auth from '@/components/oauth'
/**
* Note: sub-menu only appear when route children.length >= 1
* Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
*
* hidden: true if set true, item will not show in the sidebar(default is false)
* alwaysShow: true if set true, will always show the root menu
* if not set alwaysShow, when item has more than one children route,
* it will becomes nested mode, otherwise not show the root menu
* redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
* name:'router-name' the name is used by <keep-alive> (must set!!!)
* meta : {
roles: ['admin','editor'] control the page roles (you can set multiple roles)
title: 'title' the name show in sidebar and breadcrumb (recommend set)
icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
breadcrumb: false if set false, the item will hidden in breadcrumb(default is true)
activeMenu: '/example/list' if set path, the sidebar will highlight the path you set
}
*/
/**
* constantRoutes
* a base page that does not have permission requirements
* all roles can be accessed
*/
export const constantRoutes = [
{
path: '/login',
component: () => import('@/views/login/index'),
hidden: true
},
{
path: 'server',
component: ()=>import('@/views/login/auth'),
hidden: true
},
{
path: '/404',
component: () => import('@/views/404'),
hidden: true
},
{
path: '/index',
component: Auth,
hidden: true
},
{
path: '/',
component: Layout,
name: 'index',
children: [{
path: '/dashboard',
component: () => import('@/views/dashboard/index'),
meta: { title: '首页', icon: 'dashboard' }
}]
},
{
path: '/user',
component: Layout,
name: 'User',
meta: { title: '用户管理', icon: 'user_manage' },
redirect: '/user/list',
children: [
{
path: 'list',
name: 'List',
component: () => import('@/views/table/index'),
meta: { title: '用户列表', icon: 'user_list' }
},
// {
// path: 'create',
// name: 'Create',
// component: () => import('@/views/table/create'),
// meta: { title: '新增用户', icon: 'add_user' }
// },
// {
// path: 'batch',
// name: 'Batch',
// component: () => import('@/views/table/batch'),
// meta: { title: '批量导入', icon: 'batch_insert' }
// },
// {
// path: 'grade',
// name: '',
// component: ()=>import('@/views/manager/grade'),
// meta: {
// title: '班级管理',
// icon: 'grade_info'
// }
// }
]
},
{
path: '/competition',
component: Layout,
meta: { title: '大赛管理', icon: 'competition' },
redirect: '/competition/list',
children: [
{
path: 'list',
name: 'list',
component: () => import('@/views/competition/index'),
meta: { title: '大赛列表', icon: 'dasai2' }
},
{
path: 'create',
name: 'create',
component: () => import('@/views/competition/create'),
meta: { title: '新建大赛', icon: 'dasai' }
},
{
path: 'edit',
name: 'Edit',
component: () => import('@/views/competition/create')
},
{
path: 'teamimport',
name: 'teamimprort',
component: () => import('@/views/competition/memberlog'),
meta: { title: '活跃会员日志', icon: 'dasai' }
},
{
path: 'ranking',
name: 'ranking',
component: ()=> import('@/views/competition/components/ranking')
}
]
},
{
path: '/resource',
component: Layout,
name: 'Resource',
redirect: '/resource/course/list',
meta: {
title: '资源管理',
icon: 'meta_manage'
},
children: [
{
path: 'course',
name: 'course',
meta: { title: '课程配置', icon: 'course' },
redirect: '/resource/course/list',
component: () => import('@/views/resource/course/index'),
children: [
{
path: 'list',
name: 'List',
component: () => import('@/views/resource/course/list'),
meta: { title: '课程列表', icon: 'course_list' },
},
{
path: 'add',
component: () => import('@/views/resource/course/add/index'),
name: 'Add',
meta: { title: '新增课程', icon: 'course_add'}
},
{
path: 'cat',
component: () => import('@/views/resource/course/category/list'),
name: 'CatList',
meta: { title: '课程分类管理', icon: 'course_cat'}
},
{
path: 'tag',
component: () => import('@/views/resource/course/tag/list'),
name: 'TagList',
meta: { title: '课程标签管理', icon: 'tag'}
}
]
},
{
path: 'exam',
component: () => import('@/views/resource/exam/index'),
name: 'exam',
meta: { title: '客观题管理', icon: 'exam_normal'},
redirect: '/resource/exam/list',
children: [
{
path: 'list',
name: 'List',
component: () => import('@/views/resource/exam/list'),
meta: { title: '试题列表', icon: 'question'}
},
{
path: 'add',
name: 'Add',
component: () => import('@/views/resource/exam/add/index'),
meta: {title: '新增题目', icon: 'add_question'}
},
{
path: 'edit',
name: 'Edit',
component: () => import('@/views/resource/exam/add/edit')
},
{
path: 'batch',
name: 'Batch',
component: () => import('@/views/resource/exam/add/batch'),
meta: {title: '批量导入', icon: 'batch_add'}
}
]
},
{
path: 'anli',
component: () => import('@/views/resource/anli/index'),
name: 'anli',
meta: { title: '案例题管理', icon :'anli'},
children: [
{
path: 'list',
name: "List",
component: () => import('@/views/resource/anli/anliList'),
meta: { title: '案例题列表', icon: 'anli_list'}
},
{
path: 'add',
name: 'Add',
component: () => import('@/views/resource/anli/add/anli'),
meta: { title: '新增竞赛案例', icon: 'anli_add'}
},
{
path: 'edit',
name: 'Edit',
component: () => import('@/views/resource/anli/add/edit')
}
]
}
]
},
{
path: '/manager',
name: 'Admin',
component: Layout,
meta: { title: '系统管理', icon: 'secure' },
children: [{
path: 'list',
component: () => import('@/views/manager/index'),
meta: {title: '管理员列表' , icon: 'admin-fill' }
},{
path: 'province',
component: () => import('@/views/manager/province'),
meta: {title: '省份管理', icon: 'province'}
},{
path: 'level',
component: () => import('@/views/manager/level'),
meta: {title: '学生层次管理', icon: 'level_manager'}
},{
path: 'school',
component: () => import('@/views/manager/school'),
meta: {title: '学校管理', icon: 'level_manager'}
}]
},
// 404 page must be placed at the end !!!
{ path: '*', redirect: '/404', hidden: true }
]
const createRouter = () => new Router({
// mode: 'history', // require service support
scrollBehavior: () => ({ y: 0 }),
routes: constantRoutes
})
const router = createRouter()
// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
const newRouter = createRouter()
router.matcher = newRouter.matcher // reset router
}
export default router