diff --git a/pages/index/index.vue b/pages/index/index.vue
index 81c882c..e447122 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -118,10 +118,10 @@
-
+ {{item.dingwei}}km
+
@@ -479,6 +479,23 @@
// }
},
methods: {
+ calculateDistance(lat1, lon1, lat2, lon2) {
+ // 将经纬度转换为弧度
+ const radLat1 = lat1 * (Math.PI / 180);
+ const radLat2 = lat2 * (Math.PI / 180);
+ const radLon1 = lon1 * (Math.PI / 180);
+ const radLon2 = lon2 * (Math.PI / 180);
+ const a = radLat1 - radLat2;
+ const b = radLon1 - radLon2;
+
+ // 使用海里公式计算距离
+ const Haversine = Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2);
+ const distance = 2 * 6371 * Math.atan2(Math.sqrt(Haversine), Math.sqrt(1 - Haversine));
+
+ // 返回单位为公里的距离
+ return distance;
+
+ },
// 开启订阅消息
openMsg() {
console.log('订阅消息')
@@ -749,8 +766,32 @@
this.$Request.get("/app/artificer/getHomeArtificerList",data).then(res => {
if (res.code == 0) {
this.starTechnician = res.startData.list;
- this.nearbyTechnician=res.nearData.list
- console.log("starTechnician",res.startData.list)
+ this.nearbyTechnician=res.nearData.list;
+ const myLatitude = this.latitude; // 当前位置纬度
+ const myLongitude = this.longitude; // 当前位置经度
+ // const targetLatitude = 39.919; // 目标位置纬度
+ // const targetLongitude = 116.486; // 目标位置经度
+ const targetLatitude = ''; // 目标位置纬度
+ const targetLongitude =''; // 目标位置经度
+ for(var i=0;i",this.nearbyTechnician)
// this.classifyId = res.data[0].id;
// this.getorderlist('')
}