|
@@ -186,7 +186,6 @@ Page({
|
|
|
}
|
|
|
|
|
|
},
|
|
|
-<<<<<<< HEAD
|
|
|
haversineDistance(location1, location2) {
|
|
|
let lat1 = location1.latitude
|
|
|
let lon1 = location1.longitude
|
|
@@ -210,34 +209,6 @@ Page({
|
|
|
const distance = R * c; // 距离,单位为米
|
|
|
return distance;
|
|
|
},
|
|
|
-=======
|
|
|
-
|
|
|
- // 经纬度点距离 gcj-02坐标系
|
|
|
- haversineDistance(location1, location2) {
|
|
|
- let lat1 = location1.latitude
|
|
|
- let lon1 = location1.longitude
|
|
|
- let lat2 = location2.latitude
|
|
|
- let lon2 = location2.longitude
|
|
|
-
|
|
|
- function toRad(degree) {
|
|
|
- return degree * Math.PI / 180;
|
|
|
- }
|
|
|
- const R = 6371e3; // 地球半径,单位为米
|
|
|
- const φ1 = toRad(lat1);
|
|
|
- const φ2 = toRad(lat2);
|
|
|
- const Δφ = toRad(lat2 - lat1);
|
|
|
- const Δλ = toRad(lon2 - lon1);
|
|
|
-
|
|
|
- const a = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
|
|
|
- Math.cos(φ1) * Math.cos(φ2) *
|
|
|
- Math.sin(Δλ / 2) * Math.sin(Δλ / 2);
|
|
|
- const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
|
-
|
|
|
- const distance = R * c; // 距离,单位为米
|
|
|
- return distance;
|
|
|
- }
|
|
|
-
|
|
|
->>>>>>> c1abe100c0dbb4b7b2ded507c188ca0ff68f5825
|
|
|
//切换
|
|
|
switchTab (e) {
|
|
|
const index = e.currentTarget.dataset.index;
|