import Vue from "vue" import Router from "vue-router" import Login from "@/views/login/index" import Layout from "@/views/layout/layout" import HomeMain from "@/views/index/mainIndex" // 不是必须加载的组件使用懒加载 const NotFound = () => import("@/views/page404") const ExaminationPaper = () => import("@/views/examinationPaper/index") const ExaminationPaperAdd = () => import("@/views/examinationPaper/add") const ExaminationPaperAddAsk = () => import("@/views/examinationPaper/addAsk") const ExaminationPaperEdit = () => import("@/views/examinationPaper/edit") const ExaminationPaperRecycle = () => import("@/views/examinationPaper/recycle") const ExaminationPaperArchiving = () => import("@/views/examinationPaper/archiving") const Portrait = () => import("@/views/portrait/index") const PortraitDetail = () => import("@/views/portrait/detail") const Ask = () => import("@/views/basic/ask/index") const AskList = () => import("@/views/basic/ask/list") const AskAnalysis = () => import("@/views/basic/ask/analysis") const AskArchiving = () => import("@/views/basic/ask/archiving") const Test = () => import("@/views/basic/test/index") const TestAnalysis = () => import("@/views/basic/test/analysis") const TestArchiving = () => import("@/views/basic/test/archiving") const DataSync = () => import("@/views/basic/dataSync/index") const Card = () => import("@/views/basic/card/index") const Analysis = () => import("@/views/basic/analysis/index") const Device = () => import("@/views/basic/device/index") const DeviceLog = () => import("@/views/basic/device/log") const Down = () => import("@/views/basic/down/index") const DownClient = () => import("@/views/basic/down/client") const SetUpAccount = () => import("@/views/basic/setUp/account") const SetUpConglomerate = () => import("@/views/basic/setUp/conglomerate") const SetUpSchool = () => import("@/views/basic/setUp/school") const SetUpTeacher = () => import("@/views/basic/setUp/teacher") const SetUpStudent = () => import("@/views/basic/setUp/student") const ArchivedClazz = () => import("@/views/basic/setUp/archivedClazz") const UserInfo = () => import("@/views/basic/userInfo/index") // 个人版 // const PersonalAsk = () => import("@/views/personal/ask/index") // const PersonalAskAnalysis = () => import("@/views/personal/ask/analysis") // const PersonalArchiving = () => import("@/views/personal/ask/archiving") // const PersonalTest = () => import("@/views/personal/test/index") // const PersonalTestAnalysis = () => import("@/views/personal/test/analysis") // const PersonalTestArchiving = () => import("@/views/personal/test/archiving") // const PersonalDataSync = () => import("@/views/personal/dataSync/index") // const PersonalSetUpStudent = () => import("@/views/personal/setUp/student") // const PersonalDown = () => import("@/views/personal/down/index") // const PersonalUserInfo = () => import("@/views/personal/userInfo/index") // 超级管理员 const AdminDevice = () => import("@/views/admin/device/index") const AdminDeviceLog = () => import("@/views/admin/device/log") const AdminAccount = () => import("@/views/admin/account/index") const AdminClientVersion = () => import("@/views/admin/clientVersion/index") /** * v1.4 */ const SetUpClazz = () => import("@/views/basic/setUp/clazz") const Archived = () => import("@/views/basic/setUp/archived") const DeviceError = () => import("@/views/basic/device/error") /** * 重写路由的push方法 */ const routerPush = Router.prototype.push Router.prototype.push = function push(location) { return routerPush.call(this, location).catch(error => error) } Vue.use(Router) let defaultRouter = [ { path: "/", redirect: "/index", hidden: true, children: [] }, { path: "/login", component: Login, name: "登录", hidden: true, children: [] }, { path: "/index", iconCls: "fa fa-home", // 图标样式class name: "应用首页", component: Layout, alone: true, children: [ { path: "/index", iconCls: "fa fa-dashboard", // 图标样式class name: "主页", component: HomeMain, children: [] } ] }, { path: "/deviceError", iconCls: "fa fa-home", // 图标样式class name: "异常设备信息", component: Layout, hidden: true, children: [ { path: "/deviceError", name: "异常设备信息", component: DeviceError, hidden: true } ] }, { path: "/userInfo", iconCls: "fa fa-user", // 图标样式class name: "个人信息", component: Layout, hidden: true, children: [ { path: "/userInfo", iconCls: "fa fa-user", // 图标样式class name: "个人信息", component: UserInfo, children: [] } ] }, { path: "/404", component: NotFound, name: "404", hidden: true, children: [] } ] //标准版路由表 let addrouters = [ { path: "/examinationPaper", iconCls: "fa fa-file-text", // 图标样式class name: "备题组卷", component: Layout, alone: true, children: [ { path: "/examinationPaper", iconCls: "fa fa-file-text", // 图标样式class name: "examinationPaper", component: ExaminationPaper, children: [] }, { path: "/examinationPaperAdd", iconCls: "", // 图标样式class name: "examinationPaperAdd", component: ExaminationPaperAdd, parent: "examinationPaper", children: [] }, { path: "/examinationPaperAddAsk", iconCls: "", // 图标样式class name: "examinationPaperAddAsk", component: ExaminationPaperAddAsk, parent: "examinationPaper", children: [] }, { path: "/examinationPaperEdit", iconCls: "", // 图标样式class name: "修改答题卡", component: ExaminationPaperEdit, parent: "examinationPaper", children: [] }, { path: "/examinationPaperRecycle", iconCls: "", // 图标样式class name: "回收站答题卡", component: ExaminationPaperRecycle, parent: "examinationPaper", children: [] }, { path: "/examinationPaperArchiving", iconCls: "", // 图标样式class name: "已归档答题卡", component: ExaminationPaperArchiving, parent: "examinationPaper", hidden: true, children: [] }, ] }, { path: "/ask", iconCls: "fa fa-bar-chart", // 图标样式class name: "随堂问报表", component: Layout, alone: true, children: [ { path: "/ask", iconCls: "fa fa-bar-chart", // 图标样式class name: "随堂问报表", component: Ask, meta: { keepAlive: true, }, children: [] }, { path: "/askList", iconCls: "fa fa-bar-chart", // 图标样式class name: "随堂问报表", component: AskList, children: [ { path: "/askAnalysis", iconCls: "", // 图标样式class name: "随堂问报表分析", component: AskAnalysis, parent: "askList", children: [] }, ], }, { path: "/askArchiving", iconCls: "", // 图标样式class name: "随堂问已归档报表分析", component: AskArchiving, parent: "ask", hidden: true, children: [] } ] }, { path: "/test", iconCls: "fa fa-pie-chart", // 图标样式class name: "即时测报表", component: Layout, alone: true, children: [ { path: "/test", iconCls: "fa fa-pie-chart", // 图标样式class name: "", component: Test, meta: { keepAlive: true, }, children: [] }, { path: "/testAnalysis", iconCls: "", // 图标样式class name: "即时测报表分析", component: TestAnalysis, parent: "test", children: [] }, { path: "/testArchiving", iconCls: "", // 图标样式class name: "即时测已归档报表分析", component: TestArchiving, parent: "test", hidden: true, children: [] } ] }, { path: "/setUpConglomerate", iconCls: "fa fa-building", // 图标样式class name: "学校管理", component: Layout, alone: true, children: [ { path: "/setUpConglomerate", iconCls: "fa fa-building", name: '集团管理', component: SetUpConglomerate, children: [] }, ] }, { path: "/setUpAccount", iconCls: "fa fa-id-card-o", // 图标样式class name: "账号管理", component: Layout, alone: true, children: [ { path: "/setUpAccount", iconCls: "fa fa-id-card-o", name: '', component: SetUpAccount, children: [] }, ] }, { path: "/", iconCls: "fa fa-cog", name: '学校管理', component: Layout, children: [ { path: "/setUpSchool", iconCls: "fa fa-calculator", name: '学校设置', component: SetUpSchool, children: [] }, { path: "/setUpClazz", iconCls: "fa fa-sitemap", name: '班级管理', component: SetUpClazz, children: [] }, { path: "/setUpTeacher", iconCls: "fa fa-male", name: '教师管理', component: SetUpTeacher, children: [] }, { path: "/setUpStudent", iconCls: "fa fa-mortar-board", name: '学生管理', component: SetUpStudent, children: [] }, { path: "/archivedClazz", iconCls: "fa fa-list-ul", name: '已归档班级', component: ArchivedClazz, hidden: true, children: [] }, { path: "/archived", iconCls: "fa fa-list-ul", name: '分班', component: Archived, hidden: true, children: [] }, ] }, { path: "/card", iconCls: "fa fa-id-card", // 图标样式class name: "发卡记录", component: Layout, alone: true, children: [ { path: "/card", iconCls: "fa fa-id-card", // 图标样式class name: "", component: Card, children: [] } ] }, { path: "/device", iconCls: "fa fa-dashboard", // 图标样式class name: "设备状态", component: Layout, alone: true, children: [ { path: "/device", iconCls: "fa fa-dashboard", // 图标样式class name: "", component: Device, meta: { keepAlive: true, }, children: [] }, { path: "/deviceLog", iconCls: "fa fa-list-alt", // 图标样式class name: "", component: DeviceLog, parent: "device", children: [] } ] }, { path: "/analysis", iconCls: "fa fa-area-chart", // 图标样式class name: "使用分析", component: Layout, alone: true, children: [ { path: "/analysis", iconCls: "fa fa-area-chart", // 图标样式class name: "", component: Analysis, children: [] } ] }, { path: "/down", iconCls: "fa fa-download", // 图标样式class name: "软件下载", component: Layout, alone: true, children: [ { path: "/down", iconCls: "fa fa-download", // 图标样式class name: "发卡软件", component: Down, children: [] }, { path: "/downClient", iconCls: "", // 图标样式class name: "授课端软件", component: DownClient, parent: "down", children: [] } ] }, { path: "/dataSync", iconCls: "fa fa-random", // 图标样式class name: "数据同步", component: Layout, alone: true, children: [ { path: "/dataSync", iconCls: "fa fa-random", // 图标样式class name: "", component: DataSync, children: [] } ] }, // { // path: "/portrait", // iconCls: "fa fa-users", // 图标样式class // name: "学生画像", // component: Layout, // alone: true, // children: [ // { // path: "/portrait", // iconCls: "fa fa-users", // 图标样式class // name: "", // component: Portrait, // meta: { // keepAlive: true, // }, // children: [] // }, // { // path: "/portraitDetail", // iconCls: "", // 图标样式class // name: "授课端软件", // component: PortraitDetail, // parent: "down", // children: [] // } // ] // }, ] //长水版路由表 let csAddrouters = [ { path: "/examinationPaper", iconCls: "fa fa-file-text", name: "备题组卷", component: Layout, alone: true, children: [ { path: "/examinationPaper", iconCls: "fa fa-file-text", name: "examinationPaper", component: ExaminationPaper, children: [] }, { path: "/examinationPaperAdd", iconCls: "", name: "examinationPaperAdd", component: ExaminationPaperAdd, parent: "examinationPaper", children: [] }, { path: "/examinationPaperEdit", iconCls: "", name: "修改答题卡", component: ExaminationPaperEdit, parent: "examinationPaper", children: [] }, { path: "/examinationPaperRecycle", iconCls: "", name: "回收站答题卡", component: ExaminationPaperRecycle, parent: "examinationPaper", children: [] }, { path: "/examinationPaperArchiving", iconCls: "", name: "已归档答题卡", component: ExaminationPaperArchiving, parent: "examinationPaper", hidden: true, children: [] }, ] }, { path: "/ask", iconCls: "fa fa-bar-chart", name: "随堂问报表", component: Layout, alone: true, children: [ { path: "/ask", iconCls: "fa fa-bar-chart", name: "ask", name: "随堂问报表", component: Ask, meta: { keepAlive: true, }, children: [] }, { path: "/askAnalysis", iconCls: "", name: "随堂问报表分析", component: AskAnalysis, parent: "ask", children: [] } ] }, { path: "/test", iconCls: "fa fa-pie-chart", name: "即时测报表", component: Layout, alone: true, children: [ { path: "/test", iconCls: "fa fa-pie-chart", name: "", component: Test, meta: { keepAlive: true, }, children: [] }, { path: "/testAnalysis", iconCls: "", name: "即时测报表分析", component: TestAnalysis, parent: "test", children: [] } ] }, { path: "/setUpConglomerate", iconCls: "fa fa-building", name: "学校管理", component: Layout, alone: true, children: [ { path: "/setUpConglomerate", iconCls: "fa fa-building", name: '集团管理', component: SetUpConglomerate, children: [] }, ] }, { path: "/setUpAccount", iconCls: "fa fa-id-card-o", name: "账号管理", component: Layout, alone: true, children: [ { path: "/setUpAccount", iconCls: "fa fa-id-card-o", name: '', component: SetUpAccount, children: [] }, ] }, { path: "/", iconCls: "fa fa-cog", name: '学校管理', component: Layout, children: [ { path: "/setUpSchool", iconCls: "fa fa-calculator", name: '学校设置', component: SetUpSchool, children: [] }, { path: "/setUpTeacher", iconCls: "fa fa-male", name: '教师管理', component: SetUpTeacher, children: [] }, { path: "/setUpStudent", iconCls: "fa fa-mortar-board", name: '学生管理', component: SetUpStudent, children: [] }, ] }, { path: "/card", iconCls: "fa fa-id-card", name: "发卡记录", component: Layout, alone: true, children: [ { path: "/card", iconCls: "fa fa-id-card", name: "", component: Card, children: [] } ] }, { path: "/device", iconCls: "fa fa-dashboard", name: "设备状态", component: Layout, alone: true, children: [ { path: "/device", iconCls: "fa fa-dashboard", name: "", component: Device, meta: { keepAlive: true, }, children: [] }, { path: "/deviceLog", iconCls: "fa fa-list-alt", name: "", component: DeviceLog, parent: "device", children: [] } ] }, { path: "/analysis", iconCls: "fa fa-area-chart", name: "使用分析", component: Layout, alone: true, children: [ { path: "/analysis", iconCls: "fa fa-area-chart", name: "", component: Analysis, children: [] } ] }, { path: "/down", iconCls: "fa fa-download", name: "软件下载", component: Layout, alone: true, children: [ { path: "/down", iconCls: "fa fa-download", name: "发卡软件", component: Down, children: [] }, { path: "/downClient", iconCls: "", name: "授课端软件", component: DownClient, parent: "down", children: [] } ] }, { path: "/dataSync", iconCls: "fa fa-random", name: "数据同步", component: Layout, alone: true, children: [ { path: "/dataSync", iconCls: "fa fa-random", name: "", component: DataSync, children: [] } ] }, ] //个人版版路由表 const addroutersPersonal = [ { path: "/setUpStudent", iconCls: "fa fa-mortar-board", name: '班级名单', component: Layout, alone: true, children: [ { path: "/setUpStudent", iconCls: "a fa-mortar-board", name: '', component: SetUpStudent, children: [] }, ] }, { path: "/examinationPaper", iconCls: "fa fa-file-text", name: "备题组卷", component: Layout, alone: true, children: [ { path: "/examinationPaper", iconCls: "fa fa-file-text", name: "examinationPaper", component: ExaminationPaper, children: [] }, { path: "/examinationPaperAdd", iconCls: "", name: "examinationPaperAdd", component: ExaminationPaperAdd, parent: "examinationPaper", children: [] }, { path: "/examinationPaperAddAsk", iconCls: "", name: "examinationPaperAddAsk", component: ExaminationPaperAddAsk, parent: "examinationPaper", children: [] }, { path: "/examinationPaperEdit", iconCls: "", name: "修改答题卡", component: ExaminationPaperEdit, parent: "examinationPaper", children: [] }, { path: "/examinationPaperRecycle", iconCls: "", name: "回收站答题卡", component: ExaminationPaperRecycle, parent: "examinationPaper", children: [] }, { path: "/examinationPaperArchiving", iconCls: "", name: "已归档答题卡", component: ExaminationPaperArchiving, parent: "examinationPaper", hidden: true, children: [] }, ] }, { path: "/ask", iconCls: "fa fa-bar-chart", name: "随堂问报表", component: Layout, alone: true, children: [ { path: "/ask", iconCls: "fa fa-bar-chart", name: "ask", name: "随堂问报表", component: Ask, meta: { keepAlive: false, }, children: [] }, { path: "/askList", iconCls: "fa fa-bar-chart", // 图标样式class name: "ask", name: "随堂问报表", component: AskList, meta: { keepAlive: true, }, children: [ { path: "/askAnalysis", iconCls: "", name: "随堂问报表分析", component: AskAnalysis, parent: "ask", children: [] }, { path: "/askArchiving", iconCls: "", name: "随堂问已归档报表分析", component: AskArchiving, parent: "ask", hidden: true, children: [] } ] }, ] }, { path: "/test", iconCls: "fa fa-pie-chart", name: "即时测报表", component: Layout, alone: true, children: [ { path: "/test", iconCls: "fa fa-pie-chart", name: "", component: Test, meta: { keepAlive: true, }, children: [] }, { path: "/testAnalysis", iconCls: "", name: "即时测报表分析", component: TestAnalysis, parent: "test", children: [] }, { path: "/testArchiving", iconCls: "", name: "即时测已归档报表分析", component: TestArchiving, parent: "test", hidden: true, children: [] } ] }, { path: "/portrait", iconCls: "fa fa-users", name: "学生画像", component: Layout, alone: true, children: [ { path: "/portrait", iconCls: "fa fa-users", name: "", component: Portrait, meta: { keepAlive: true, }, children: [] }, { path: "/portraitDetail", iconCls: "", name: "授课端软件", component: PortraitDetail, parent: "down", children: [] } ] }, { path: "/dataSync", iconCls: "fa fa-random", name: "数据同步", component: Layout, alone: true, children: [ { path: "/dataSync", iconCls: "fa fa-random", name: "", component: DataSync, children: [] } ] }, { path: "/down", iconCls: "fa fa-download", name: "软件下载", component: Layout, alone: true, children: [ { path: "/down", iconCls: "fa fa-download", name: "发卡软件", component: Down, children: [] } ] }, ] // 超级管理员路由表 const addRoutersAdmin = [ { path: "/account", iconCls: "fa fa-id-card-o", name: "账号管理", component: Layout, alone: true, children: [ { path: "/account", iconCls: "fa fa-id-card-o", name: '', component: AdminAccount, children: [] }, ] }, { path: "/device", iconCls: "fa fa-dashboard", name: "设备状态", component: Layout, alone: true, children: [ { path: "/device", iconCls: "fa fa-dashboard", name: "", component: AdminDevice, meta: { keepAlive: true, }, children: [] }, { path: "/deviceLog", iconCls: "fa fa-list-alt", name: "", component: AdminDeviceLog, parent: "device", children: [] } ] }, { path: "/clientVersion", iconCls: "fa fa-cogs", // 图标样式class name: "版本管理", component: Layout, alone: true, children: [ { path: "/clientVersion", iconCls: "fa fa-id-card-o", name: '', component: AdminClientVersion, children: [] }, ] }, ] export default new Router({ routes: defaultRouter }) export { defaultRouter, addrouters, addroutersPersonal, addRoutersAdmin, csAddrouters }