modified: pages/basketballGym/index.js

modified:   pages/basketballGym/index.wxml
modified:   pages/currentEnter/index.wxml
modified:   pages/loginIndex/index.js
modified:   pages/loginIndex/index.wxml
modified:   pages/loginIndex/index.wxss
modified:   pages/myEnters/index.wxml
modified:   utils/api.js
modified:   utils/util.js
This commit is contained in:
2026-04-08 16:40:48 +08:00
parent db13ba7c1c
commit 1559181b2e
9 changed files with 156 additions and 166 deletions

View File

@@ -52,9 +52,22 @@ const getTimeoutStorage = (key) => {
return value;
}
// 计算两点之间的距离(返回米)
const getDistance = (lat1, lng1, lat2, lng2) => {
const radLat1 = lat1 * Math.PI / 180.0;
const radLat2 = lat2 * Math.PI / 180.0;
const a = radLat1 - radLat2;
const b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
let 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) / 10; // 换算成米
return s;
}
module.exports = {
formatTime: formatTime,
getCurrentPageUrl: getCurrentPageUrl,
setTimeOutStorage: setTimeOutStorage,
getTimeoutStorage: getTimeoutStorage
getTimeoutStorage: getTimeoutStorage,
getDistance: getDistance
}