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: '/index',
      name: 'index',
      component: () => import('../views/index.vue'),
    },
    {
      path: '/',
      name: 'loading',
      component: () => import('../views/loading.vue'),
    },
    {
      path: '/fail',
      name: 'fail',
      component: () => import('../views/fail.vue'),
    },
    {
      path: '/list/:jobs/:type',
      name: 'list',
      component: () => import('../views/list.vue'),
    },
    {
      path: '/list/:jobs',
      name: 'list',
      component: () => import('../views/list.vue'),
    },
    {
      path: '/detail',
      name: 'detail',
      component: () => import('../views/detail.vue'),
    },
    {
      path: '/member',
      name: 'member',
      component: () => import('../views/member.vue'),
    },
    {
      path: '/memberDetail',
      name: 'memberDetail',
      component: () => import('../views/memberDetail.vue'),
    },
    {
      path: '/newsList/:type/:id',
      name: 'newsList',
      component: () => import('../views/newsList.vue'),
    },
    {
      path: '/memberList/:type/:id',
      name: 'memberList',
      component: () => import('../views/memberList.vue'),
    },
    {
      path: '/talkDetail',
      name: 'talk',
      component: () => import('../views/recruit/talk.vue'),
    },
    {
      path: '/jobfairDetail',
      name: 'jobfairDetail',
      component: () => import('../views/recruit/jobfair.vue'),
    },
    {
      path: '/jobinfoDetail',
      name: 'jobinfoDetail',
      component: () => import('../views/recruit/jobinfo.vue'),
    },
    {
      path: '/jobsDetail',
      name: 'jobsDetail',
      component: () => import('../views/recruit/jobs.vue'),
    },
    {
      path: '/corp',
      name: 'corp',
      component: () => import('../views/recruit/corp.vue'),
    },
    {
      path: '/quiet',
      name: 'quiet',
      component: () => import('../views/quiet.vue'),
    },
    {
      path: '/about',
      name: 'about',
      component: () => import('../views/aboutMe.vue'),
    },
    {
      path: '/help',
      name: 'help',
      component: () => import('../views/help.vue'),
    },
  ],
});

router.afterEach((to, from, next) => {
  window.scrollTo(0, 0);
});

export default router;
