import Vue from 'vue'
import VueRouter from 'vue-router'
// import layout from '@/components/layout/index.vue'

// import integratedData from '@/views/integratedData/index.vue'
// 获取原型对象上的push函数
const originalPush = VueRouter.prototype.push
// 修改原型对象中的push方法
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}
Vue.use(VueRouter)

const routes = [{
	path: '/',
	// component: () => import('../views/index.vue')
	meta: {
		title: '首页'
	},
	component: () => import( /* webpackChunkName: "home" */ '@/views/index.vue'),
	redirect: '',
	children: [
		{
			path: 'integratedData',
			name: 'IntegratedData',
			meta: {
				title: '健身锻炼综合数据'
			},
			component: () => import( /* webpackChunkName: "IntegratedData" */
				'@/views/integratedData/index.vue')
		},
		{
			path: 'matchActivity',
			name: 'matchActivity',
			meta: {
				title: '赛事活动'
			},
			component: () => import( /* webpackChunkName: "matchActivity" */
				'@/views/matchActivity/index.vue')
		},
		{
			path: 'grassrootsSports',
			name: 'grassrootsSports',
			meta: {
				title: '基层体育委员组织'
			},
			component: () => import( /* webpackChunkName: "IntegratedData" */
				'@/views/grassrootsSports/index.vue')
		},
		{
			path: 'sportFacilities',
			name: 'SportFacilities',
			meta: {
				title: '体育场地设施'
			},
			component: () => import( /* webpackChunkName: "IntegratedData" */
				'@/views/sportFacilities/index.vue')
		}, {
			path: 'sportsSociety',
			name: 'sportsSociety',
			meta: {
				title: '体育社会组织'
			},
			component: () => import( /* webpackChunkName: "IntegratedData" */
				'@/views/sportsSociety/index.vue')
		},
		{
			path: 'socialInstructor',
			name: 'socialInstructor',
			meta: {
				title: '社会指导员'
			},
			component: () => import( /* webpackChunkName: "IntegratedData" */
				'@/views/socialInstructor/index.vue')
		}, {
			path: 'sportsBank',
			name: 'sportsBank',
			meta: {
				title: '运动银行'
			},
			component: () => import( /* webpackChunkName: "IntegratedData" */
				'@/views/sportsBank/index.vue')
		},
		{
			path: 'sportCode',
			name: 'sportCode',
			meta: {
				title: '百姓运动码'
			},
			component: () => import( /* webpackChunkName: "IntegratedData" */
				'@/views/sportCode/index.vue')
		},
		{
			path: 'fitnessSite',
			name: 'fitnessSite',
			meta: {
				title: '百姓健身房'
			},
			component: () => import( /* webpackChunkName: "IntegratedData" */
				'@/views/fitnessSite/index.vue')
		}
	]
}]
const router = new VueRouter({
	//mode: 'history',
	routes
})

export default router