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

// 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'

/**
* 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 redirect in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
**/
export const constantRouterMap = [
  {
    path: '/building',
    component: Layout,
    redirect: '/building/index',
    name: 'building',
    alwaysShow: true,
    meta: { title: '业主/楼栋', icon: 'zip' },
    children: [
      {
        path: '/building/buildingdata/index',
        component: () => import('@/views/building/buildingdata/index'),
        name: 'building-data',
        meta: { title: '楼栋树管理', icon: 'building' }
      },
      {
        path: '/building/buildingdata/batch',
        component: () => import('@/views/building/buildingdata/BuildingBatchImport'),
        name: 'building-batch-import',
        hidden: true,
        meta: { title: '批量导入小区楼栋信息', icon: 'table' }
      },
      {
        path: '/building/index',
        component: () => import('@/views/building/index'),
        name: 'building-index',
        meta: { title: '业主资料库', icon: 'building' }
      },
      {
        path: '/building/info/index',
        component: () => import('@/views/building/info/index'),
        name: 'building-info-index',
        hidden: true,
        meta: { title: '户主资料库详情', icon: 'building' }
      },
      {
        path: '/building/buildingdata/edibuildingdata',
        component: () => import('@/views/building/buildingdata/edibuildingdata'),
        name: 'building-edibuildingdata',
        hidden: true,
        meta: { title: '小区楼栋添加节点', icon: 'building' }
      },
      // {
      //   path: '/owner/index',
      //   component: () => import('@/views/owner/index'),
      //   name: 'owner-index',
      //   meta: { title: '已认证户主', icon: 'building' }
      // },
      {
        path: '/building/batch',
        component: () => import('@/views/building/batch/batchImport'),
        name: 'batch-import',
        hidden: true,
        meta: { title: '批量导入楼栋信息', icon: 'table' }
      },
      {
        path: '/building/add',
        component: () => import('@/views/building/add/index'),
        name: 'building-add',
        hidden: true,
        meta: { title: '添加楼栋户主资料', icon: 'table' }
      },
      {
        path: '/building/edi',
        component: () => import('@/views/building/edi/index'),
        name: 'building-edi',
        hidden: true,
        meta: { title: '修改楼栋户主资料', icon: 'table' }
      },
      {
        path: '/building/audit/index',
        component: () => import('@/views/building/audit/index'),
        name: 'building-audit-index',
        meta: { title: '资料审核', icon: 'building' }
      }
    ]
  },
  {
    path: '/social',
    component: Layout,
    redirect: '/social/index',
    name: 'social',
    alwaysShow: true,
    meta: { title: '论坛内容', icon: 'zip' },
    children: [
      {
        path: '/social/announcement',
        component: () => import('@/views/social/announcement/index'),
        name: 'announcement-index',
        meta: { title: '公告内容', icon: 'table' }
      },
      {
        path: '/social/activity',
        component: () => import('@/views/social/activity/index'),
        name: 'activity-index',
        meta: { title: '活动管理', icon: 'table' }
      },
      {
        path: '/social/transaction',
        component: () => import('@/views/social/transaction/index'),
        name: 'transaction-import',
        meta: { title: '话题', icon: 'table' }
      },
      {
        path: '/transaction/transaction',
        component: () => import('@/views/social/transaction/transactionAdd'),
        name: 'transaction-add',
        hidden: true,
        meta: { title: '添加二手求购', icon: 'table' }
      },
      {
        path: '/transaction/transaction',
        component: () => import('@/views/social/transaction/transactionEdit'),
        name: 'transaction-edit',
        hidden: true,
        meta: { title: '修改二手求购', icon: 'table' }
      },
      {
        path: '/transaction/info',
        component: () => import('@/views/social/transaction/transactionDetails'),
        name: 'transaction-info',
        hidden: true,
        meta: { title: '二手求购租赁详情', icon: 'table' }
      },
      {
        path: '/transaction/reply',
        component: () => import('@/views/social/transaction/reply/transactionreply'),
        name: 'transactionreply-index',
        hidden: true,
        meta: { title: '二手帖子回复列表', icon: 'table' }
      },
      {
        path: '/transaction/transactionReport',
        component: () => import('@/views/social/transaction/transactionReport/report'),
        name: 'transactionReport-index',
        hidden: true,
        meta: { title: '举报列表', icon: 'table' }
      },
      {
        path: '/activity/add',
        component: () => import('@/views/social/activity/add/index'),
        name: 'activity-add',
        hidden: true,
        meta: { title: '添加活动', icon: 'table' }
      },
      {
        path: '/activity/edi',
        component: () => import('@/views/social/activity/edi/index'),
        name: 'activity-edi',
        hidden: true,
        meta: { title: '修改活动', icon: 'table' }
      },
      {
        path: '/activity/info',
        component: () => import('@/views/social/activity/info/index'),
        name: 'activity-info',
        hidden: true,
        meta: { title: '活动详情', icon: 'table' }
      },
      {
        path: '/announcement/add',
        component: () => import('@/views/social/announcement/add'),
        name: 'announcement-add',
        hidden: true,
        meta: { title: '添加公告', icon: 'table' }
      },
      {
        path: '/announcement/edit',
        component: () => import('@/views/social/announcement/edit'),
        name: 'announcement-edit',
        hidden: true,
        meta: { title: '编辑公告', icon: 'table' }
      },
      {
        path: '/signUp/info',
        component: () => import('@/views/social/signUp/index'),
        name: 'signUp-info',
        hidden: true,
        meta: { title: '活动报名人', icon: 'table' }
      },
      {
        path: '/announcement/details',
        component: () => import('@/views/social/announcement/details'),
        name: 'contentParticulars-details',
        hidden: true,
        meta: { title: '公告详情', icon: 'table' }
      },
      {
        path: '/activity/signIn/index',
        component: () => import('@/views/social/activity/signIn/index'),
        name: 'activity-signIn-index',
        hidden: true,
        meta: { title: '活动签到', icon: 'table' }
      }
    ]
  },
  {
    path: '/account',
    component: Layout,
    redirect: '/account/index',
    name: 'account',
    alwaysShow: true,
    meta: { title: '账号管理', icon: 'zip' },
    children: [
      {
        path: '/account/user',
        component: () => import('@/views/account/user/index'),
        name: 'user-index',
        meta: { title: '员工管理', icon: 'table' }
      },
      {
        path: '/account/role',
        component: () => import('@/views/account/role'),
        name: 'role-index',
        meta: { title: '角色管理', icon: 'table' }
      },
      {
        path: '/account/add',
        component: () => import('@/views/account/add/role-add'),
        name: 'role-add',
        hidden: true,
        meta: { title: '添加角色', icon: 'table' }
      },
      {
        path: '/account/edit',
        component: () => import('@/views/account/edit/role-edit'),
        name: 'role-edit',
        hidden: true,
        meta: { title: '修改角色', icon: 'table' }
      },
      {
        path: '/account/info',
        component: () => import('@/views/account/info/role-info'),
        name: 'role-info',
        hidden: true,
        meta: { title: '查看角色', icon: 'table' }
      },
      {
        path: '/account/user/addUser',
        component: () => import('@/views/account/user/addUser'),
        name: 'user-addUser',
        hidden: true,
        meta: { title: '添加成员', icon: 'table' }
      },
      {
        path: '/account/user/editUser',
        component: () => import('@/views/account/user/editUser'),
        name: 'user-edit',
        hidden: true,
        meta: { title: '编辑成员', icon: 'table' }
      }
    ]
  },
  {
    path: '/bill',
    component: Layout,
    redirect: '/bill/index',
    name: 'bill',
    alwaysShow: true,
    meta: { title: '收费管理', icon: 'zip' },
    children: [
      {
        path: '/bill/management',
        component: () => import('@/views/bill/index'),
        name: 'bill-index',
        meta: { title: '收费组管理', icon: 'table' }
      },
      {
        path: '/bill/management/info',
        component: () => import('@/views/bill/info/index'),
        name: 'bill-info',
        hidden: true,
        meta: { title: '收费组详情', icon: 'table' }
      },
      {
        path: '/bill/management/add',
        component: () => import('@/views/bill/add/index'),
        name: 'bill-add',
        hidden: true,
        meta: { title: '新增收费组', icon: 'table' }
      },
      {
        path: '/bill/management/edi',
        component: () => import('@/views/bill/edi/index'),
        name: 'bill-edi',
        hidden: true,
        meta: { title: '修改收费组', icon: 'table' }
      },
      {
        path: '/bill/management/info/bill-edi',
        component: () => import('@/views/bill/info/bill-edi/index'),
        name: 'bill-info-edi',
        hidden: true,
        meta: { title: '收费组详情', icon: 'table' }
      },
      {
        path: '/bill/management/info/bill-add',
        component: () => import('@/views/bill/info/add/index'),
        name: 'bill-info-add',
        hidden: true,
        meta: { title: '添加更多收费单', icon: 'table' }
      },
      {
        path: '/bill/management/statement/index',
        component: () => import('@/views/bill/statement/index'),
        name: 'bill-statement-index',
        meta: { title: '订单列表', icon: 'table' }
      },
      {
        path: '/bill/management/statement/index',
        component: () => import('@/views/bill/statement/info/index'),
        name: 'bill-statement-info-index',
        hidden: true,
        meta: { title: '订单详情', icon: 'table' }
      },
      {
        path: '/bill/management/license',
        component: () => import('@/views/bill/license/index'),
        name: 'bill-license',
        meta: { title: '月租车续费', icon: 'table' }
      }
    ]
  },
  {
    path: '/ticket',
    component: Layout,
    redirect: '/ticket/index',
    name: 'ticket',
    alwaysShow: true,
    meta: { title: '工单管理', icon: 'zip' },
    children: [
      {
        path: '/ticket/index',
        component: () => import('@/views/ticket/index'),
        name: 'ticket-index',
        meta: { title: '工单管理', icon: 'table' }
      },
      {
        path: '/ticket/details',
        component: () => import('@/views/ticket/details'),
        name: 'ticket-details',
        hidden: true,
        meta: { title: '工单详情', icon: 'table' }
      }
    ]
  },
  {
    path: '/shop',
    component: Layout,
    redirect: '/shop/index',
    name: 'shop',
    alwaysShow: true,
    meta: { title: '商铺管理', icon: 'zip' },
    children: [
      {
        path: '/shop/setting',
        component: () => import('@/views/shop/shopSetting'),
        name: 'shop-setting',
        meta: { title: '商铺配置', icon: 'table' }
      },
      {
        path: '/shop/setting/add',
        component: () => import('@/views/shop/shopSettingAdd'),
        name: 'shopSetting-add',
        hidden: true,
        meta: { title: '添加商铺类型', icon: 'table' }
      },
      {
        path: '/shop/setting/edit',
        component: () => import('@/views/shop/shopSettingEdit'),
        name: 'shopSetting-edit',
        hidden: true,
        meta: { title: '修改商铺类型', icon: 'table' }
      },
      {
        path: '/shop/index',
        component: () => import('@/views/shop/shopIndex'),
        name: 'shop-index',
        meta: { title: '商铺列表', icon: 'table' }
      },
      {
        path: '/shop/add',
        component: () => import('@/views/shop/shopAdd'),
        name: 'shop-add',
        hidden: true,
        meta: { title: '添加商铺信息', icon: 'table' }
      },
      {
        path: '/shop/edit',
        component: () => import('@/views/shop/shopEdit'),
        name: 'shop-edit',
        hidden: true,
        meta: { title: '修改商铺信息', icon: 'table' }
      }
    ]
  },
  {
    path: '/rental',
    component: Layout,
    redirect: '/rental/index',
    name: 'rental',
    alwaysShow: true,
    meta: { title: '长租公寓', icon: 'zip' },
    children: [
      {
        path: '/rental/index',
        component: () => import('@/views/rental/rentalIndex'),
        name: 'rental-index',
        meta: { title: '房间列表', icon: 'table' }
      },
      {
        path: '/rental/add',
        component: () => import('@/views/rental/rentalAdd'),
        name: 'rental-add',
        hidden: true,
        meta: { title: '添加房间信息', icon: 'table' }
      },
      {
        path: '/rental/edit',
        component: () => import('@/views/rental/rentalEdit'),
        name: 'rental-edit',
        hidden: true,
        meta: { title: '修改房间信息', icon: 'table' }
      }
    ]
  },
  {
    path: '/message',
    component: Layout,
    redirect: '/message/index',
    name: 'message',
    alwaysShow: true,
    meta: { title: '消息管理', icon: 'zip' },
    children: [
      {
        path: '/message/index',
        component: () => import('@/views/message/index'),
        name: 'message-index',
        meta: { title: '待办', icon: 'table' }
      },
      {
        path: '/message/messageIndex',
        component: () => import('@/views/message/messageIndex'),
        name: 'message-messageIndex',
        meta: { title: '消息', icon: 'table' }
      }
    ]
  },
  {
    path: '/grogshop',
    component: Layout,
    redirect: '/grogshop/configindex',
    name: 'grogshop',
    alwaysShow: true,
    meta: { title: '酒店管理', icon: 'zip' },
    children: [
      {
        path: '/grogshop/configindex',
        component: () => import('@/views/grogshop/configindex'),
        name: 'grogshop-configindex',
        meta: { title: '酒店配置', icon: 'table' }
      },
      {
        path: '/grogshop/grogshopRoom',
        component: () => import('@/views/grogshop/grogshopRoom'),
        name: 'grogshop-grogshopRoom',
        meta: { title: '房型列表', icon: 'table' }
      },
      {
        path: '/grogshop/grogshopRoomAdd',
        component: () => import('@/views/grogshop/grogshopRoomAdd'),
        name: 'grogshop-grogshopRoomAdd',
        hidden: true,
        meta: { title: '新增房型', icon: 'table' }
      },
      {
        path: '/grogshop/grogshopRoomEdit',
        component: () => import('@/views/grogshop/grogshopRoomEdit'),
        name: 'grogshop-grogshopRoomEdit',
        hidden: true,
        meta: { title: '编辑房型', icon: 'table' }
      }
    ]
  },
  {
    path: '/systemResources',
    component: Layout,
    redirect: '/systemResources/index',
    name: 'systemResources',
    alwaysShow: true,
    meta: { title: '系统资源', icon: 'zip' },
    children: [
      {
        path: '/systemResources/app/index',
        component: () => import('@/views/systemResources/app/index'),
        name: 'app-index',
        meta: { title: 'APP配置', icon: 'table' }
      },
      {
        path: '/systemResources/app/property/add/index',
        component: () => import('@/views/systemResources/app/property/add/index'),
        name: 'property-add-index',
        hidden: true,
        meta: { title: '添加物业号码', icon: 'table' }
      },
      {
        path: '/systemResources/app/property/edi/index',
        component: () => import('@/views/systemResources/app/property/edi/index'),
        name: 'property-edi-index',
        hidden: true,
        meta: { title: '修改物业号码', icon: 'table' }
      }
    ]
  }
]

export const currentRouterMap = [
  { path: '/login', component: () => import('@/views/login/index'), hidden: true },
  { path: '/404', component: () => import('@/views/404'), hidden: true },
  {
    path: '/',
    component: Layout,
    redirect: '/index',
    children: [
      {
        path: '',
        component: () => import('@/views/index/index'),
        name: 'index',
        meta: { title: '首页', icon: 'index' }
      }
    ]
  }

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

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: currentRouterMap
})
