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


const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err);
}

Vue.use(Router)

export default new Router({
    routes: [
        {
            path: '/404',
            component: () => import('@/views/404')
        },
        {
            path: '/',
            component: () => import('@/views/Index'),
            children: [
                {
                    path: 'graphModel',
                    component: () => import('@/components/menus/GraphModel')
                },
                {
                    path: 'graphModel_g',
                    component: () => import('@/components/graph/GraphModel')
                },
                {
                    path: 'graphImport',
                    component: () => import('@/components/menus/GraphImport')
                },
                {
                    path: 'graphSpaceSet',
                    component: () => import('@/components/menus/GraphSpaceSet')
                },
                {
                    path: 'graphSpace_g',
                    component: () => import('@/components/graph/GraphSpace')
                },
                {
                    path: 'graphSpaceManage',
                    component: () => import('@/components/menus/GraphSpaceManage')
                },
                {
                    path: 'homePage',
                    component: () => import('@/components/menus/HomePage')
                },
                {
                    path: 'userManage',
                    component: () => import('@/components/menus/UserManage')
                },
                {
                    path: 'entrysManage',
                    component: () => import('@/components/menus/EntrysManage')
                },
                {
                    path: 'feedbackTypeManage',
                    component: () => import('@/components/menus/FeedbackTypeManage')
                },
                {
                    path: 'intelligenceRecommend',
                    component: () => import('@/components/menus/IntelligenceRecommend')
                },
                {
                    path: '/',
                    redirect: "homePage"
                },
            ]
        },
        {
            path: '/login',
            name: 'Login',
            component: () => import('@/views/Login'),
        },
        {path: '*', redirect: '/404'}
    ],
    mode: "hash"
})
