export default{
	distanceComput: function(distance){
		if(distance < 1000){
			return distance + "米";
		}else if(distance >= 1000){
			return (Math.round(distance/100)/10).toFixed(1) + "公里"
		}else{
			return 0;
		}
	},
	diffSeconds: function (newV) {
		const hours = Math.floor(newV / 3600);
		const minutes = Math.floor(newV / 60) % 60;
		// 拼装数据
		return hours? hours + '小时' + minutes + "分钟" : minutes + "分钟";
	},
	// 计算两个坐标距离    
	getDistance:function(lat1,lng1,lat2,lng2){
	    var radLat1 = lat1*Math.PI / 180.0;
	    var radLat2 = lat2*Math.PI / 180.0;
	    var a = radLat1 - radLat2;
	    var  b = lng1*Math.PI / 180.0 - lng2*Math.PI / 180.0;
	    var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a/2),2) +
	    Math.cos(radLat1)*Math.cos(radLat2)*Math.pow(Math.sin(b/2),2)));
	    s = s *6378.137 ;// EARTH_RADIUS;
	    s = Math.round(s * 10000) / 10000;
	    return s;
	}
}