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


// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const Index = () => import('@/components/Index')

// --------------------------------------个人中心 --------------------------------------------------
const PersonMsg = () => import( /* webpackChunkName: "shouye" */ '@/pages/personage/personMsg')


// --------------------------------------测报模块---------------------------测报灯-----------------------
const Cbd = () => import( /* webpackChunkName: "qxz" */ '@/Pages/forecasting/cbd/Cbd')
const CbdDataDetails = () => import( /* webpackChunkName: "qxz" */ '@/Pages/forecasting/cbd/DataDetails')
const cbdDataPhotos = () => import( /* webpackChunkName: "qxz" */ '@/Pages/forecasting/cbd/CbdDataPhotos')
const CbdHistoryData = () => import( /* webpackChunkName: "qxz" */ '@/Pages/forecasting/cbd/HistoryData')
const PestsStats = () => import( /* webpackChunkName: "qxz" */ '@/Pages/forecasting/cbd/PestsStats')
const MessageWarn = () => import( /* webpackChunkName: "qxz" */ '@/Pages/forecasting/cbd/MessageWarn')


//---------------------------------------测报模块-----------------------------孢子仪-------------------------
const Bzy = () => import( /* webpackChunkName: "bzy" */ '@/Pages/forecasting/bzy/Bzy')
const BzyPhotos = () => import( /* webpackChunkName: "bzy" */ '@/Pages/forecasting/bzy/BzyPhotos')
const DataDetail = () => import( /* webpackChunkName: "bzy" */ '@/Pages/forecasting/bzy/DataDetail')

//---------------------------------------测报模块-----------------------------性诱测报-------------------------
const Xycb = () => import( /* webpackChunkName: "xycb" */ '@/Pages/forecasting/xycb/Xycb')
const xycbDataPhotos = () => import( /* webpackChunkName: "xycb" */ '@/Pages/forecasting/xycb/XycbDataPhotos')
const xycbDataDetail = () => import( /* webpackChunkName: "xycb" */ '@/Pages/forecasting/xycb/XycbDataDetail')


//---------------------------------------防治模块---------------------------杀虫灯-------------------------
const Scd = () => import( /* webpackChunkName: "scd" */ '@/Pages/cure/scd/scd')
const ScdDetail = () => import( /* webpackChunkName: "scd" */ '@/Pages/cure/scd/scdDetail')

Vue.use(Router)

export default new Router({
  routes: [{
    path: '/index',
    component: Index,
    children: [{
        path: 'personMsg',
        component: PersonMsg
      },
      // -----------------测报模块------------测报灯------------
      {
        path: 'cbd',
        component: Cbd
      },
      {
        path: 'cbdDataDetails/:e_id/:d_id',
        component: CbdDataDetails
      },
      {
        path: 'cbdDataPhotos/:id',
        component: cbdDataPhotos
      },
      {
        path: 'cbdhistorydata',
        component: CbdHistoryData
      },
      {
        path: 'pestsStats/:id',
        component: PestsStats
      },
      {
        path: 'messageWarn/:id',
        component: MessageWarn
      },
      //------------------测报模块-------------孢子仪-------------
      {
        path: 'bzy',
        component: Bzy
      },
      {
        path: 'bzyPhotos/:id',
        component: BzyPhotos
      },
      {
        path: 'dataDetail/:e_id/:d_id',
        component: DataDetail
      },
      //------------------测报模块-------------性诱测报-------------
      {
        path: 'xycb',
        component: Xycb
      },
      {
        path: 'xycbDataPhotos/:id',
        component: xycbDataPhotos
      },
      {
        path: 'xycbDataDetail/:e_id/:d_id',
        component: xycbDataDetail
      },
      //------------------防治模块-------------杀虫灯-------------
      {
        path: 'scd',
        component: Scd
      },
      {
        path: 'scdDetail/:e_id/:d_id',
        component: ScdDetail
      },
    ]
  }, ],
  // mode:'history'
})