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

Vue.use(VueRouter);

import Visit from ".././components/Visit";
// import Info from "../components/Info";
//import Info from "../components/HelloWorld";


const getComponent = (component, dir) => () => import(`.././components` + (dir ? `/${dir}` : '') + `/${component}.vue`);

export default new VueRouter({

    routes: [
        // {
        //   path: '/',
        //   component:getComponent('Main'),
        // },
        {
            path: '/',
            component: getComponent('Login'),
            meta: {
                type:'',
                title: '登录'
            },
            alias: '/login'
        },
        {
            path: '/changePwd',
            component: getComponent('ChangePwd'),
            meta: {
                type: 'login',
                title: '修改密码'
            },
        },
        {
            path: '/ChangePwdByLogin',
            component: getComponent('ChangePwdByLogin'),
            meta: {
                type: 'login',
                title: '重置初始密码'
            },
        },
        {
            path: '/main',
            component: getComponent('Main'),
            meta: {
                type: 'login',
            },
        },
        {
            path: '/info',
            component: getComponent('Info'),
            meta: {
                type: 'login',
                title: '采集'
            },
        },
        {
            path: '/info/:id',
            component: getComponent('Info'),
            meta: {
                type: 'login',
                title: '采集'
            },
        },
        {
            path: '/record',
            component: getComponent('Record', 'record'),
            children: [
                {
                    path: 'infolist',
                    component: getComponent('InfoList', 'record'),
                    meta: {
                        type: 'login',
                        title: '采集记录'
                    },
                },
                {
                    path: 'visitrecord',
                    component: getComponent('VisitRecord', 'record'),
                    meta: {
                        type: 'login',
                        title: '巡访记录'
                    },
                }
            ],

        },
        {
            path: '/visit/:id',
            component: Visit,
            meta: {
                type: 'login',
                title: '现场爱心巡访'
            },
        },
        {
            path: '/visitInfoRanking',
            component: getComponent('VisitInfoRanking'),
            meta: {
                type: 'login',
                title: '巡访排名'
            },
        },

        {
            path: '/notice',
            component: getComponent('notice'),
            meta: {
                type: 'login',
                title: '通知'
            },
        },

        {
            path: '/my/index',
            component: getComponent('index', 'my'),
            meta: {
                type: 'login',
                title: '我的'
            },
        },
        {
            path: '/my/finishinfo',
            component: getComponent('finishinfo', 'my'),
            meta: {
                type: 'login',
                title: '完善信息'
            },
        },
        {
            path: '/my/aboutme',
            component: getComponent('aboutme', 'my'),
            meta: {
                type: 'login',
                title: '关于我们'
            },
        },

        {
            path: '/my/yijian',
            component: getComponent('yijian', 'my'),
            meta: {
                type: 'login',
                title: '意见反馈'
            },
        },
        {
            path: '/my/changePwd',
            component: getComponent('ChangePwd', 'my'),
            meta: {
                type: 'login',
                title: '修改密码'
            },
        },
        {
            path: '/my/ChangePwdByLogin',
            component: getComponent('ChangePwdByLogin', 'my'),
            meta: {
                type: 'login',
                title: '重置初始密码'
            },
        },
        {
            path: '/my/idCard',
            component: getComponent('idCard', 'my'),
            meta: {
                type: 'login',
                title: '身份卡'
            },
        },

        {
            path: '/my/card',
            component: getComponent('card', 'my'),
            meta: {
                type: 'login',
                title: '身份卡'
            },
        },

        {
            path: '/my/mypaiming',
            component: getComponent('mypaiming', 'my'),
            meta: {
                type: 'login',
                title: '我的排名'
            },
        },
        {
            path: '/my/mypersonalInterests',
            component: getComponent('mypersonalInterests', 'my'),
            meta: {
                type: 'login',
                title: '个人权益'
            },
        },
        // 赡养人系统路由
        {
            path: '/dependant/login',
            component: getComponent('Login', 'dependant'),
            meta: {
                type: '',
                title: '赡养人登录'
            },
        },
        {
            path: '/dependant/message',
            component: getComponent('OldsMessage', 'dependant'),
            meta: {
                type: 'dependentsLogin',
                title: '巡访住户老人'
            },
        },
        {
            path: '/dependant/details/:id',
            component: getComponent('Details', 'dependant'),
            meta: {
                type: 'dependentsLogin',
                title: '巡访住户老人记录详情'
            },
        },
        {
            path: '/dependant/OldsInfo/:id',
            component: getComponent('OldsInfo', 'dependant'),
            meta: {
                type: 'dependentsLogin',
                title: '巡访住户老人记录'
            },
        },
        //自主填报
        {
            path: '/independent',
            component: getComponent('Main', 'Independent'),
            meta: {
                type:'',
                title: '自主填报'
            },
        },
        {
            path: '/independent/main',
            component: getComponent('Main', 'Independent'),
            meta: {
                type: 'independentLogin',
            },
        },
        {
            path: '/independent/info',
            name:'independentInfo',
            component: getComponent('Info', 'Independent'),
            meta: {
                type: 'independentLogin',
                title: '自主填报'
            },
        },
        {
            path: '/independent/info/:id',
            component: getComponent('Info', 'Independent'),
            meta: {
                type: 'independentLogin',
                title: '采集'
            },
        },
        {
            path: '/independent/infolist',
            component: getComponent('InfoList', 'Independent'),
            meta: {
                type: 'independentLogin',
                title: '自主填报记录'
            },
        },
        {
            path: '/independent/addDept',
            component: getComponent('AddDept', 'Independent'),
            meta: {
                type: 'independentLogin',
                title: '所属地区'
            },
        },

    ]
});

