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

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

export default new Router({
    mode: 'history',
    routes: [
        {
            path: '/',
            redirect: '/dashboard'
        },
        {
            path: '/',
            component: () => import(/* webpackChunkName: "home" */ '../components/common/Home.vue'),
            meta: { title: '自述文件' },
            children: [
                {
                    path: '/dashboard',
                    component: () => import(/* webpackChunkName: "dashboard" */ '../components/page/Dashboard.vue'),
                    meta: { title: 'Home' }
                },
                // {
                //     path: '/icon',
                //     component: () => import('../components/page/Icon.vue'),
                //     meta: { title: '自定义图标' }
                // },
                {
                    path: '/articleList',
                    component: () => import(/* webpackChunkName: "table" */ '../components/page/articleList.vue'),
                    meta: { title: 'My manuscript' }
                },
                {
                    path: '/articleListEditor',
                    component: () => import(/* webpackChunkName: "table" */ '../components/page/articleListEditor.vue'),
                    meta: { title: 'Manuscript to be examined' ,permission: 2}
                },
                {
                    path:'/articleDetailEditor',
                    component: () => import('../components/page/articleDetailEditor.vue'),
                    meta: { title: 'Manuscript detail' ,permission: 2},
                    hidden:true
                },
                {
                    path: '/articleDetail',
                    component: () => import('../components/page/articleDetail.vue'),
                    meta: { title: 'Manuscript detail' ,},
                    hidden:true
                },
                {
                    path:'articleRevise',
                    component:()=>import('../components/page/articleRevise.vue'),
                    meta:{title:'Manuscript revise'},
                    hidden:true
                },
                {
                    path: '/articleAdd',
                    component: () => import('../components/page/articleAdd.vue'),
                    meta: { title: 'Add manuscript' }
                },
                {
                    path:'/articleReviewer',
                    component:()=>import('../components/page/articleReviewer.vue'),
                    meta:{title:'Article reviewer'},
                    hidden:true
                },
                {
                    path:'/articleReviewerDetail',
                    component:()=>import('../components/page/articleReviewerDetail'),
                    meta:{title:'Article detail'},
                    hidden:true
                },
                {
                    path:'/editorList',
                    component: ()=>import('../components/page/editorList.vue'),
                    meta:{title:'Editor list'}
                },
                {
                    path:'/editorAdd',
                    component:()=>import('../components/page/editorAdd.vue'),
                    meta:{title:'Editor add'}
                },
                {
                    path:'/journalList',
                    component:()=>import('../components/page/journallist.vue'),
                    meta:{title:'Journal list'}
                },
                {
                    path:'authorApplyReviewer',
                    component:()=>import('../components/page/authorApplyReviewer.vue'),
                    meta:{title:'Author apply'},
                    hidden:true
                },
                {
                    path:'/journalAdd',
                    component:()=>import('../components/page/journalAdd.vue'),
                    meta:{title:'Journal add'}
                },
                {
                    path:'/reviewerApplyList',
                    component:()=>import('../components/page/reviewerApplyList.vue'),
                    meta:{title:'Reviewer aplly list'}
                },
                {
                    path:'/reviewerApplyDetail',
                    component:()=>import('../components/page/reviewerApplyDetail.vue'),
                    meta:({title:'Reviewer apply detail'}),
                    hidden:true
                },
                {
                    path:'/reviewerArticleList',
                    component:()=>import('../components/page/reviewerArticleList.vue'),
                    meta:({title:'Reviewer article list'})
                },
                {
                    path:'/reviewerArticleDetail',
                    component:()=>import('../components/page/reviewerArticleDetail.vue'),
                    meta:({title:'Reviewer article detail'}),
                    hidden:true
                },
                {
                    path:'/reviewerList',
                    component:()=>import('../components/page/reviewerList.vue'),
                    meta:{title:'Reviewer list'}
                },
                {
                    path:'/reviewerDetail',
                    component:()=>import('../components/page/reviewerDetail.vue'),
                    meta:{title:'reviewer detail'},
                    hidden:true
                },
                {
                    path:'/adminImportReviewer',
                    component:()=>import('../components/page/adminImportReviewer.vue'),
                    meta:{title:'Import reviewer'}
                },
                {
                    path:'/adminImportreviewerError',
                    component:()=>import('../components/page/adminImportreviewerError.vue'),
                    meta:{title:'Import error'}
                },
                {
                    path:'/reviewerImport',
                    component:()=>import('../components/page/reviewerImport.vue'),
                    meta:{title:'Reviewer import'}
                },
                {
                    path:'/authorApplySuccess',
                    component:()=>import('../components/page/authorApplySuccess.vue'),
                    meta:{title:'Apply success'}
                },
                {
                    path:'/reviewerImportError',
                    component:()=>import('../components/page/reviewerImportError.vue'),
                    meta:{title:'Import error'}
                },
                {
                    path:'/monitorManuscript',
                    component:()=>import('../components/page/monitorManuscript.vue'),
                    meta:{title:'Manuscript list'}
                },
                {
                    path:'/monitorManuscriptDetail',
                    component:()=>import('../components/page/monitorManuscriptDetail.vue'),
                    meta:{title:'Manuscript detail'},
                    hidden:true
                },
                {
                    path: '/404',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/404.vue'),
                    meta: { title: '404' }
                },
                {
                    path: '/403',
                    component: () => import(/* webpackChunkName: "403" */ '../components/page/403.vue'),
                    meta: { title: '403' }
                },
                // {
                //     path: '/donate',
                //     component: () => import(/* webpackChunkName: "donate" */ '../components/page/Donate.vue'),
                //     meta: { title: '支持作者' }
                // }
            ]
        },
        {
            path: '/login',
            component: () => import(/* webpackChunkName: "login" */ '../components/page/Login.vue'),
            meta: { title: 'Login' }
        },
        {
            path: '/retrieve',
            component: () => import(/* webpackChunkName: "retrieve" */ '../components/page/Retrieve.vue'),
            meta: { title: 'Retrieve password' }
        },
        {
            path: '/retrieveact',
            component: () => import(/* webpackChunkName: "retrieveact" */ '../components/page/Retrieveact.vue'),
            meta: { title: 'Retrieve password' }
        },
        {
            path:'/submission',
            component:()=>import('../components/page/submission.vue'),
            meta:{title:'Submission system'}
        },
        {
            path: '/register',
            component: () => import(/* webpackChunkName: "register" */ '../components/page/Register.vue'),
            meta: { title: 'Register' }
        },
        {
            path:'/reviewer',
            component:()=>import('../components/page/reviewer.vue'),
            meta:{title:'reviewer'}
        },
        {
            path:'/thanks',
            component:()=>import('../components/page/thanks.vue'),
            meta:{title:'thanks'}
        },
        {
            path:'/test',
            component:()=>import('../components/page/test.vue'),
            meta:{title:'test'}
        },
        {
            path:'/img',
            component:()=>import('../components/page/img.vue'),
            meta:{title:'img'}
        },
        {
            path: '*',
            redirect: '/404'
        }
    ]
});
