export default{
	getCurrentPageUrl(){//---获取当前页面url
		let pages = getCurrentPages() //获取加载的页面
		let currentPage = pages[pages.length-1] //获取当前页面的对象
		let url = currentPage.route //当前页面url
		let options = currentPage.options //如果要获取url中所带的参数可
		let queryTotal=""
		for (let key in options){
			 queryTotal+="&"+key+"="+options[key]
		}
		queryTotal=queryTotal.substr(1)
		let pageUrl=url+"?"+queryTotal//请求的全路径
		return pageUrl
	},
	today:function(){//默认当天
		var now = new Date();
		var day = ("0" + now.getDate()).slice(-2);
		var month = ("0" + (now.getMonth() + 1)).slice(-2);
		var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
		return today
	},
	todayTime:function(){
		var now = new Date();
		var hour = now.getHours()<10?'0'+now.getHours():now.getHours()
		var minutes = now.getMinutes()<10?'0'+now.getMinutes():now.getMinutes()
		var seconds = now.getSeconds()<10?'0'+now.getSeconds():now.getSeconds()
		var time = hour+":"+minutes+":"+seconds
		return time
	},
	dateDifference:function(start,end){//结束日期与开始日期相差几天
		var strSeparator = "-";
	    var oDate1= start.split(strSeparator);
	    var oDate2= end.split(strSeparator);
	    var strDateS = new Date(oDate1[0], oDate1[1]-1, oDate1[2]);
	    var strDateE = new Date(oDate2[0], oDate2[1]-1, oDate2[2]);
	    var iDays = parseInt((strDateE- strDateS) / 1000 / 60 / 60 /24)
	    return iDays
	}
}
//调用方法时--this.$commonjs.today()