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

import routerBefore from '@/config/routerBefore.js'

// 主要
import main from '@/components/main.vue'
// 系统配置管理
import serviceList from '@/views/serviceManager/components/serviceList.vue'
import actionHistory from '@/views/serviceManager/components/actionHistory.vue'
import configList from '@/views/configManager/components/configList.vue'
import Detail from '@/views/configManager/components/Detail.vue'

Vue.use(Router)

const constantRouterMap = [
  {
    path: '/',
    name: 'main',
    component: main,
    redirect: {
      name: 'test'
    },
    children: [{
      path: 'serviceList',
      name: 'serviceList',
      component: serviceList
    }, {
      path: 'actionHistory',
      name: 'actionHistory',
      component: actionHistory
    }, {
      path: 'configList',
      name: 'configList',
      component: configList
    }, {
      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;
