import Vue from "vue";
import Router from "vue-router";
import Login from "@/pages/Login";
import Home from "@/pages/Home";
import Super from "@/pages/Super";
import Qualityinspector from "@/pages/Qualityinspector";
// import Redirect_uri from "@/pages/Redirect_uri";
import Error from "@/pages/Error";
import Error404 from "@/pages/Error404";
// 校区管理员
import SchoolManager from "@/pages/home/SchoolManager";
import TeacherApporval from "@/pages/home/TeacherApporval";
import TeacherPay from "@/pages/home/TeacherPay";

// 超级管理员
import CheckTeacherAudit from "@/pages/Super/CheckTeacherAudit";
import SuperSchoolManager from "@/pages/Super/SchoolManager";
import CheckTeacherPay from "@/pages/Super/CheckTeacherPay";
import SuperAdmin from "@/pages/Super/SuperAdmin";
import HomeworkRecycle from "@/pages/Super/HomeworkRecycle";
import HomeworkTotally from "@/pages/Super/HomeworkTotally";
import ComposeType from "@/pages/Super/ComposeType";
import HomeWorkPictrue from "@/pages/Super/HomeWorkPictrue";
import HomeworkInfoMessage from "@/pages/Super/HomeworkInfoMessage";
import SuperTeacherPay from "@/pages/Super/TeacherPay";
import AllStudentHomework from "@/pages/Super/AllStudentHomework";
import AllHomeWorkPictrue from "@/pages/Super/AllHomeWorkPictrue";

// 质检员
import GetCheckHomeWork from "@/pages/Qualityinspector/GetCheckHomeWork";
import checkListInfo from "@/pages/Qualityinspector/checkListInfo";
import checkAllStudentHomework from "@/pages/Qualityinspector/AllStudentHomework";
import checkAllHomeWorkPictrue from "@/pages/Qualityinspector/AllHomeWorkPictrue";
Vue.use(Router);

