build(custom): 修正提交规范
This commit is contained in:
@@ -2,22 +2,29 @@ import { showToast, navigateBack } from "@tarojs/taro";
|
||||
|
||||
// 经纬度计算距离
|
||||
export function calculateDistance(
|
||||
la1: number,
|
||||
lo1: number,
|
||||
la2: number,
|
||||
lo2: number
|
||||
la1: number,
|
||||
lo1: number,
|
||||
la2: number,
|
||||
lo2: number
|
||||
): any {
|
||||
var radLat1 = la1 * Math.PI / 180.0;
|
||||
var radLat2 = la2 * Math.PI / 180.0;
|
||||
var a = radLat1 - radLat2;
|
||||
var b = lo1 * Math.PI / 180.0 - lo2 * 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;
|
||||
s = Math.round(s * 10000) / 10000;
|
||||
return s.toFixed(2) + 'km'
|
||||
var radLat1 = (la1 * Math.PI) / 180.0;
|
||||
var radLat2 = (la2 * Math.PI) / 180.0;
|
||||
var a = radLat1 - radLat2;
|
||||
var b = (lo1 * Math.PI) / 180.0 - (lo2 * 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;
|
||||
s = Math.round(s * 10000) / 10000;
|
||||
return s.toFixed(2) + "km";
|
||||
}
|
||||
|
||||
// 将角度转换为弧度
|
||||
function toRadians(degrees: number): number {
|
||||
return (degrees * Math.PI) / 180;
|
||||
return (degrees * Math.PI) / 180;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user