import Home from "./views/Home.vue";
import Work from "./views/Work.vue";
import Overview from "./views/Overview.vue";
import Levels from "./views/Levels.vue";
import Students from "./views/Students.vue";
import Papers from "./views/Papers.vue";
import PaperReview from "./views/PaperReview.vue";
import ClientUser from "./views/ClientUser.vue";
import Tasks from "./views/Tasks.vue";
import Analyze from "./views/Analyze.vue";

const workRouter = {
  path: "/admin/work",
  name: "Work",
  component: Work,
  meta: {
    title: "工作"
  }
};

const routes = [
  {
    path: "overview",
    name: "Overview",
    component: Overview,
    meta: {
      title: "总览"
    }
  },
  {
    path: "levels",
    name: "Levels",
    component: Levels,
    meta: {
      title: "档位设定"
    }
  },
  {
    path: "students",
    name: "Students",
    component: Students,
    meta: {
      title: "考生管理"
    }
  },
  {
    path: "papers",
    name: "Papers",
    component: Papers,
    meta: {
      title: "试卷管理"
    }
  },
  {
    path: "paper-review",
    name: "PaperReview",
    component: PaperReview,
    meta: {
      title: "试卷复核"
    }
  },
  {
    path: "client-user",
    name: "ClientUser",
    component: ClientUser,
    meta: {
      title: "采集账号管理"
    }
  },
  {
    path: "tasks",
    name: "Tasks",
    component: Tasks,
    meta: {
      title: "任务管理"
    }
  },
  {
    path: "analyze",
    name: "Analyze",
    component: Analyze,
    meta: {
      title: "质量分析"
    }
  }
];

export const navs = routes.map(item => {
  return {
    name: item.name,
    title: item.meta.title
  };
});

export default [
  { ...workRouter },
  {
    path: "/admin/:workId(\\d+)",
    name: "AdminHome",
    component: Home,
    redirect: { name: "Overview" },
    children: routes
  }
];
