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

const routerPush = Router.prototype.push  

Router.prototype.push = function push(location) {
 
  // if(typeof(location)=="string"){
  //   var Separator = "&";
  //   if(location.indexOf('?')==-1) { Separator='?'; }
  //   location = location + Separator + "random=" + Math.random();
  // }

  return routerPush.call(this, location).catch(error => error)
}

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('./views/Home.vue'),
      meta: {
        title: '首页'
      }
    },
	{
		path: '/loveList',
		name: 'loveList',
		component: () => import('./views/LoveList.vue'),
		meta: {
			title: '爱心榜'
		}
	},
	{
		path: '/join',
		name: 'join',
		component: () => import('./views/Join.vue'),
		redirect: '/join/contribution',
		meta: {
			title: '我要参与'
		},
		children: [
			{
				path: 'contribution',
				name: 'contribution',
				component: () => import('./views/join/Contribution.vue'),
				meta: {
					title: '捐款'
				}
			},
			{
				path: 'organDonation',
				name: 'organDonation',
				component: () => import('./views/join/OrganDonation.vue'),
				meta: {
					title: '器官捐献'
				}
			},
			{
				path: 'HPC',
				name: 'HPC',
				component: () => import('./views/join/Hpc.vue'),
				meta: {
					title: '捐献造血干细胞'
				}
			},
			{
				path: 'volunteer',
				name: 'volunteer',
				component: () => import('./views/join/Volunteer.vue'),
				meta: {
					title: '登记志愿者'
				}
			},
			{
				path: 'member',
				name: 'member',
				component: () => import('./views/join/Member.vue'),
				meta: {
					title: '登记个人会员'
				}
			},
			{
				path: 'train',
				name: 'train',
				component: () => import('./views/join/Train.vue'),
				meta: {
					title: '参与普及培训'
				}
			},
			{
				path: 'rescue',
				name: 'rescue',
				component: () => import('./views/join/Rescue.vue'),
				meta: {
					title: '登记救护员'
				}
			}
		]
	},
	{
		path: '/about',
		name: 'about',
		component: () => import('./views/About.vue'),
		meta: {
			title: '红十字概况'
		},
		redirect: '/about/redCrossMovement',
		children: [
			{
				path: 'redCrossMovement',
				neme: 'redCrossMovement',
				component: () => import('./views/about/RedCrossMovement.vue'),
				meta: {
					title: '关于红十字会运动'
				}
			},
			{
				path: 'chineseRedCross',
				neme: 'chineseRedCross',
				component: () => import('./views/about/ChineseRedCross.vue'),
				meta: {
					title: '关于中国红十字会'
				}
			},
			{
				path: 'ezhouRedCross',
				neme: 'ezhouRedCross',
				component: () => import('./views/about/EzhouRedCross.vue'),
				meta: {
					title: '鄂州市红十字会简介'
				}
			},
		]
	},
	{
		path: '/popularScience',
		name: 'popularScience',
		component: () => import('./views/PopularScience.vue'),
		meta: {
			title: '红会科普'
		},
		redirect: '/popularScience/list',
		children: [
			{
				path: 'list',
				name: 'list',
				component: () => import('./views/popularScience/List.vue'),
				meta: {
					title: '红会科普'
				}
			},
			{
				path: 'detail',
				name: 'detail',
				component: () => import('./views/popularScience/Detail.vue'),
				meta: {
					title: '红会科普'
				}
			}
		]
	},
	{
		path: '/publicity',
		name: 'publicity',
		component: () => import('./views/Publicity.vue'),
		meta: {
			title: '信息公示'
		},
		redirect: '/publicity/list',
		children: [
			{
				path: 'list',
				name: 'publicitylist',
				component: () => import('./views/publicity/List.vue'),
				meta: {
					title: '信息公示'
				}
			},
			{
				path: 'detail',
				name: 'publicitydetail',
				component: () => import('./views/publicity/Detail.vue'),
				meta: {
					title: '信息公示'
				}
			}
		]
	},
	{
		path: '/newsCenter',
		name: 'newsCenter',
		component: () => import('./views/NewsCenter.vue'),
		redirect: '/newsCenter/redNews',
		meta: {
			title: '新闻中心'
		},
		children: [
			{
				path: 'redNews',
				name: 'redNews',
				component: () => import('./views/newsCenter/RedNews.vue'),
				redirect: '/newsCenter/redNews/list',
				meta: {
					title: '红会新闻'
				},
				children: [
					{
						path: 'list',
						name: 'redNewsList',
						component: () => import('./views/newsCenter/redNews/List.vue'),
						meta: {
							title: '红会新闻'
						}
					},
					{
						path: 'detail',
						name: 'redNewsDetail',
						component: () => import('./views/newsCenter/redNews/Detail.vue'),
						meta: {
							title: '红会新闻'
						}
					}
				]
			},
			{
				path: 'echeng',
				name: 'echeng',
				component: () => import('./views/newsCenter/Echeng.vue'),
				redirect: '/newsCenter/echeng/list',
				meta: {
					title: '鄂城区'
				},
				children: [
					{
						path: 'list',
						name: 'echengList',
						component: () => import('./views/newsCenter/echeng/List.vue'),
						meta: {
							title: '鄂城区'
						}
					},
					{
						path: 'detail',
						name: 'echengDetail',
						component: () => import('./views/newsCenter/echeng/Detail.vue'),
						meta: {
							title: '鄂城区'
						}
					}
				]
			},
			{
				path: 'huarong',
				name: 'huarong',
				component: () => import('./views/newsCenter/Huarong.vue'),
				redirect: '/newsCenter/huarong/list',
				meta: {
					title: '华容区'
				},
				children: [
					{
						path: 'list',
						name: 'huarongList',
						component: () => import('./views/newsCenter/huarong/List.vue'),
						meta: {
							title: '华容区'
						}
					},
					{
						path: 'detail',
						name: 'huarongDetail',
						component: () => import('./views/newsCenter/huarong/Detail.vue'),
						meta: {
							title: '华容区'
						}
					}
				]
			},
			{
				path: 'liangzihu',
				name: 'liangzihu',
				component: () => import('./views/newsCenter/Liangzihu.vue'),
				redirect: '/newsCenter/liangzihu/list',
				meta: {
					title: '梁子湖区'
				},
				children: [
					{
						path: 'list',
						name: 'liangzihuList',
						component: () => import('./views/newsCenter/liangzihu/List.vue'),
						meta: {
							title: '梁子湖区'
						}
					},
					{
						path: 'detail',
						name: 'liangzihuDetail',
						component: () => import('./views/newsCenter/liangzihu/Detail.vue'),
						meta: {
							title: '梁子湖区'
						}
					}
				]
			},
			{
				path: 'laws',
				name: 'laws',
				component: () => import('./views/newsCenter/Laws.vue'),
				redirect: '/newsCenter/laws/list',
				meta: {
					title: '法律法规'
				},
				children: [
					{
						path: 'list',
						name: 'lawsList',
						component: () => import('./views/newsCenter/laws/List.vue'),
						meta: {
							title: '法律法规'
						}
					},
					{
						path: 'detail',
						name: 'lawsDetail',
						component: () => import('./views/newsCenter/laws/Detail.vue'),
						meta: {
							title: '法律法规'
						}
					}
				]
			},
		]
	},
	{
		path: '/download',
		name: 'download',
		component: () => import('./views/DownLoad.vue'),
		redirect: '/download/list',
		meta: {
			title: '表格下载'
		},
		children: [
			{
				path: 'list',
				name: 'downlist',
				component: () => import('./views/download/List.vue'),
				meta: {
					title: '表格下载'
				}
			}
		]
	},
	{
		path: '/help',
		name: 'help',
		component: () => import('./views/Help.vue'),
		redirect: '/help/aid',
		meta: {
			title: '人道救助'
		},
		children: [
			{
				path: 'aid',
				name: 'aid',
				component: () => import('./views/help/Aid.vue'),
				meta: {
					title: '人道救助'
				}
			},
			{
				path: 'service',
				name: 'service',
				component: () => import('./views/help/Service.vue'),
				meta: {
					title: '红十字志愿服务'
				}
			},
			{
				path: 'juvenile',
				name: 'juvenile',
				component: () => import('./views/help/Juvenile.vue'),
				meta: {
					title: '红十字少年'
				}
			}
		]
	},
	{
		path: '*',
		redirect: '/home'
	}
  ]
})
