function calcContentHeight(chaliang) {
	let contentHeight = 0
	uni.getSystemInfo({
		success(res) {
			contentHeight = res.windowHeight - 40 - chaliang
		}
	})
	return contentHeight
}
function SystemInfo() {//获取屏幕宽高
	let SystemInfo = {}
	uni.getSystemInfo({
		success(res) {
			SystemInfo.windowWidth = res.windowWidth
			SystemInfo.windowHeight = res.windowHeight
		}
	})
	return SystemInfo
}
function getRect(selector) {//获取元素的信息
	return new Promise((resolve) => {
		let view = uni.createSelectorQuery().select(selector);
		view.fields({
			size: true,
			rect: true,
			scrollOffset: true
		}, (res) => {
			resolve(res);
		}).exec();
	})
}

function AddDay(date, day) {
	let myDate = "";
	if (date) {
		myDate = new Date(date);
	} else {
		myDate = new Date();
	}
	myDate = myDate.setDate(myDate.getDate() + day);
	myDate = new Date(myDate);
	const seperator1 = "-";
	let year = myDate.getFullYear();
	let month = myDate.getMonth() + 1;
	let strDate = myDate.getDate();
	if (month >= 1 && month <= 9) {
		month = "0" + month;
	}
	if (strDate >= 0 && strDate <= 9) {
		strDate = "0" + strDate;
	}
	let currentdate = year + seperator1 + month + seperator1 + strDate;
	return currentdate;
}
let timer=null
function debounce(cb, delay=500) {
	if(timer) clearTimeout(timer)
	timer=setTimeout(()=>{
		cb()
	},delay)
}
export default {
	calcContentHeight,
	SystemInfo,
	getRect,
	AddDay,
	debounce,
}