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',
      name: 'company',
      component: () => import('@/views/master/login/company.vue'),
    },
    {
      path: '/mastercompanys',
      name: 'companys',
      component: () => import('@/views/master/login/companys.vue'),
    },
    {
      path: '/masternews',
      name: 'list',
      component: () => import('@/views/master/news/list.vue'),
    },
    {
      path: '/masternewsdetail',
      name: 'detail',
      component: () => import('@/views/master/news/detail.vue'),
    },
    {
      path: '/masternotice',
      name: 'masterlists',
      component: () => import('@/views/master/notice/list.vue'),
    },
    {
      path: '/masternoticedetail',
      name: 'masterdetails',
      component: () => import('@/views/master/notice/detail.vue'),
    },
    {
      path: '/style',
      name: 'masterdetails',
      component: () => import('@/views/master/style.vue'),
    },
  ],
});
router.afterEach((to, from, next) => {
  window.scrollTo(0, 0);
});
export default router;