export const constantRouterMap = 
   [
    {
      path: "/",
      name: "Login",
      component: Login,
      meta: { title: '登陆', roles: ['0'] }
    },
    {
      path: "/Login",
      name: "login",
      component: Login,
      meta: { title: '登陆', roles: ['0'] }
    },
// 超级管理员角色路由
     {
       path: "/super",
       component: Super,
       meta: {
        title: '',
        requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的

    },
       children:[
         {
           path: "",
           redirect: "SuperAdmin"
         },
         {
           path: "SuperAdmin",
           name: "SuperAdmin",
           component: SuperAdmin,
           meta: { title: '超级管理员', roles: ['3'] }

         },
         {
           path: "CheckTeacherAudit",
           name: "CheckTeacherAudit",
           component: CheckTeacherAudit,
           meta: { title: '批改老师注册审核', roles: ['3'] }
         },
         {
           path: "CheckTeacherPay",
           name: "CheckTeacherPay",
           component: CheckTeacherPay,
           meta: { title: '批改老师薪酬表', roles: ['3'] }
         },
         {
          path: "SuperSchoolManager",
          name: "SuperSchoolManager",
          component: SuperSchoolManager,
          meta: { title: '校区管理员', roles: ['3'] }
        },
         {
           path: "HomeworkRecycle",
           name: "HomeworkRecycle",
           component: HomeworkRecycle,
           meta: { title: '作业回收站', roles: ['3'] }
         },
         {
          path: "HomeworkTotally",
          name: "HomeworkTotally",
          component: HomeworkTotally,
          meta: { title: '作业统计', roles: ['3'] }
        },
				{
				  path: "ComposeType",
				  name: "ComposeType",
				  component: ComposeType,
				  meta: { title: '排班', roles: ['3'] }
        },
        {
				  path: "HomeWorkPictrue",
				  name: "HomeWorkPictrue",
				  component: HomeWorkPictrue,
				  meta: { title: '批改作业原图', roles: ['3'] }
        },
        {
				  path: "HomeworkInfoMessage",
				  name: "HomeworkInfoMessage",
				  component: HomeworkInfoMessage,
				  meta: { title: '批改明细', roles: ['3'] }
        },
        {
          path: "SuperTeacherPay",
          name: "SuperTeacherPay",
          component: SuperTeacherPay,
          meta: { title: '报错详情', roles: ['2'] }
        },
        {
          path: "AllStudentHomework",
          name: "AllStudentHomework",
          component: AllStudentHomework,
          meta: { title: '所有学生作业列表', roles: ['2'] }
        },
        {
          path: "AllHomeWorkPictrue",
          name: "AllHomeWorkPictrue",
          component: AllHomeWorkPictrue,
          meta: { title: '所有学生作业图片列表', roles: ['2'] }
        },
       ]
     },
    //  校区管理员角色路由
      {
       path: "/home",
       component: Home,
       meta: {
        title: '',
        requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
    },
       children: [
         {
           path: "",
           redirect: "SchoolManager"
         },
         {
           path: "SchoolManager",
           name: "SchoolManager",
           component: SchoolManager,
           meta: { title: '校区管理员', roles: ['2'] }
         },
         {
           path: "TeacherApporval",
           name: "TeacherApporval",
           component: TeacherApporval,
           meta: { title: '在线批改老师', roles: ['2'] }
         },
         {
           path: "TeacherPay",
           name: "TeacherPay",
           component: TeacherPay,
           meta: { title: '报错详情', roles: ['2'] }
         },
       ]
     },
     //质检员
     {
      path: "/Qualityinspector",
      component: Qualityinspector,
      meta: {
       title: '',
       requireAuth: true,  // 添加该字段，表示进入这个路由是需要登录的
   },
      children: [
        {
          path: "",
          redirect: "GetCheckHomeWork"
        },
        {
          path: "GetCheckHomeWork",
          name: "GetCheckHomeWork",
          component:GetCheckHomeWork,
          meta: { title: '质检作业', roles: ['3'] }
        },
        {
          path: "checkListInfo",
          name: "checkListInfo",
          component:checkListInfo,
          meta: { title: '质检作业详情列表', roles: ['3'] }
        },
        {
          path: "checkAllStudentHomework",
          name: "checkAllStudentHomework",
          component: checkAllStudentHomework,
          meta: { title: '所有学生作业列表', roles: ['3'] }
        },
        {
          path: "checkAllHomeWorkPictrue",
          name: "checkAllHomeWorkPictrue",
          component: checkAllHomeWorkPictrue,
          meta: { title: '所有学生作业图片列表', roles: ['3'] }
        },
      ]
    },
     {
      path: "*",
      name: "找不到页面",
      component: Error404,
      meta: { title: '找不到页面', roles: ['0'] }
    },
     {
       path: "*",
       name: "错误页面",
       component: Error,
       meta: { title: '错误页面', roles: ['0'] }
     }

  ]
export default new Router({
  routes: constantRouterMap
})

// 异步挂载的路由
// 动态需要根据权限加载的路由表
// export const asyncRouterMap = [
//       {
//        path: "/home",
//        component: Home,
//        children: [
//          {
//            path: "",
//            redirect: "SchoolManager"
//          },
//          {
//            path: "SchoolManager",
//            name: "SchoolManager",
//            component: SchoolManager,
//            meta: { title: '校区管理员', roles: ['1'] }
//          },
//          {
//            path: "TeacherApporval",
//            name: "TeacherApporval",
//            component: TeacherApporval,
//            meta: { title: '在线批改老师', roles: ['1'] }
//
//          },
//          {
//            path: "TeacherPay",
//            name: "TeacherPay",
//            component: TeacherPay,
//            meta: { title: '教师薪酬管理', roles: ['1'] }
//          },
//         {
//           path: "SuperAdmin",
//           name: "SuperAdmin",
//           component: SuperAdmin,
//           meta: { title: '超级管理员', roles: ['1'] }
//         },
//         {
//           path: "CheckTeacherAudit",
//           name: "CheckTeacherAudit",
//           component: CheckTeacherAudit,
//           meta: { title: '批改老师注册审核', roles: ['1'] }
//         },
//         {
//           path: "CheckTeacherPay",
//           name: "CheckTeacherPay",
//           component: CheckTeacherPay,
//           meta: { title: '批改老师薪酬表', roles: ['1'] }
//         },
//        ]
//      },
// ]
