import Vue from 'vue'
import Router from 'vue-router'
import Homes from '@/components/Homes'
import User from '@/components/user/User'

Vue.use(Router)

export default new Router({
  // hashbang: true,
  // history: false,
  mode:'history',
  routes: [
    {
      path: '/',
      name: 'homes',
      component: Homes
    },
    {
      path: '/login',
      name: 'login',
      component: resolve => require(['../components/login/Account.vue'], resolve)
    },
    {
      path: '/login2',
      name: 'login2',
      component: resolve => require(['../components/login/Account2.vue'], resolve)
    },
    // 所有学习课程
    {
      path:'/courseAll',
      name:'courseAll',
      component: resolve => require(['../components/study/courseAll.vue'], resolve)
    },
    // 学习课程
    {
      path:'/course',
      name:'course',
      component: resolve => require(['../components/study/course.vue'], resolve)
    },
    // 学习课程详情
    {
      path:'/courseDetail',
      name:'courseDetail',
      component: resolve => require(['../components/study/courseDetail.vue'], resolve)
    },
    // 发表留言
    {
      path:'/LiuYan',
      name:'LiuYan',
      component: resolve => require(['../components/study/LiuYan.vue'], resolve)
    },
    // 留言列表
    {
      path:'/LiuYanList',
      name:'LiuYanList',
      component: resolve => require(['../components/study/LiuYanList.vue'], resolve)
    },
    // 留言列表详情
    {
      path:'/LiuYanListDetail',
      name:'LiuYanListDetail',
      component: resolve => require(['../components/study/LiuYanListDetail.vue'], resolve)
    },
    // 考试
    {
      path:'/Exam',
      name:'Exam',
      component: resolve => require(['../components/study/Exam.vue'], resolve)
    },
    // 模拟考试
    {
      path:'/ExamTest',
      name:'ExamTest',
      component: resolve => require(['../components/study/ExamTest.vue'], resolve)
    },
    // 查阅考卷
    {
      path:'/ExamDetail',
      name:'ExamDetail',
      component: resolve => require(['../components/user/ExamDetail.vue'], resolve)
    },
    // 考试记录
    {
      path:'/ExamList',
      name:'ExamList',
      component: resolve => require(['../components/user/ExamList.vue'], resolve)
    },
    // 我的证书
    {
      path:'/certificate',
      name:'certificate',
      component: resolve => require(['../components/user/certificate.vue'], resolve)
    },
    //预览证书卡片
    {
      path:'/photoPreview',
      name:'photoPreview',
      component: resolve => require(['../components/user/photoPreview.vue'], resolve)
    },
    //每日一练
    {
      path:'/daily',
      name:'daily',
      component: resolve => require(['../components/study/dailyPractice.vue'], resolve)
    },
    //生成二维码页面
    {
      path:'/qrcode',
      name:'qrcode',
      component: resolve => require(['../components/signin/QRCode.vue'], resolve)
    },
    //签到页面
    {
      path:'/signin',
      name:'signin',
      component: resolve => require(['../components/signin/SignIn.vue'], resolve)
    },
    //wxError
    {
      path:'/wxerror',
      name:'wxerror',
      component: resolve => require(['../components/login/wxError.vue'], resolve)
    },
    {
      path:'/liveview',
      name:'liveview',
      component: resolve => require(['../components/study/liveView.vue'], resolve)
    },
    // 用户
    {
      path:'/user',
      name:"user",
      component: User,
      children: [
        {
          path:'/user/',
          name: 'User',
          component: resolve => require(['../components/user/UserCenter.vue'], resolve)
        },
        {
          path:'/user/changepwd',
          name:'changepwd',
          component:resolve => require(['../components/user/ChangePwd.vue'],resolve)
        },
        {
          path:'/user/bind',
          name:'bind',
          component:resolve => require(['../components/user/bind.vue'],resolve)
        },
        {
          path:'/user/display',
          name:'证书展示',
          component:resolve => require(['../components/user/DisplayCard2.vue'],resolve)
        },
        {
          path:'/user/query',
          name:'证书查询',
          component:resolve => require(['../components/user/QueryCard2.vue'],resolve)
        },
        {
          path:'/user/uploadphoto',
          name:'上传证件照',
          component:resolve => require(['../components/user/uploadphoto.vue'],resolve)
        },
      ]
    },
    {   // 根目录重定向
      path: '*', redirect: '/'
    }
  ]
})
