import Vue from 'vue'
import Router from 'vue-router'
// 运营商
import YysSosAlarm from '@/pages/yys/alarm/sos_alarm'


Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: "/",
      name: "index",
      component: () => import('@/pages/kede/common/layout'),
      redirect:"/location",
      children:[
        {
          path: "/location",
          name:"location",
          component: () => import("@/pages/kede/location"),
        },
        {
          path: "/more",
          name:"more",
          component: () => import("@/pages/kede/more"),
        },
        {
          path: "/chat",
          name:"chat",
          component: () => import("@/pages/kede/chat"),
        },
        {
          path: "/alarm",
          name:"alarm",
          component: () => import("@/pages/kede/alarm"),
        },
        {
          path: "/fence",
          name:"fence",
          component: () => import("@/pages/kede/fence"),
        },
      ],
      meta:{
        requireAuth: true,
        showHeader: true
      }
    },
    
    {
      path: "/first",
      name:"first",
      component: () => import("@/pages/kede/first"),
    },
    {
      path: '/login',
      name: 'login',
      component: () => import("@/pages/kede/login/login"),
    },
    {
      path: '/register',
      name: 'register',
      component: () => import("@/pages/kede/login/register"),
    },
    {
      path: '/reset_pwd',
      name: 'reset_pwd',
      component: () => import("@/pages/kede/login/reset_pwd"),
    },
    {
      path: '/edit_profile',
      name: 'profile',
      component: () => import("@/pages/kede/login/edit_profile"),
    },
    {
      path: "/route_search/:imei",
      name:"routesearch",
      component: () => import("@/pages/kede/route_search"),
      // "meta": {
      //   "keepAlive": true  // 需要缓存
      // }
    },
    {
      path: "/route_play",
      name:"routeplay",
      component: () => import("@/pages/kede/route_play"),
    },
    {
      path: "/fence_add",
      name:"fenceadd",
      component: () => import("@/pages/kede/fence_add"),
    },
    {
      path: "/fence_edit",
      name:"fenceedit",
      component: () => import("@/pages/kede/fence_edit"),
    },
    {
      path: "/sysfence_watch",
      name:"watchasysfence",
      component: () => import("@/pages/kede/sysfence_watch"),
    },    
    {
      path: "/voice",
      name:"voice",
      component: () => import("@/pages/kede/voices_v2"),
    },
    {
      path: "/voice_clone/:imei/:name",
      name:"voice_clone",
      component: () => import("@/pages/kede/voices_bak"),
    },
    {
      path: "/devices",
      name:"devices",
      component: () => import("@/pages/kede/devices/index"),
    },
    {
      path: "/insure",
      name:"insure",
      component: () => import("@/pages/kede/insure/index"),
    },
    {
      path: "/buy_insure",
      name:"buyInsure",
      component: () => import("@/pages/kede/devices/buyInsure.vue"),
    },
    
    {
      path: '/news',
      name: 'news',
      meta: {
        keepAlive: true,
      },
      component: () => import("@/pages/kede/news/index.vue"),
    },
    {
      path: '/news_detail',
      name: 'news_detail',
      component: () => import("@/pages/kede/news/detail.vue"),
    },
    {
      path: '/activities',
      name: 'activities',
      component: () => import("@/pages/kede/activities/index.vue"),
    },
    {
      path: '/activities_detail',
      name: 'activities_detail',
      component: () => import("@/pages/kede/activities/detail.vue"),
    },
    {
      path: '/courses',
      name: 'courses',
      meta: {
        keepAlive: true,
      },
      component: () => import("@/pages/kede/courses"),
    },
    {
      path: '/courses_detail',
      name: 'courses_detail',
      component: () => import("@/pages/kede/courses/detail"),
    },
    {
      path: '/courses_video',
      name: 'courses_video',
      meta: {
        keepAlive: true,
      },
      component: () => import("@/pages/kede/courses/videos"),
    },
    {
      path: '/courses_video_detail',
      name: 'courses_video_detail',
      component: () => import("@/pages/kede/courses/videos/detail"),
    },
    {
      path: '/alarm_records',
      name: 'alarm_records',
      component: () => import("@/pages/kede/alarms/sos_index"),
    },
    {
      path: '/alarm_detail',
      name: 'alarm_detail',
      component: () => import("@/pages/kede/alarms/detail"),
    },
    {
      path: '/vehicle_verify',
      name: 'vehicle',
      component: () => import("@/pages/vehicle_temp/vehicle_verify"),
    },
    {
      path: '/vehicle_verify_decode',
      name: 'vehicledecode',
      component: () => import("@/pages/vehicle_temp/vehicle_verify_decode"),
    },
    // 运营商
    {
      path: "/yys",
      name: "yys",
      component : () => import('@/pages/kede/common/layout_yys'),
      redirect:"/yys_location",   
      "meta": {
        role: 'yys',
      },
      children:[
        {
          path: "/yys_location",
          name:"yys_location",
          component: () => import("@/pages/kede/yys/location"),   
          meta: {
            role: 'yys',
          },
        },
        {
          path: "/yys_more",
          name:"yys_more",
          component: () => import("@/pages/kede/yys/more"),   
          meta: {
            role: 'yys',
          },
        },
        {
          path: "/yys_devices",
          name:"yys_devices",
          component: () => import("@/pages/kede/yys/devices"),   
          meta: {
            role: 'yys',
            keepAlive: true,
          },
        },
        {
          path: "/yys_alarms",
          name:"yys_alarms",
          component: () => import("@/pages/kede/yys/alarms"),   
          meta: {
            role: 'yys',
            keepAlive: true
          },
        },
        {
          path: "/yys_fences",
          name:"yys_fences",
          component: () => import("@/pages/kede/yys/fences"),   
          meta: {
            role: 'yys',
          },
        },
      ], 
    },
    {
      path: '/yys_login',
      name: 'yys_login',
      meta: {
        role: 'yys',
      },
      component: () => import("@/pages/kede/yys/login"),
    },
    {
      path: '/yys_profile',
      name: 'yys_profile',
      meta: {
        role: 'yys',
      },
      component: () => import("@/pages/kede/yys/profile.vue"),
    },
    {
      path: '/yys_add_pan',
      name: 'yys_add_pan',
      meta: {
        role: 'yys',
      },
      component: () => import("@/pages/kede/yys/alarms/add.vue"),
    },
    {
      path: '/yys_alarm_detail',
      name: 'yys_alarm_detail',
      meta: {
        role: 'yys',
      },
      component: () => import("@/pages/kede/yys/alarms/detail.vue"),
    },
    {
      path: '/yys_device_detail',
      name: 'yys_device_detail',
      meta: {
        role: 'yys',
      },
      component: () => import("@/pages/kede/yys/devices/detail.vue"),
    },
    {
      path: '/yys_route_play',
      name: 'yys_route_play',
      meta: {
        role: 'yys',
      },
      component: () => import("@/pages/kede/yys/routes/play.vue"),
    },
    {
      path: '/yys_route_search/:imei',
      name: 'yys_route_search',
      meta: {
        role: 'yys',
      },
      component: () => import("@/pages/kede/yys/routes/search.vue"),
    },
    {
      path: "/yys_fence_fenceshape",
      name:"yys_fence_fenceshape",
      component: () => import("@/pages/kede/yys/fences/fenceshape"),   
      meta: {
        role: 'yys',
      },
    },
    {
      path: "/yys_fence_addedit",
      name:"yys_fence_addedit",
      component: () => import("@/pages/kede/yys/fences/addedit"),   
      meta: {
        role: 'yys',
      },
    },

  ]
})