import Vue from 'vue';
import VueRouter from 'vue-router';
import Index from '../views/Index';
import home from '../views/home.vue';

Vue.use(VueRouter);

const routes = [
    {
        path: '/',
        component: Index,
        children: [
            {
                path: '/',
                redirect: '/home'
            },
            {
                path: '/home',
                name: 'home',
                component: home,
                meta: {
                    menu: 'home'
                }
            },
            {
                path: '/news',
                name: 'news',
                component: () => import(/* webpackChunkName: "news" */ '@/views/news.vue'),
                meta: {
                    menu: 'news'
                }
            },
            {
                path: '/homeUpdate',
                name: 'homeUpdate',
                component: () => import(/* webpackChunkName: "news" */ '@/views/homeUpdate.vue'),
                meta: {
                    menu: 'homeUpdate'
                }
            },
            {
                path: '/policy',
                name: 'policy',
                component: () => import(/* webpackChunkName: "policy" */ '@/views/policy.vue'),
                meta: {
                    menu: 'policy'
                }
            },
            {
                path: '/article',
                name: 'article',
                component: () => import(/* webpackChunkName: "article" */ '@/views/article.vue'),
                meta: {}
            },
            {
                path: '/resource',
                name: 'resource',
                component: () => import(/* webpackChunkName: "resource" */ '@/views/resource.vue'),
                meta: {
                    menu: 'resource'
                }
            },
            {
                path: '/resourceDetail',
                name: 'resourceDetail',
                component: () => import(/* webpackChunkName: "resourceDetail" */ '@/views/resourceDetail.vue'),
                meta: {
                    menu: 'resource'
                }
            },
            {
                path: '/interact',
                name: 'interact',
                component: () => import(/* webpackChunkName: "interact" */ '@/views/interact.vue'),
                meta: {
                    menu: 'interact'
                }
            },
            {
                path: '/list',
                name: 'list',
                component: () => import(/* webpackChunkName: "list" */ '@/views/list.vue'),
                meta: {}
            },
            {
                path: '/manage',
                name: 'manage',
                component: () => import(/* webpackChunkName: "manage" */ '@/views/manage.vue'),
                meta: {}
            },
            {
                path: '/artNeed',
                name: 'artNeed',
                component: () => import(/* webpackChunkName: "artNeed" */ '@/views/artNeed.vue'),
                meta: {}
            },
            {
                path: '/auth',
                name: 'auth',
                component: () => import(/* webpackChunkName: "auth" */ '@/views/auth.vue'),
                meta: {}
            }
        ]
    },
    {
        path: '/login',
        name: 'login',
        component: () => import(/* webpackChunkName: "login" */ '@/views/login.vue'),
        meta: {}
    },
    {
        path: '/result',
        name: 'result',
        component: () => import(/* webpackChunkName: "result" */ '@/views/result.vue'),
        meta: {}
    }
];

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

export default router;
