import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

const router = new Router({
  mode: 'history',
  base: process.env.NODE_ENV === 'development' ? '' : process.env.VUE_APP_ROUTER,
  routes: [
    {
      path: '/',
      component: () => import('@/views/index/index.vue'),
    },
    {
      path: '/info',
      component: () => import('@/views/info/index.vue'),
      children: [
        {
          path: 'list/:parent_id',
          component: () => import('@/views/info/list.vue'),
        },
      ],
    },
    {
      path: '/info/detail',
      component: () => import('@/views/info/detail.vue'),
    },
    {
      path: '/jobfair',
      component: () => import('@/views/jobfair/index.vue'),
      children: [
        {
          path: 'list/:type',
          component: () => import('@/views/jobfair/list.vue'),
        },
      ],
    },
    {
      path: '/jobfair/detail',
      component: () => import('@/views/jobfair/detail.vue'),
    },
    {
      path: '/talk',
      component: () => import('@/views/talk/index.vue'),
      children: [
        {
          path: 'list/:type',
          component: () => import('@/views/talk/list.vue'),
        },
      ],
    },
    {
      path: '/talk/detail',
      component: () => import('@/views/talk/detail.vue'),
    },
    {
      path: '/jobinfo',
      component: () => import('@/views/jobinfo/index.vue'),
      children: [
        {
          path: 'list',
          component: () => import('@/views/jobinfo/list.vue'),
        },
      ],
    },
    {
      path: '/jobinfo/detail',
      component: () => import('@/views/jobinfo/detail.vue'),
    },
    {
      path: '/jobs',
      component: () => import('@/views/jobs/index.vue'),
      children: [
        {
          path: 'list/:type',
          component: () => import('@/views/jobs/list.vue'),
        },
      ],
    },
    {
      path: '/jobs/detail',
      component: () => import('@/views/jobs/detail.vue'),
    },
    {
      path: '/corp/detail',
      component: () => import('@/views/corp/index.vue'),
    },
    {
      path: '/masterindex',
      name: 'master',
      component: () => import('@/views/master/index/index.vue'),
    },
    {
      path: '/masterstudent', //学生登录
      name: 'student',
      component: () => import('@/views/master/login/student.vue'),
    },
    {
      path: '/mastercompany', //企业登录1
      name: 'company',
      component: () => import('@/views/master/login/company.vue'),
    },
    {
      path: '/mastercompanys', //企业登录2
      name: 'companys',
      component: () => import('@/views/master/login/companys.vue'),
    },
    {
      path: '/master/jobs/:type', //新闻类列表
      name: 'master_jobs_list',
      component: () => import('@/views/master/news/list.vue'),
    },
    {
      path: '/master/detail/:type/:id', //新闻类详情
      name: 'master_detail',
      component: () => import('@/views/master/news/detail.vue'),
    },
    {
      path: '/master/notice/:parent_id',
      name: 'master_notice',
      component: () => import('@/views/master/notice/list.vue'),
    },
  ],
});
router.afterEach((to, from, next) => {
  window.scrollTo(0, 0);
});
export default router;
