import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = [
  {
    path: '/',
    name: 'login',
    component: () => import(/* webpackChunkName: "about" */ '@/views/login/login.vue')
  },
  {
    path: '/accounts',
    name: 'accounts',
    component: () => import(/* webpackChunkName: "about" */ '@/views/select_accounts/index.vue')
  },
  {
    path: '/main',
    name: 'main',
    component: () => import(/* webpackChunkName: "about" */ '@/components/layout/index.vue'),
    redirect: '/role_manage',
    children: [
      {
        path: '/role_manage',
        name: 'roles',
        meta: {
          title: '角色管理'
        },
        component: () => import(/* webpackChunkName: "about" */ '@/views/role_manage/index.vue')
      },{
        path: '/account_manage',
        name: 'users',
        meta: {
          title: '账号管理'
        },
        component: resolve => require(['@/views/account_manage/index'], resolve)
      }]
  }
];

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes,
});

export default router;
