import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/components/layout/index.vue'

Vue.use(VueRouter)

const routes = [
  { path: '*', redirect: '/' },
  {
    path: '/',
    component: Layout,
    children: [
      { path: '', component: () => import('@/pages/home/index.vue') },
      // 工作动态
      { path: '/news', component: () => import('@/pages/news/index.vue') },
      { path: '/news/detail', component: () => import('@/pages/news/detail.vue') },
      // 1+x产品
      { path: '/product', component: () => import('@/pages/product/index.vue') },
      // 证书成绩查询
      { path: '/attestation', component: () => import('@/pages/attestation/index.vue') },
      // 技能培训
      { path: '/train', component: () => import('@/pages/train/index.vue') },
      // 技能培训详情
      { path: '/train/list', component: () => import('@/pages/train/list.vue') },
      { path: '/train/detail', component: () => import('@/pages/train/detail.vue') },
      { path: '/train/form', component: () => import('@/pages/train/form.vue') },
      // 证书成绩查询
      { path: '/queryCard', component: () => import('@/pages/home/queryCard.vue') },
    ],
  },
]

const router = new VueRouter({
  mode: 'history',
  routes,
  scrollBehavior() {
    return { x: 0, y: 0 }
  },
})

export default router
