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 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 CheckTeacherPay from "@/pages/super/CheckTeacherPay";
import SuperAdmin from "@/pages/super/SuperAdmin";
import Redirect_uri from "@/pages/aikmt/Redirect_uri"; //微信登陆路由重定向页面
Vue.use(Router);

export const constantRouterMap = 
   [
    {
      path: "/",
      name: "Login",
      component: Login
    },
    {
      path: "/Login",
      name: "login",
      component: Login
    },
    {
      path: "/aikmt/redirect_uri",
      name: "微信认证重定向页",
      component: Redirect_uri
    },
     {
       path: "/super",
       component: Super,
       children:[
         {
           path: "",
           redirect: "SuperAdmin"
         },
         {
           path: "SuperAdmin",
           name: "SuperAdmin",
           component: SuperAdmin,
           meta: { title: '超级管理员', roles: ['2'] }
         },
         {
           path: "CheckTeacherAudit",
           name: "CheckTeacherAudit",
           component: CheckTeacherAudit,
           meta: { title: '批改老师注册审核', roles: ['2'] }
         },
         {
           path: "CheckTeacherPay",
           name: "CheckTeacherPay",
           component: CheckTeacherPay,
           meta: { title: '批改老师薪酬表', roles: ['2'] }
         },
       ]
     },
      {
       path: "/home",
       component: Home,
       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: ['1'] }
         },
         {
           path: "*",
           name: "找不到页面",
           component: Error404
         }
       ]
     },
     {
       path: "*",
       name: "错误页面",
       component: Error
     }

  ]
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: ['2'] }
  //     },
  //     {
  //       path: "TeacherApporval",
  //       name: "TeacherApporval",
  //       component: TeacherApporval,
  //       meta: { title: '教师审核', roles: ['2'] }
  //     },
  //      {
  //       path: "TeacherPay",
  //       name: "TeacherPay",
  //       component: TeacherPay,
  //       meta: { title: '教师薪酬管理', roles: ['2'] }
  //     },
  //     {
  //       path: "*",
  //       name: "找不到页面",
  //       component: Error404
  //     }
  //   ]
  // },
  // {
  //   path: "*",
  //   name: "错误页面",
  //   component: Error
  // }
]

