//获取系统信息 
export const getSystemInfoSync = uni.getSystemInfoSync();
//获取系统状态栏的高度
export const statusBarHeight = getSystemInfoSync.statusBarHeight;
// 小程序的胶囊
export const getMenuButtonBoundingClientRect = (uni.getMenuButtonBoundingClientRect && uni
	.getMenuButtonBoundingClientRect()) || null;
//获取系统导航栏高度
export const CustomBarHeight = getMenuButtonBoundingClientRect ? getMenuButtonBoundingClientRect.bottom +
	getMenuButtonBoundingClientRect.top - statusBarHeight : statusBarHeight + 50;
// 微信小程序登录流程
// 获取当前帐号信息，可以返回小程序的Appid
export const getAccountInfoSync=uni.getAccountInfoSync();
// 小程序appId
export const appId=getAccountInfoSync.miniProgram.appId;
// login登录
export const login=()=>{
	return new Promise((resolve,reject)=>{
		uni.login({
			provider: 'weixin',success:res=>resolve(res),
			fail:err=>reject(err)
		})
	})
}
	
// 更新资料
export const getUserProfile=(desc)=>{
	return new Promise((resolve,reject)=>{
		uni.getUserProfile({
			desc,
			success:res=>resolve(res),
			fail:err=>reject(err)
		})
	})
}
	
// 订阅消息
export const requestSubscribeMessage=(tmplIds)=>{
	return new Promise((resolve,reject)=>{
		uni.requestSubscribeMessage({
			tmplIds,
			success:res=>resolve(res),
			fail:err=>reject(err)
		})
	})
}
	
// 定位
// 查看权限
export const getSetting=()=>{
	return new Promise((resolve,reject)=>{
		uni.getSetting({
			success:res=>resolve(res),
			fail:err=>reject(err)
		})
	})
}
// 授权
export const openSetting=()=>{
	return new Promise((resolve,reject)=>{
		uni.openSetting({
			success:res=>resolve(res),
			fail:err=>reject(err)
		})
	})
}

// 获取地址
export const chooseLocation=()=>{
	return new Promise((resolve,reject)=>{
		uni.chooseLocation({
			success:res=>resolve(res),
			fail:err=>reject(err)
		})
	})
}

// 支付
exports.requestPayment=options=>{
	return new Promise((resolve,reject)=>{
		uni.requestPayment({
			...options,
			success:res=>resolve(true),
			fail:err=>resolve(false)
		})
	})
}