import { defineConfig } from "umi";

export default defineConfig({
  routes: [
    { path: "/", redirect:'/login' },
    { path: "/login", component: "@/pages/login" },
    { path: "/home", component: "@/pages/home",
      routes: [
        // { path: '/home', redirect: '/home/statistics' },
        { path: "/home/statistics", component: "@/pages/statistics" },
        { path: "/home/analysis", component: "@/pages/analysis" },
        { path: "/home/report", component: "@/pages/report" },
        { path: "/home/report/online", component: "@/pages/report/online" },
        { path: "/home/report/student", component: "@/pages/report/student" },
        { path: "/home/report/examDistribution", component: "@/pages/report/examDistribution" },
        { path: "/home/report/school", component: "@/pages/report/school" },
        { path: "/home/report/teacher", component: "@/pages/report/teacher" },
        { path: "/home/report/question", component: "@/pages/report/question" },
        { path: "/home/report/quality", component: "@/pages/report/subpage/quality" },
        { path: "/home/report/enowledgepoint", component: "@/pages/report/enowledgepoint" },
        { path: "/home/examination/comparison", component: "@/pages/examination-comparison",redirect:'/home/ranking-comparison'},
        { path: "/home/ranking/comparison", component: "@/pages/examination-comparison/subpage/ranking-comparison" },
        { path: "/home/percentage/comparison", component: "@/pages/examination-comparison/subpage/percentage-comparison" },
        { path: "/home/params/comparison", component: "@/pages/examination-comparison/subpage/params-comparison" },
        { path: "/home/knowledge/comparison", component: "@/pages/examination-comparison/subpage/knowledge-comparison" },
        { path: "/home/online/comparison", component: "@/pages/examination-comparison/subpage/online-comparison" },
        { path: "/home/template", component: "@/pages/template" },
        { path: "/home/test", component: "@/pages/test" },
        // { path: "/home/backup", component: "@/pages/backup" },
        { path: "/home/system/data", component: "@/pages/export-data" },
        { path: "/home/system/account", component: "@/pages/admin-account" },
        { path: "/home/system/account/admin", component: "@/pages/admin-account/subpage/account" },
        { path: "/home/system/account/access", component: "@/pages/admin-account/subpage/access" },
        { path: "/home/system/setup", component: "@/pages/setup"},
        { path: "/home/system/setup/subject", component: "@/pages/setup/subpage/subject" },
        { path: "/home/system/setup/district", component: "@/pages/setup/subpage/district" },
        { path: "/home/system/setup/school", component: "@/pages/setup/subpage/school" },
      ]
    },
  ],
  publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
  extraBabelPlugins: process.env.NODE_ENV === 'production'
    ? ['babel-plugin-dynamic-import-node']
    : [],
  history: { type: 'hash' },
  hash: true,
  title: false,
  npmClient: 'pnpm',
  proxy: {
    '/api': {
      target:"https://studies.hmbigdata.com",
      changeOrigin: true,
      pathRewrite: { '^/api': '/hly-huaian' },
    },
  },
});
