import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/login.vue'
import Home from '../views/home.vue'
import Layout from '../views/middle/layout/layout-middle.vue'
import HomePage from '../views/middle/home-page/home-middle.vue'
import Project from '../views/middle/project/project-middle.vue'
import Kettle from '../views/middle/kettle/kettle-monitor.vue'
import Depart from '../views/middle/depart/depart.vue'
import Center from '../views/middle/personal-center/personal-center.vue'
import Education from '../views/middle/education-train/education-train.vue'
import Device from '../views/middle/device/device-middle.vue'

Vue.use(VueRouter)

const routes = [{
  path: '/',
  name: 'Login',
  component: Login
},
{
  path: '/home',
  component: Home,
  children: [
    {
      path: 'homepage',
      name: '首页',
      component: HomePage
    },
    {
      path: 'layout',
      name: '首页布局配置',
      component: Layout
    },
    {
      path: 'project',
      name: '首页项目配置',
      component: Project
    },
    {
      path: 'education',
      name: '教育培训管理',
      component: Education
    },
    {
      path: 'device',
      name: '设备管理',
      component: Device
    },
    {
      path: 'kettle',
      name: 'Kettle监控',
      component: Kettle
    },
    {
      path: 'depart',
      name: '病区项目统计',
      label: 'depart',
      component: Depart
    },
    {
      path: 'setting',
      name: '系统设置'
    },
    {
      path: 'center',
      name: '个人中心',
      component: Center,
    }
  ]

}
]

const router = new VueRouter({
  routes
})

const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(to) {
  return VueRouterPush.call(this, to).catch(err => err)
}

export default router
