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

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

// 主要
import main from '@/components/main.vue'
// 系统配置管理
import homepage from '../components/homepage.vue'
// 关于-帮助文档
import about from '../components/about.vue'
Vue.use(Router)

const constantRouterMap = [
  {
    path: '/',
    name: 'main',
    meta: {title: '首页', code: 'xtpzgl'},
    component: main,
    redirect: {name: 'cargoResult'},
    children: [
      {path: 'homepage', name: 'homepage', meta: {code: 'xtpzgl-jggl'}, component: homepage},
      {path: 'about', name: 'about', meta: {code: 'xtpzgl-jggl'}, component: about},
    ]
  }
];

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

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