import Vue from 'vue'
import Router from 'vue-router'
// import vantui from 'vant'
// import 'vant/lib/index.css'
import home from '@/components/pages/home.vue'
import learning from '@/components/pages/learning'
import my from '@/components/pages/my.vue'
import find from '@/components/pages/find.vue'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: home,
      meta: {
        title: '家校社',
        requireAuth: ''  // 是否需要判断是否登录,这里是需要判断
      }
    },
    {
      path: '/learning',
      name: 'learning',
      component: learning,
      meta: {
        title: '五育融合',
        requireAuth: true  // 是否需要判断是否登录,这里是需要判断
      }
    },
    {
      path: '/my',
      name: 'my',
      component: my,
      meta: {
        title: '我的',
        requireAuth: true  // 是否需要判断是否登录,这里是需要判断
      }
    },
    {
      path: '/find',
      name: 'find',
      component: find,
      meta: {
        title: '创新',
        requireAuth: true  // 是否需要判断是否登录,这里是需要判断
      }
    },
    {
      path: '/workDetail',
      name: 'workDetail',
      component: () => import('@/components/pages/workDetail'),
      meta: {
        title: '作业详情',
      }
    },
    {
      path: '/submitWork',
      name: 'submitWork',
      component: () => import('@/components/pages/submitWork'),
      meta: {
        title: '提交作业',
      }
    },
    {
      path: '/examine',
      name: 'examine',
      component: () => import('@/components/pages/examine'),
      meta: {
        title: '义工团审核',
      }
    },
    {
      path: '/myDetail',
      name: 'myDetail',
      component: () => import('@/components/pages/myDetail'),
      meta: {
        title: '个人资料',
      }
    },
    {
      path: '/examineWork',
      name: 'examineWork',
      component: () => import('@/components/pages/examineWork'),
      meta: {
        title: '义工任务审核',
      }
    },
    {
      path: '/release',
      name: 'release',
      component: () => import('@/components/pages/release'),
      meta: {
        title: '发布内容',
      }
    },
    {
      path: '/findDetail',
      name: 'findDetail',
      component: () => import('@/components/pages/findDetail'),
      meta: {
        title: '创新',
      }
    },
    {
      path: '/myWorkDetail',
      name: 'myWorkDetail',
      component: () => import('@/components/pages/myWorkDetail'),
      meta: {
        title: '详情',
      }
    }
  ]
})

const VueRouterPush = Router.prototype.push
Router.prototype.push = function push(to) {
  return VueRouterPush.call(this, to).catch(err => err)
}

