//微信支付
let wxInfoUrl = {
	getUserInfoUrl: '/wx/getUserInfo',
	//获取分享数据
	wxShareData:'wx/getShareData'
}

//文件上传
const uploadFile = {
	submit:p => http.upload('/putObject', {name:'file',filePath:p}),
}

let activityUrl = {
	adsListUrl: '/cyzh-ads/ads/list',
	listUrl: '/cyzh-activity/activity/selectPageWithTag',
	detailUrl: '/cyzh-activity/activity/detail',
	rankListUrl: '/cyzh-userActivityStatistical/useractivitystatistical/getRankList',
	signUpUrl: '/cyzh-production/production/create',
	visitUrl: '/cyzh-activity/activity/visit',
}

let userUrl = {
	boostUrl: '/cyzh-activity/activity/getHitPersonDetail',
	loginUrl: '/cyzh-loginUser/loginuser/login',
	detailUrl: '/cyzh-loginUser/loginuser/detail',
	submitUrl: '/cyzh-loginUser/loginuser/submit',
	userAddress:'/cyzh-userAddress/useraddress/list',
	userAddressSubmit: '/cyzh-userAddress/useraddress/submit',
	getBonus:'cyzh-userActivityStatistical/useractivitystatistical/getBonus',
	withdrawRecords:'cyzh-withdrawRecords/withdrawrecords/list',
	mineData:'cyzh-loginUser/loginuser/getLoginWebVO',
	statisticalList:'cyzh-userActivityStatistical/useractivitystatistical/list2',
	withdraw:'cyzh-userActivityStatistical/useractivitystatistical/withdraw'
}

let pointsUrl = {
	listUrl: '/cyzh-pointsDetail/pointsdetail/list',
}

let boostUrl = {
	listUrl: '/cyzh-helpRecord/helprecord/list2',
	doHitUrl: '/cyzh-helpRecord/helprecord/doHit',
	myBoostUrl : 'cyzh-helpRecord/helprecord/selectHelpRecordVoPage',
	billRecordUrl: 'cyzh-billRecord/billrecord/submit',
	billRecordDetailUrl: 'cyzh-billRecord/billrecord/detail',
	doRewardUrl: 'cyzh-helpRecord/helprecord/doReward',
	presentDetailUrl: 'cyzh-present/present/detail'
}

let productionUrl = {
	getRankList:'cyzh-userActivityStatistical/useractivitystatistical/getRankList',
	listUrl: 'cyzh-production/production/list',
	detailUrl: 'cyzh-production/production/detail',
	helpRecordListUrl: 'cyzh-helpRecord/helprecord/selectHelpRecordVoPage',
	visitUrl: '/cyzh-production/production/visit',
}

let goodsUrl = {
	getMineGoods: 'cyzh_userGoods/usergoods/list',
	donate: 'cyzh_userGoods/usergoods/donate',
	obtain:'cyzh_userGoods/usergoods/obtain',
	doneList:'cyzh-goodsRecord/goodsrecord/list',
	done:'cyzh-goodsRecord/goodsrecord/submit'
}


let medalUrl={
	list:'cyzh-userMedal/usermedal/list',
	exchange:'cyzh-userMedal/usermedal/exchange'
}

let pointsGoodsUrl={
	ads:'cyzh-pointsGoodsAds/pointsgoodsads/list',
	mineGoodsList:'cyzh-userPointsGoods/userpointsgoods/list',
	mineGoodsListSubmit:'cyzh-userPointsGoods/userpointsgoods/submit',
	list:'cyzh-pointsGoods/pointsgoods/list',
	exchange:'cyzh-pointsGoods/pointsgoods/exchange',
	getUsableHotAndPoints:'cyzh-userActivityStatistical/useractivitystatistical/getUsableHotAndPoints'
}

let dictUrl = {
	codeUrl: '/blade-system/dict-biz/dictionary',
}

let musicBoostUrl = {
	detailUrl: '/cyzh-production/production/getProductDetail'
}
let yeePayUrl = {
	initOrder: '/yeePay/initOrder'
}

let bankCardUrl = {
	bindCardUrl: 'cyzh-userBank/userbank/submit',
	cardDetailUrl: 'cyzh-userBank/userbank/list',
}

// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	let wxInfo = {
		getUserInfo:(params = {}) => vm.$u.get(wxInfoUrl.getUserInfoUrl, params),
		getWxShareData:(params = {}) => vm.$u.get(wxInfoUrl.wxShareData, params),
	}
	
	let activity = {
		getAdsList:(params = {}) => vm.$u.get(activityUrl.adsListUrl, params),
		list:(params = {}) => vm.$u.get(activityUrl.listUrl, params),
		detail:(params = {}) => vm.$u.get(activityUrl.detailUrl, params),
		rankList:(params = {}) => vm.$u.get(activityUrl.rankListUrl, params), 
		signUp:(params = {}) => vm.$u.post(activityUrl.signUpUrl, params),
		visit:(params = {}) => vm.$u.get(activityUrl.visitUrl, params),
	}
	
	let user = {
		boost:(params = {}) => vm.$u.get(userUrl.boostUrl, params),
		login:(params = {}) => vm.$u.post(userUrl.loginUrl, params),
		detail:(params = {}) => vm.$u.get(userUrl.detailUrl, params),
		submit:(params = {}) => vm.$u.post(userUrl.submitUrl, params),
		userAddress:(params = {}) => vm.$u.get(userUrl.userAddress, params),
		userAddressSubmit:(params = {}) => vm.$u.post(userUrl.userAddressSubmit, params),
		getBonus:(params = {}) => vm.$u.get(userUrl.getBonus, params),
		//提现 begin
		withdrawrecords:(params = {}) => vm.$u.get(userUrl.withdrawRecords, params),
		mineData:(params = {}) => vm.$u.get(userUrl.mineData, params),
		statisticalList:(params = {}) => vm.$u.get(userUrl.statisticalList, params),
		withdraw:(params = {},q) => vm.$u.post(userUrl.withdraw+'?withdrawPassword='+q, params),
		//提现 end
	}
	
	let points = {
		list:(params = {}) => vm.$u.get(pointsUrl.listUrl, params),
	}
	
	let boost = {
		list:(params = {}) => vm.$u.get(boostUrl.listUrl, params),
		doHit:(params = {}) => vm.$u.post(boostUrl.doHitUrl, params),
		myBoost:(params = {}) => vm.$u.get(boostUrl.myBoostUrl, params),
		billRecord:(params = {}) => vm.$u.post(boostUrl.billRecordUrl, params),
		doReward:(params = {}) => vm.$u.post(boostUrl.doRewardUrl, params),
		presentDetail:(params = {}) => vm.$u.get(boostUrl.presentDetailUrl, params),
		billRecordDetail:(params = {}) => vm.$u.get(boostUrl.billRecordDetailUrl, params)
	}
	
	let production = {
		getRankList:(params = {}) => vm.$u.get(productionUrl.getRankList, params),
		list:(params = {}) => vm.$u.get(productionUrl.listUrl, params),
		detail:(params = {}) => vm.$u.get(productionUrl.detailUrl, params),
		helpRecord:(params = {}) => vm.$u.get(productionUrl.helpRecordListUrl, params),
		visit:(params = {}) => vm.$u.get(productionUrl.visitUrl, params),
	}
	let goods = {
		getMineGoods:(params = {}) => vm.$u.get(goodsUrl.getMineGoods, params),
		donate:(params = {}) => vm.$u.post(goodsUrl.donate, params),
		obtain:(params = {}) => vm.$u.post(goodsUrl.obtain, params),
		doneList:(params = {}) => vm.$u.get(goodsUrl.doneList, params),
		done:(params = {}) => vm.$u.post(goodsUrl.done, params),
	}

	let medal={
		list:(params = {}) => vm.$u.get(medalUrl.list, params),
		exchange:(params = {}) => vm.$u.post(medalUrl.exchange, params),
	}
	
	let pointsGoods={
		ads:(params = {}) => vm.$u.get(pointsGoodsUrl.ads, params),
		mineGoodsListSubmit:(params = {}) => vm.$u.post(pointsGoodsUrl.mineGoodsListSubmit, params),
		mineGoodsList:(params = {}) => vm.$u.get(pointsGoodsUrl.mineGoodsList, params),
		list:(params = {}) => vm.$u.get(pointsGoodsUrl.list, params),
		getUsableHotAndPoints:(params = {}) => vm.$u.get(pointsGoodsUrl.getUsableHotAndPoints, params),
		exchange:(params = {}) => vm.$u.post(pointsGoodsUrl.exchange, params),
	}
	
	let musicBoost = {
		detail:(params = {}) => vm.$u.get(musicBoostUrl.detailUrl, params),
	}
	
	let yeePay = {
		initOrder:(params = {}) => vm.$u.post(yeePayUrl.initOrder, params),
	}
	
	let dict = {
		code:(params = {}) => vm.$u.get(dictUrl.codeUrl, params),
	}

	let bankCard = {
		bindCard:(params = {}) => vm.$u.post(bankCardUrl.bindCardUrl, params),
		cardDetail:(params = {}) => vm.$u.get(bankCardUrl.cardDetailUrl, params),
	}
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {wxInfo,uploadFile, activity, user, points, boost,production,goods,medal,pointsGoods, musicBoost,yeePay,dict,bankCard};
}

export default {
	install
}