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

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/login',
      name: 'Login',
      component: require('@/page/login').default
    },
    {
      path: '/',
      name: 'Layout',
      component: require('@/page/layout').default,
      children: [
        {
          path: '/home',
          name: 'Home',
          component: require('@/page/home').default,
          meta: {text: '首页'}
        },
        {
          path: '/order',
          name: 'Order',
          component: require('@/page/order').default,
          meta: {text: '订单管理'}
        },
        {
          path: '/feedback',
          name: 'feedback',
          component: require('@/page/feedback').default,
          meta: {text: '反馈消息'}
        },
        {
          path: '/device',
          name: 'device',
          component: require('@/page/device').default,
          meta: {text: '反馈消息'}
        },
        {
          path: '/scene',
          name: 'scene',
          component: require('@/page/scene').default,
          meta: {text: '场景管理'}
        },
        {
          path: '/user',
          name: 'User',
          component: require('@/page/user').default,
          meta: {text: '设备查询'},
          children: [
            {
              path: '/',
              name: 'user-list',
              component: require('@/page/user/query-list').default
            },
            {
              path: ':id-:rid',
              name: 'user-detail',
              meta: { text: '用户明细' },
              component: require('@/page/user/query-detail').default
            }
          ]
        },
        {
          path: '/distributor',
          name: 'Distributor',
          component: require('@/page/distributor').default,
          meta: { text: '经销商申请' },
          children: [
            {
              path: '/',
              name: 'distributor-list',
              component: require('@/page/distributor/query-list').default
            }
          ]
        },
        {
          path: '/leaving',
          name: 'leaving',
          component: require('@/page/leaving').default,
          meta: { text: '留言管理' }
        },
        {
          path: '/edition',
          name: 'edition',
          component: require('@/page/edition').default,
          meta: { text: '版本管理' }
        },
        {
          path: '/',
          name: 'Temp-scene',
          component: require('@/page/layout/temp').default,
          meta: { text: '更多设置' },
          children: [
            {
              path: 'scene',
              name: 'scene',
              component: require('@/page/scene').default
            }
          ]
        },
        {
          path: '/statistics',
          name: 'Statistics',
          component: require('@/page/statistics').default,
          meta: { text: '数据统计' }
        },
        {
          path: '/down',
          name: 'Down',
          component: require('@/page/down').default,
          meta: { text: '数据下载' }
        }
      ]
    }
  ]
})
