From 63ad2c3598400370dd7da5534659fd7e768a0a4a Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Mon, 16 May 2022 17:29:46 +0800
Subject: [PATCH] 地址替换

---
 public/grabOrdersMap/js/getPosition.js |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/public/grabOrdersMap/js/getPosition.js b/public/grabOrdersMap/js/getPosition.js
index bf87d99..e964082 100644
--- a/public/grabOrdersMap/js/getPosition.js
+++ b/public/grabOrdersMap/js/getPosition.js
@@ -1,4 +1,3 @@
-
 class $getPositions {
 	constructor(arg) {
 		this.id = arg.id || 0; //任务id
@@ -16,6 +15,7 @@
 		this.isContinued = false;
 		this.isContinuedTimeInt = null;
 		this.isContinuedTimeOut = null;
+		this.geolocation = null; //定位实例
 		return this;
 	}
 	//开始获取
@@ -50,6 +50,7 @@
 	continuedTime(val) {
 		//开始持续获取定位
 		let that = this;
+		that.geolocation = new qq.maps.Geolocation("T7RBZ-62U3X-RSQ4P-ZZVCB-WE7JT-HRBOG", "mapqq");
 		if (val != 1) {
 			// console.log(that.id,"开始持续定位")
 			this.isContinued = true;
@@ -78,7 +79,7 @@
 					}
 				}
 			})
-		}, 30000)
+		}, 3000)
 
 	}
 	overContinued() {
@@ -93,6 +94,9 @@
 			if (this.isContinuedTimeOut) {
 				clearTimeout(that.isContinuedTimeOut);
 				this.isContinuedTimeOut = null;
+			}
+			if (this.geolocation) {
+				this.geolocation = null;
 			}
 		}
 		this.isContinued = false;
@@ -117,12 +121,13 @@
 			};
 		outit();
 		//qq定位
-		var geolocation = new qq.maps.Geolocation("T7RBZ-62U3X-RSQ4P-ZZVCB-WE7JT-HRBOG", "mapqq");
+		// var geolocation = new qq.maps.Geolocation("T7RBZ-62U3X-RSQ4P-ZZVCB-WE7JT-HRBOG", "mapqq");
 		var options = {
 			// timeout: 1000
 		};
 
 		function showPosition(position) {
+			console.log(position)
 			let lat = position.lat; //
 			let lng = position.lng; //火星坐标 //TODO 实现业务代码逻辑 
 			that.onceNowPosition = [lng, lat];
@@ -139,7 +144,7 @@
 			ok = true;
 			outit();
 		};
-		geolocation.getLocation(showPosition, showErr, options);
+		that.geolocation.getLocation(showPosition, showErr, options);
 		// 高德定位
 		// console.log(AMap)
 		// AMap.plugin("AMap.Geolocation", function() {

--
Gitblit v1.9.3