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

import mainPage from './mainPage/index' // 主页
import indexPage from './mainPage/indexPage/index' // 首页
import fiveA from './fiveA/index' // 5A
import majorProjects from './majorProjects/index' // 项目专题
import majorProjectsList from './majorProjectsList/index' // 项目专题列表
import majorProjectsDetail from './majorProjectsDetail/index' // 项目专题详情
import placeOrderForCourse from './placeOrderForCourse/index' // 购买课程下单
import coffeeIndex from './mainPage/coffeeIndex/index' // 城咖啡
import placeOrder from './placeOrder/index' // 城咖啡-点单
import placeOrderDetail from './placeOrderDetail/index' // 城咖啡-点单详情
import orderList from './orderList/index' // 城咖啡-点单列表
import libraryIndex from './mainPage/libraryIndex/index' // 图书馆首页
import userCenter from './mainPage/userCenter/index' // 个人中心
import libraryNavList from './library/navList/index' // 图书馆nav
import booksSearch from './library/booksSearch/index' // 搜索图书
import booksList from './library/booksList/index' // 图书列表
import borrowedRecord from './library/borrowedRecord/index' // 借阅记录
import bindMobile from './bindMobile/bindMobile' // 绑定手机号
import lessonOrder from './lessonOrder/index' // 我的订单
import vip from './vip/index' // vip卡说明
import vipDetail from './vipDetail/index' // vip卡说明
import card from './card/index' // 卡
import coupons from './coupons/index' // 优惠券
import courseList from './courseList/index' // 课程列表
import lessonDetail from './lessonDetail/index' // 课程详情
import cardDetail from './cardDetail/index' // 体验卡详情
import gymCardDetail from './gymCardDetail/index' // 健身卡详情
import couponsDetail from './couponsDetail/index' // 体验券详情
import receive from './receive/index' // 领取页面
import receiveResults from './receiveResults/index' // 领取结果页面
import receiveChannel from './receiveChannel/index' // 渠道领取页面
import rush from './rush/index' // 抢购
import calendar from './calendar/calendar' // 台历活动页
import activeList from './activeList/activeList' // 活动列表
import customizationDetail from './customization/customizationDetail' // 定制详情
import customizationList from './customization/customizationList' // 定制列表
import checkModel from './calendar/checkModel' // 台历模板选择
import making from './calendar/making' // 台历制作
import preview from './calendar/preview' // 台历预览

Vue.use(Router)

