import Vue from 'vue'
import Router from 'vue-router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import classA from '@/components/pages/class'
import course from '@/components/pages/course'
import courseDetail from '@/components/pages/courseDetail'
import data from '@/components/pages/data'
import notice from '@/components/pages/notice'
import student from '@/components/pages/student'
import works from '@/components/pages/works'
import login from '@/components/login'
import ask from '@/components/pages/ask'
import addCourse from '@/components/pages/addCourse'
import library from '@/components/pages/library'

Vue.use(Router).use(ElementUI)

export default new Router({
  routes: [
    {
      path: '/class',
      name: 'class',
      component: classA,
      meta: {
        requireAuth: true
      }
    },
    // {
    //   path: '/',
    //   redirect: '/course',
    // },
    {
      path: '/course',
      component: course,
      meta: {
        requireAuth: true // 是否需要判断是否登录,这里是需要判断
      }
    },
    {
      path: '/course/courseDetail',
      component: courseDetail,
      meta: {
        requireAuth: true // 是否需要判断是否登录,这里是需要判断
      }
    },
    {
      path: '/course/addCourse',
      component: addCourse,
      meta: {
        requireAuth: true // 是否需要判断是否登录,这里是需要判断
      }
    },
    {
      path: '/data',
      name: 'data',
      component: data,
      meta: {
        requireAuth: true // 是否需要判断是否登录,这里是需要判断
      }
    }, {
      path: '/notice',
      name: 'notice',
      component: notice,
      meta: {
        requireAuth: true // 是否需要判断是否登录,这里是需要判断
      }
    },
    {
      path: '/student',
      name: 'student',
      component: student,
      meta: {
        requireAuth: true // 是否需要判断是否登录,这里是需要判断
      }
    },
    {
      path: '/ask',
      name: 'ask',
      component: ask,
      meta: {
        requireAuth: true // 是否需要判断是否登录,这里是需要判断
      }
    },
    {
      path: '/ask/askList',
      name: 'askList',
      component: () => import('@/components/pages/askList'),
      meta: {
      }
    },
    {
      path: '/works',
      name: 'works',
      component: works,
      meta: {
        requireAuth: true // 是否需要判断是否登录,这里是需要判断
      }
    },
    {
      path: '/library',
      name: 'library',
      component: library,
      meta: {
        requireAuth: true // 是否需要判断是否登录,这里是需要判断
      }
    },
    {
      path: '/login',
      name: 'login',
      component: login,
      meta: {
        requireAuth: '' // 不需要鉴权
      }
    }
  ]
})
