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

import routerBefore from '@/config/routerBefore.js'
// 主要
import main from '@/components/main.vue'
// 系统配置管理
import configList from '@/views/configManager/components/configList.vue'
import historyPage from '@/views/configManager/components/historyPage.vue'
import watchPage from '@/views/configManager/components/watchPage.vue'
import Detail from '@/views/configManager/components/Detail.vue'

Vue.use(Router)

const constantRouterMap = [{
    path: '/',
    name: 'main',
    component: main,
    redirect: {
      name: 'test'
    },
    children: [{
      path: 'configList',
      name: 'configList',
      component: configList
    }, {
      path: 'historyPage',
      name: 'historyPage',
      component: historyPage
    }, {
      path: 'watchPage',
      name: 'watchPage',
      component: watchPage
    },
    {
      path: 'configList/detial',
      name: 'Detail',
      meta: {
        code: 'add'
      },
      component: Detail
    }
    ]
  }]

const router = new Router({
  routes: constantRouterMap
})
//  before
routerBefore(router, constantRouterMap);

export default router;
//  constantRouterMap
export const routes = constantRouterMap;