const router = new Router({
  routes: [{
    path: '/mainPage',
    name: 'mainPage',
    component: mainPage,
    children: [{ // 首页
      path: 'indexPage',
      name: 'indexPage',
      component: indexPage,
      children: []
    }, { // 城咖啡
      path: 'coffeeIndex',
      name: 'coffeeIndex',
      component: coffeeIndex,
      children: []
    }, { // 图书馆首页
      path: 'libraryIndex',
      name: 'libraryIndex',
      component: libraryIndex,
      children: []
    }, { // 个人中心
      path: 'userCenter',
      name: 'userCenter',
      component: userCenter,
      children: []
    }]
  }, { // 图书馆nav
    path: '/libraryNavList',
    name: 'libraryNavList',
    component: libraryNavList,
    children: []
  }, { // 图书搜索
    path: '/booksSearch',
    name: 'booksSearch',
    component: booksSearch,
    children: []
  }, { // 图书列表
    path: '/booksList',
    name: 'booksList',
    component: booksList,
    children: []
  }, { // 借阅记录
    path: '/borrowedRecord',
    name: 'borrowedRecord',
    component: borrowedRecord,
    children: []
  }, { // 城咖啡-点单
    path: '/placeOrder',
    name: 'placeOrder',
    component: placeOrder,
    children: []
  }, { // 城咖啡-点单详情
    path: '/placeOrderDetail',
    name: 'placeOrderDetail',
    component: placeOrderDetail,
    children: []
  }, { // 城咖啡-点单列表
    path: '/orderList',
    name: 'orderList',
    component: orderList,
    children: []
  }, { // 项目专题
    path: '/majorProjects',
    name: 'majorProjects',
    component: majorProjects,
    children: []
  }, { // 课程列表
    path: '/courseList',
    name: 'courseList',
    component: courseList,
    children: []
  }, { // 项目专题列表
    path: '/majorProjectsList',
    name: 'majorProjectsList',
    component: majorProjectsList,
    children: []
  }, { // 项目专题详情
    path: '/majorProjectsDetail',
    name: 'majorProjectsDetail',
    component: majorProjectsDetail,
    children: []
  }, { // 购买课程下单
    path: '/placeOrderForCourse',
    name: 'placeOrderForCourse',
    component: placeOrderForCourse,
    children: []
  }, { // 5A
    path: '/fiveA',
    name: 'fiveA',
    component: fiveA,
    children: []
  }, { // 绑定手机号
    path: '/bindMobile',
    name: 'bindMobile',
    component: bindMobile,
    children: []
  }, { // 我的订单
    path: '/lessonOrder',
    name: 'lessonOrder',
    component: lessonOrder,
    children: []
  }, { // vip卡说明
    path: '/vip',
    name: 'vip',
    component: vip,
    children: []
  }, { // vip卡详情
    path: '/vipDetail',
    name: 'vipDetail',
    component: vipDetail,
    children: []
  }, { // 卡
    path: '/card',
    name: 'card',
    component: card,
    children: []
  }, { // 优惠券
    path: '/coupons',
    name: 'coupons',
    component: coupons,
    children: []
  }, { // 课程详情
    path: '/lessonDetail',
    name: 'lessonDetail',
    component: lessonDetail,
    children: []
  }, { // 体验卡详情
    path: '/cardDetail',
    name: 'cardDetail',
    component: cardDetail,
    children: []
  }, { // 健身卡详情
    path: '/gymCardDetail',
    name: 'gymCardDetail',
    component: gymCardDetail,
    children: []
  }, { // 体验券详情
    path: '/couponsDetail',
    name: 'couponsDetail',
    component: couponsDetail,
    children: []
  }, { // 卡券领取
    path: '/receive',
    name: 'receive',
    component: receive,
    children: []
  }, { // 卡券领取结果
    path: '/receiveResults',
    name: 'receiveResults',
    component: receiveResults,
    children: []
  }, { // 卡券领取(带参数，分享后的路径)
    path: '/receiveShared/:id/:salesid/:type/:random/:sharetype',
    name: 'receive',
    component: receive
  }, { // 渠道卡券领取
    path: '/receiveChannel',
    name: 'receiveChannel',
    component: receiveChannel,
    children: []
  }, { // 渠道卡券领取(带参数，分享后的路径)
    path: '/receiveChannelShared/:id/:type/:sharetype',
    name: 'receiveChannel',
    component: receiveChannel
  }, { // 抢购
    path: '/rush',
    name: 'rush',
    component: rush
  }, { // 台历活动页
    path: '/calendar',
    name: 'calendar',
    component: calendar
  }, { // 活动列表
    path: '/activeList',
    name: 'activeList',
    component: activeList
  }, { // 定制详情
    path: '/customizationDetail',
    name: 'customizationDetail',
    component: customizationDetail
  }, { // 定制列表
    path: '/customizationList',
    name: 'customizationList',
    component: customizationList
  }, { // 台历模板选择
    path: '/checkModel',
    name: 'checkModel',
    component: checkModel
  }, { // 台历制作
    path: '/making',
    name: 'making',
    component: making
  }, { // 台历预览
    path: '/preview',
    name: 'preview',
    component: preview
  }],
  linkActiveClass: 'active',
})

router.beforeEach((to, from, next) => {
  // console.log(to)
  // if(){

  // }
  next()
})

export default router
