import Vue from 'vue'
import Router from 'vue-router'
const _import = require('./_import_' + process.env.NODE_ENV)
// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

/** note: submenu only apppear when children.length>=1
*   detail see  https://panjiachen.github.io/vue-element-admin-site/#/router-and-nav?id=sidebar
**/

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    roles: ['admin','editor']     will control the page roles (you can set multiple roles)
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
    noCache: true                if fasle ,the page will no be cached(default is false)
  }
**/
export const constantRouterMap = [
  { path: '/login', component: _import('login/index'), hidden: true },
  { path: '/authredirect', component: _import('login/authredirect'), hidden: true },
  { path: '/404', component: _import('error/404'), hidden: true },
  { path: '/401', component: _import('error/401'), hidden: true },
  {
    path: '',
    component: Layout,
    redirect: 'dashboard',
    children: [{
      path: 'dashboard',
      component: _import('dashboard/index'),
      name: 'dashboard',
      meta: { title: '首页', icon: 'dashboard', noCache: true }
    }]
  }
]

export default new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})

export const asyncRouterMap = [
  {
    path: '/cockpit',
    component: Layout,
    redirect: 'noredirect',
    name: 'cockpit',
    meta: {
      title: '运营驾驶舱',
      icon: 'paihang'
    },
    children: [
      { path: 'cockpit', component: _import('cockpit/index'), name: 'cockpit', meta: { title: '运营驾驶舱', icon: 'paihang', noCache: true }},
    ]
  },
  {
    path: '/activeUsers',
    component: Layout,
    redirect: 'noredirect',
    name: 'activeUsers',
    meta: {
      title: '活跃用户',
      icon: 'paihang'
    },
    children: [
      { path: 'activeUsers', component: _import('activeUsers/index'), name: 'activeUsers', meta: { title: '活跃用户', icon: 'paihang', noCache: true }},
    ]
  },
  {
    path: '/pointsLottery',
    component: Layout,
    redirect: 'noredirect',
    name: 'pointsLottery',
    meta: {
      title: '积分抽奖',
      icon: 'paihang'
    },
    children: [
      { path: 'pointsLottery', component: _import('pointsLottery/index'), name: 'pointsLottery', meta: { title: '积分抽奖', icon: 'paihang', noCache: true }},
    ]
  },
  {
    path: '/pointManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'pointManage',
    meta: {
      title: '积分管理',
      icon: 'jifen'
    },
    children: [
      { path: 'pointInstructions', component: _import('pointManage/pointInstructions'), name: 'pointInstructions', meta: { title: '积分规则说明书', noCache: true }},
      { path: 'pointRulesList', component: _import('pointManage/pointRulesList'), name: 'pointRulesList', meta: { title: '积分规则列表', noCache: true }},
      { path: 'pointIndateList', component: _import('pointManage/pointIndateList'), name: 'pointIndateList', meta: { title: '积分有效期列表', noCache: true }},
      { path: 'pointList', component: _import('pointManage/pointList'), name: 'pointList', meta: { title: '积分列表', noCache: true }},
      { path: 'pointsDetailList', component: _import('pointManage/pointsDetailList'), name: 'pointsDetailList', meta: { title: '积分明细列表', noCache: true }},
      { path: 'pointsPlusOrMinus', component: _import('pointManage/pointsPlusOrMinus'), name: 'pointsPlusOrMinus', meta: { title: '积分加减列表', noCache: true }},
    ]
  },
  {
    path: '/goodsManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'goodsManage',
    meta: {
      title: '商品管理',
      icon: 'shangpin'
    },
    children: [
      { path: 'goodsExchangeRules', component: _import('goodsManage/goodsExchangeRules'), name: 'goodsExchangeRules', meta: { title: '兑换须知', noCache: true }},
      { path: 'goodsList', component: _import('goodsManage/goodsList'), name: 'goodsList', meta: { title: '商品列表', noCache: true }},
    ]
  },
  {
    path: '/giftManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'giftManage',
    meta: {
      title: '礼品管理',
      icon: 'lipin'
    },
    children: [
      { path: 'giftExchangeRules', component: _import('giftManage/giftExchangeRules'), name: 'giftExchangeRules', meta: { title: '兑换须知', noCache: true }},
      { path: 'giftList', component: _import('giftManage/giftList'), name: 'giftList', meta: { title: '礼品列表', noCache: true }},
    ]
  },
  {
    path: '/welfareManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'welfareManage',
    meta: {
      title: '福利管理',
      icon: 'fuli'
    },
    children: [
      { path: 'welfareList', component: _import('welfareManage/welfareList'), name: 'welfareList', meta: { title: '福利列表', icon: 'lipin', noCache: true }},
      // { path: 'welfareList', component: _import('welfareManage/welfareList'), name: 'welfareList', meta: { title: '福利列表', noCache: false, hideTag: true, hidden: true}},
    ]
  },
  {
    path: '/exchangeManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'exchangeManage',
    meta: {
      title: '兑换管理',
      icon: 'duihuan'
    },
    children: [
      { path: 'exchangeList', component: _import('exchangeManage/exchangeList'), name: 'exchangeList', meta: { title: '兑换列表', noCache: true }},
      { path: 'cancelledList', component: _import('exchangeManage/cancelledList'), name: 'cancelledList', meta: { title: '已作废列表', noCache: true }},
      { path: 'approvalList', component: _import('exchangeManage/approvalList'), name: 'approvalList', meta: { title: '待审批列表', noCache: true }},
      { path: 'pasList', component: _import('exchangeManage/pasList'), name: 'pasList', meta: { title: '待发货列表', noCache: true }},
      { path: 'voidList', component: _import('exchangeManage/voidList'), name: 'voidList', meta: { title: '订单已完成列表', noCache: true }},
    ]
  },
  {
    path: '/activityManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'activityManage',
    meta: {
      title: '活动管理',
      icon: 'huodong'
    },
    children: [
      { path: 'activityList', component: _import('activityManage/activityList'), name: 'activityList', meta: { title: '活动列表', icon: 'huodong', noCache: true }},
      // { path: 'activityList', component: _import('activityManage/activityList'), name: 'activityList', meta: { title: '活动列表', noCache: false, hideTag: true, hidden: true}},
    ]
  },
  {
    path: '/answerGame',
    component: Layout,
    redirect: 'noredirect',
    name: 'answerGame',
    meta: {
      title: '答题管理',
      icon: 'huodong'
    },
    children: [
      { path: 'answerList', component: _import('answerGame/answerList'), name: 'answerList', meta: { title: '答题列表', icon: 'huodong', noCache: true }},
    ]
  },
  {
    path: '/noticeManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'noticeManage',
    meta: {
      title: '通知管理',
      icon: 'tongzhi'
    },
    children: [
      { path: 'noticeList', component: _import('noticeManage/noticeList'), name: 'noticeList', meta: { title: '通知列表', icon: 'tongzhi', noCache: true }},
      // { path: 'noticeList', component: _import('noticeManage/noticeList'), name: 'noticeList', meta: { title: '通知列表', noCache: false, hideTag: true, hidden: true}},
    ]
  },
  {
    path: '/ranking',
    component: Layout,
    redirect: 'noredirect',
    name: 'ranking',
    meta: {
      title: '积分排行',
      icon: 'paihang'
    },
    children: [
      { path: 'rankingList', component: _import('ranking/rankingList'), name: 'rankingList', meta: { title: '积分排行', icon: 'paihang', noCache: true }},
    ]
  },
  {
    path: '/medalManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'medalManage',
    meta: {
      title: '勋章管理',
      icon: 'xunzhang'
    },
    children: [
      { path: 'medalList', component: _import('medalManage/medalList'), name: 'medalList', meta: { title: '勋章列表', noCache: true }},
      { path: 'medalDataList/:id', component: _import('medalManage/medalDataList'), name: 'medalDataList', meta: { title: '勋章等级列表', noCache: false, hideTag: true, hidden: true }},
    ]
  },
  {
    path: '/raffleManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'raffleManage',
    meta: {
      title: '抽奖管理',
      icon: 'huodong'
    },
    children: [
      { path: 'raffleList', component: _import('raffleManage/raffleList'), name: 'raffleList', meta: { title: '奖池列表', noCache: true }},
      { path: 'raffleLogsList', component: _import('raffleManage/raffleLogsList'), name: 'raffleLogsList', meta: { title: '抽奖记录', noCache: true }},
      { path: 'raffleDataList/:id', component: _import('raffleManage/raffleDataList'), name: 'raffleDataList', meta: { title: '奖池奖品', noCache: false, hideTag: true, hidden: true }},
    ]
  },
  {
    path: '/lotteryManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'lotteryManage',
    meta: {
      title: '开奖管理',
      icon: 'huodong'
    },
    children: [
      { path: 'lotteryList', component: _import('lotteryManage/lotteryList'), name: 'lotteryList', meta: { title: '奖池列表', noCache: true }},
      { path: 'lotteryLogsList', component: _import('lotteryManage/lotteryLogsList'), name: 'lotteryLogsList', meta: { title: '抽奖记录', noCache: true }},
      { path: 'lotteryDataList/:id', component: _import('lotteryManage/lotteryDataList'), name: 'lotteryDataList', meta: { title: '奖池奖品', noCache: false, hideTag: true, hidden: true }},
    ]
  },
  {
    path: '/couponsManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'couponsManage',
    meta: {
      title: '兑换卷管理',
      icon: 'huodong'
    },
    children: [
      { path: 'couponsList', component: _import('couponsManage/couponsList'), name: 'couponsList', meta: { title: '兑换卷列表', icon: 'huodong', noCache: true }},
    ]
  },
  {
    path: '/commendManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'commendManage',
    meta: {
      title: '表彰管理',
      icon: 'xunzhang'
    },
    children: [
      { path: 'commendList', component: _import('commendManage/commendList'), name: 'commendList', meta: { title: '表彰列表', noCache: true }},
      { path: 'commendDataList/:id', component: _import('commendManage/commendDataList'), name: 'commendDataList', meta: { title: '表彰人员', noCache: false, hideTag: true, hidden: true }},
      { path: 'citeList', component: _import('commendManage/citeList'), name: 'citeList', meta: { title: '客户表彰列表', noCache: true }},
      { path: 'operateCiteList', component: _import('commendManage/operateCiteList'), name: 'operateCiteList', meta: { title: '客户表彰审批列表', noCache: true }},
      { path: 'ceoCiteList', component: _import('commendManage/ceoCiteList'), name: 'ceoCiteList', meta: { title: '客户表彰确认列表', noCache: true }},
    ]
  },
  {
    path: '/trainManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'trainManage',
    meta: {
      title: '培训管理',
      icon: 'xunzhang'
    },
    children: [
      { path: 'upLoadFileRules', component: _import('trainManage/upLoadFileRules'), name: 'upLoadFileRules', meta: { title: '培训材料备注', noCache: true }},
      { path: 'trainList', component: _import('trainManage/trainList'), name: 'trainList', meta: { title: '培训列表', noCache: true }},
      { path: 'operateTrainList', component: _import('trainManage/operateTrainList'), name: 'operateTrainList', meta: { title: '培训审批列表', noCache: true }},
      { path: 'ceoTrainList', component: _import('trainManage/ceoTrainList'), name: 'ceoTrainList', meta: { title: '培训确认列表', noCache: true }},
    ]
  },
  {
    path: '/festivalManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'festivalManage',
    meta: {
      title: '节日管理',
      icon: 'lipin'
    },
    children: [
      { path: 'festivalList', component: _import('festivalManage/festivalList'), name: 'festivalList', meta: { title: '节日列表', icon: 'lipin', noCache: true }},
    ]
  },
  {
    path: '/certManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'certManage',
    meta: {
      title: '证书管理',
      icon: 'zhengshu'
    },
    children: [
      { path: 'certSetList', component: _import('certManage/certSetList'), name: 'certSetList', meta: { title: '证书配置列表', noCache: true }},
      { path: 'certRules', component: _import('certManage/certRules'), name: 'certRules', meta: { title: '积分获取规则', noCache: true }},
      { path: 'certList', component: _import('certManage/certList'), name: 'certList', meta: { title: '证书列表', noCache: true }},
      
    ]
  },
  {
    path: '/yeZhanManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'yeZhanManage',
    meta: {
      title: '叶盏点赞活动',
      icon: 'zhengshu'
    },
    children: [
      { path: 'likeRules', component: _import('yeZhanManage/likeRules'), name: 'likeRules', meta: { title: '活动规则', noCache: true }},
      { path: 'likeList', component: _import('yeZhanManage/likeList'), name: 'likeList', meta: { title: '点赞列表', noCache: true }},
      { path: 'mallVideoList', component: _import('yeZhanManage/mallVideoList'), name: 'mallVideoList', meta: { title: '视频列表', noCache: true }},
      
    ]
  },
  {
    path: '/dictManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'dictManage',
    meta: {
      title: '字典管理',
      icon: 'zidian'
    },
    children: [
      { path: 'dictList', component: _import('dictManage/dictList'), name: 'dictList', meta: { title: '字典列表', noCache: true }},
      { path: 'dictDataList/:id', component: _import('dictManage/dictDataList'), name: 'dictDataList', meta: { title: '字典数据', noCache: false, hideTag: true, hidden: true }},
    ]
  },

  {
    path: '/postManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'postManage',
    meta: {
      title: '帖子管理',
      icon: 'fuli'
    },
    children: [
      { path: 'postList', component: _import('postManage/postList'), name: 'postList', meta: { title: '帖子列表', noCache: true }},
      { path: 'postApprovalList', component: _import('postManage/postApprovalList'), name: 'postApprovalList', meta: { title: '回复列表', noCache: true}},
    ]
  },

  {
    path: '/rankingManage',
    component: Layout,
    redirect: 'noredirect',
    name: 'rankingManage',
    meta: {
      title: '排行管理',
      icon: 'zhengshu'
    },
    children: [
      { path: 'answerRanking', component: _import('rankingManage/answerRanking'), name: 'answerRanking', meta: { title: '答题排行', noCache: true }},
      { path: 'gameRanking', component: _import('rankingManage/gameRanking'), name: 'gameRanking', meta: { title: '游戏排行', noCache: true}},
    ]
  },



  {
    path: '/user',
    component: Layout,
    redirect: 'noredirect',
    name: 'userManage',
    meta: {
      title: '用户管理',
      icon: 'people'
    },
    children: [
      { path: 'user', component: _import('user/user'), name: 'user', meta: { title: '联系人', noCache: true }},
      { path: 'checkUser', component: _import('user/checkUser'), name: 'checkUser', meta: { title: '待审核', noCache: true }},
      { path: 'approveHistory', component: _import('user/approveHistory'), name: 'approveHistory', meta: { title: '驳回记录', noCache: true }},
      { path: 'userDetail', component: _import('user/userDetail'), name: 'userDetail', meta: { title: '用户详情', noCache: false, hideTag: true, hidden: true }},
      { path: 'welfare', component: _import('user/welfare'), name: 'welfare', meta: { title: '用户福利', noCache: true }},
    ]
  },
  {
    path: '/community',
    component: Layout,
    redirect: 'noredirect',
    name: 'communityManage',
    meta: {
      title: '圈子管理',
      icon: 'example'
    },
    children: [
      { path: 'local', component: _import('organize/organizePlace'), name: 'local', meta: { title: '部门专委会', noCache: true }},
      { path: 'industry', component: _import('organize/organizeTrade'), name: 'industry', meta: { title: '技术专委会', noCache: true }},
      { path: 'interest', component: _import('organize/organizeInterest'), name: 'interest', meta: { title: '兴趣小组', noCache: true }}
    ]
  },
  {
    path: '/content',
    component: Layout,
    redirect: 'noredirect',
    name: 'contentManage',
    meta: {
      title: '内容&互动',
      icon: 'language'
    },
    children: [
      { path: 'yearLottoNotice', component: _import('content/yearLottoNotice'), name: 'yearLottoNotice', meta: { title: '年会抽奖规则', noCache: true }},
      { path: 'bannerManage', component: _import('content/banner'), name: 'bannerManage', meta: { title: 'Banner管理', noCache: true }},
      { path: 'schoolInfo', component: _import('content/index'), name: 'schoolInfo', meta: { title: '公司动态', noCache: true }},
      { path: 'newsCenter', component: _import('content/newsCenter'), name: 'newsCenter', meta: { title: '新闻中心', noCache: true }},
      { path: 'customerStories', component: _import('content/customerStories'), name: 'customerStories', meta: { title: '客户案例', noCache: true }},
      { path: 'alumniInfo', component: _import('content/index'), name: 'alumniInfo', meta: { title: '员工风采', noCache: true }},
      { path: 'recruitInfo', component: _import('content/index'), name: 'recruitInfo', meta: { title: '招聘季度之星', noCache: true }},
      { path: 'video', component: _import('content/index'), name: 'video', meta: { title: '年会视频', noCache: true }},
      { path: 'activityNews', component: _import('content/index'), name: 'activityNews', meta: { title: '公司活动', noCache: true }},
      { path: 'activity', component: _import('content/index'), name: 'activity', meta: { title: '互动', noCache: true }},
      { path: 'lecture', component: _import('content/index'), name: 'lecture', meta: { title: '信息中心', noCache: true }},
      { path: 'reading', component: _import('content/index'), name: 'reading', meta: { title: '季刊', noCache: true }},
      { path: 'manual', component: _import('content/index'), name: 'manual', meta: { title: '操作手册', noCache: true }},
      { path: 'rules', component: _import('content/index'), name: 'rules', meta: { title: '规章制度', noCache: true }},
      { path: 'notice', component: _import('content/index'), name: 'notice', meta: { title: '公告管理', noCache: true }},
      { path: 'comment', component: _import('content/comment'), name: 'comment', meta: { title: '评论管理', noCache: true }},
      { path: 'questions', component: _import('content/questions'), name: 'questions', meta: { title: '提问管理', noCache: true }},
      { path: 'contribute', component: _import('content/contribute'), name: 'contribute', meta: { title: '投稿管理', noCache: true }},
      { path: 'questionSort', component: _import('content/questionSort'), name: 'questionSort', meta: { title: 'PK类别管理', noCache: true }},
      { path: 'questionDetail', component: _import('content/questionDetail'), name: 'questionDetail', meta: { title: 'PK题目管理', noCache: true }},
    ]
  },
  {
    path: '/visitor',
    component: Layout,
    redirect: 'noredirect',
    name: 'visitorManage',
    meta: {
      title: '访客管理',
      icon: 'people'
    },
    children: [
      { path: 'visitorList', component: _import('visitor/visitorList'), name: 'visitorList', meta: { title: '访客', noCache: true }},
      { path: 'visitorDetail', component: _import('visitor/visitorDetail'), name: 'visitorDetail', meta: { title: '访客详情', noCache: false, hideTag: true, hidden: true }}
      ]
  },
  {
    path: '/sys',
    component: Layout,
    redirect: 'noredirect',
    name: 'sysManage',
    meta: {
      title: '系统管理',
      icon: 'chart'
    },
    children: [
      { path: 'admin', component: _import('sys/admin'), name: 'admin', meta: { title: '管理员', noCache: true }},
      { path: 'role', component: _import('sys/role'), name: 'role', meta: { title: '角色管理', noCache: true }},
      // { path: 'message', component: _import('sys/admin'), name: 'message', meta: { title: '系统消息', noCache: true, hideTag: true }}
      // { path: 'sms', component: _import('sys/admin'), name: 'sms', meta: { title: '短信通知', noCache: true, hideTag: true }},
      // { path: 'os', component: _import('sys/os'), name: 'os', meta: { title: '对象存储', noCache: true, hideTag: true }}
    ]
  },

  { path: '*', redirect: '/404', hidden: true }
]
