import Vue from 'vue';
import VueRouter from 'vue-router';
import checkLogin from './before';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: 'index',
    meta: { title: '首页' },
    component: () => import('../views/index.vue'),
  },
  {
    path: '/anchor/index',
    meta: { title: '主播管理' },
    component: () => import('../views/anchor/index.vue'),
  },

  {
    path: '/anchor/detail',
    meta: { title: '主播详情' },
    component: () => import('../views/anchor/detail.vue'),
  },
  {
    path: '/role/index',
    meta: { title: '菜单管理' },
    component: () => import('../views/role/index.vue'),
  },

  {
    path: '/role/detail',
    meta: { title: '菜单详情' },
    component: () => import('../views/role/detail.vue'),
  },
  {
    path: '/live/index',
    meta: { title: '直播管理' },
    component: () => import('../views/live/index.vue'),
  },
  {
    path: '/live/detail',
    meta: { title: '直播详情' },
    component: () => import('../views/live/detail.vue'),
  },
  {
    path: '/live/meetingDetail',
    meta: { title: '会议直播详情' },
    component: () => import('../views/live/meetingDetail.vue'),
  },

  {
    path: '/room/index',
    meta: { title: '房间管理' },
    component: () => import('../views/room/index.vue'),
  },
  {
    path: '/room/detail',
    meta: { title: '房间详情' },
    component: () => import('../views/room/detail.vue'),
  },
  {
    path: '/room/detailStatus',
    meta: { title: '房间状态审核' },
    component: () => import('../views/room/detailStatus.vue'),
  },
  // 统计
  {
    path: '/room/statList',
    meta: { title: '房间观看人数统计' },
    component: () => import('../views/room/statList.vue'),
  },

  {
    path: '/test/index',
    meta: { title: '测试管理' },
    component: () => import('../views/test/index.vue'),
  },
  {
    path: '/test/detail',
    meta: { title: '添加' },
    component: () => import('../views/test/detail.vue'),
  },
  {
    path: '/question/index',
    meta: { title: '问卷管理' },
    component: () => import('../views/question/index.vue'),
  },
  {
    path: '/login',
    name: 'login',
    meta: { title: '登录' },
    component: () => import('../views/login.vue'),
  },
];
const router = new VueRouter({
  mode: 'history',
  base: process.env.NODE_ENV === 'development' ? '' : process.env.VUE_APP_ROUTER,
  routes,
});
checkLogin(router);
export default router;
