import layoutHeaderAside from '@/layout/header-aside'

// 由于懒加载页面太多的话会造成webpack热更新太慢，所以开发环境不使用懒加载，只有生产环境使用懒加载
const _import = require('@/libs/util.import.' + process.env.NODE_ENV)

/**
 * 在主框架内显示
 */
const frameIn = [
 
  {
    path: '/',
    redirect: { name: 'index' },
    component: layoutHeaderAside,
    children: [
      // 首页
      {
        path: 'index',
        name: 'index',
        meta: {
          auth: true
        },
        component: _import('system/index')
      },
       // 首页
       {
        path: 'feedBack',
        name: 'feedback',
        meta: {
          auth: true
        },
        component: _import('system/feedback')
      },
      //  仓房展示/仓内遨游
      {
        path: 'warehouseTravel',
        name: 'warehouseTravel',
        meta: {
          title: '仓内遨游',
          auth: true
        },
        component: _import('demo/warehouseShow/warehouseTravel')
      },
        //  仓房展示/仓房信息
        {
          path: 'warehouseInfo',
          name: 'warehouseInfo',
          meta: {
            title: '仓房信息',
            auth: true
          },
          component: _import('demo/warehouseShow/warehouseInfo')
        },
         //  仓房展示/仓房信息详情
        {
          path: 'warehouseInfo-check',
          name: 'warehouseInfo-check',
          meta: {
            title: '仓房信息详情',
            auth: true
          },
          component: _import('demo/warehouseShow/warehouseInfo/warehouseInfo-check.vue')
        },

        //报警记录
        {
          path: 'alarmRecord',
          name: 'alarmRecord',
          meta: {
            auth: true
          },
          component: _import('demo/alarmRecord/index')
        },
         //数据查询
         {
          path: 'dataQuery',
          name: 'dataQuery',
          meta: {
            auth: true
          },
          component: _import('demo/dataQuery/index')
        },
        // 系统管理/组织机构
      {
        path: 'organization',
        name: 'organization',
        meta: {
          title: '组织机构',
          auth: true
        },
        component: _import('demo/system/organization')
      },
        // 系统管理/用户管理
        {
          path: 'userManagement',
          name: 'userManagement',
          meta: {
            title: '用户管理',
            auth: true
          },
          component: _import('demo/system/userManagement')
        },
          // 系统管理/角色管理
      {
        path: 'roleManagement',
        name: 'roleManagement',
        meta: {
          title: '角色管理',
          auth: true
        },
        component: _import('demo/system/roleManagement')
      },
        // 系统管理/公告管理
        {
          path: 'announcementManagement',
          name: 'announcementManagement',
          meta: {
            title: '公告管理',
            auth: true
          },
          component: _import('demo/system/announcementManagement')
        },
          // 系统管理/操作日志
      {
        path: 'operationLog',
        name: 'operationLog',
        meta: {
          title: '操作日志',
          auth: true
        },
        component: _import('demo/system/operationLog')
      },
           // 参数设置/硬件参数
           {
            path: 'hardwareParame',
            name: 'hardwareParame',
            meta: {
              title: '硬件参数',
              auth: true
            },
            component: _import('demo/parameManagement/hardwareParame')
          },
            // 参数设置/硬件参数
            {
              path: 'scanParame',
              name: 'scanParame',
              meta: {
                title: '扫描参数',
                auth: true
              },
              component: _import('demo/parameManagement/scanParame')
            },
             // 参数设置/报警参数
             {
              path: 'alarmParame',
              name: 'alarmParame',
              meta: {
                title: '扫描参数',
                auth: true
              },
              component: _import('demo/parameManagement/alarmParame')
            },
            // 参数设置/数据字典
            {
              path: 'dataDictionary',
              name: 'dataDictionary',
              meta: {
                title: '数据字典',
                auth: true
              },
              component: _import('demo/parameManagement/dataDictionary')
            },

      // 系统 前端日志
      {
        path: 'log',
        name: 'log',
        meta: {
          title: '前端日志',
          auth: true
        },
        component: _import('system/log')
      },
      // 刷新页面 必须保留
      {
        path: 'refresh',
        name: 'refresh',
        hidden: true,
        component: _import('system/function/refresh')
      },
      // 页面重定向 必须保留
      {
        path: 'redirect/:route*',
        name: 'redirect',
        hidden: true,
        component: _import('system/function/redirect')
      }
    ]
  }
]

/**
 * 在主框架之外显示
 */
const frameOut = [
  // 登录
  {
    path: '/login',
    name: 'login',
    component: _import('system/login')
  },
   //空白页
   {
    path: '/abc',
    name: 'Abc',
    meta: {
      auth: true
    },
    component: _import('system/abc')
  },
]

/**
 * 错误页面
 */
const errorPage = [
  {
    path: '*',
    name: '404',
    component: _import('system/error/404')
  }
]

// 导出需要显示菜单的
export const frameInRoutes = frameIn

// 重新组织后导出
export default [
  ...frameIn,
  ...frameOut,
  ...errorPage
]
