//api集合
let apiApp = {
	login: '/api/mobile/user/wechat-login',
	getAppId: '/api/mobile/user/wechat-login-url',
	sendSms: '/api/mobile/user/send-sms',
	getPrize: '/api/mobile/draw/get-prize',
	draw: '/api/mobile/draw/draw',
	endTask: '/api/mobile/draw/end-task',
	mobileCheck: '/api/mobile/draw/mobile-check',
	bindMobile: '/api/mobile/user/bind-mobile',
	share: '/api/mobile/user/wechat-share'
}

// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作
const install = (Vue, vm) => {

	//api方法
	let login = (params = {}) => vm.$u.get(apiApp.login, params);
  let getPrize = (params = {}) => vm.$u.get(apiApp.getPrize, params);
	let getAppId = (params = {}) => vm.$u.get(apiApp.getAppId, params);
	let draw = (params = {}) => vm.$u.get(apiApp.draw, params);
	let endTask = (params = {}) => vm.$u.get(apiApp.endTask, params);
	let mobileCheck = (params = {}) => vm.$u.get(apiApp.mobileCheck, params);
	let sendSms = (params = {}) => vm.$u.get(apiApp.sendSms, params);
	let bindMobile = (params = {}) => vm.$u.get(apiApp.bindMobile, params);
	let share = (params = {}) => vm.$u.get(apiApp.share, params);
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = { login, getPrize, draw, endTask, mobileCheck, getAppId, sendSms, bindMobile, share  };
}

export default {
	install
}
