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/vueMain.js |   62 ++++++++++++++++++++++---------
 1 files changed, 44 insertions(+), 18 deletions(-)

diff --git a/public/grabOrdersMap/js/vueMain.js b/public/grabOrdersMap/js/vueMain.js
index f45a300..0cfc8d5 100644
--- a/public/grabOrdersMap/js/vueMain.js
+++ b/public/grabOrdersMap/js/vueMain.js
@@ -37,6 +37,9 @@
 		mapPositionLoding: false, //定位loding
 		oncePosition: null, //一次定位实例
 		onPosition: false, //持续定位指示
+
+		setPositionTime: null, //发送定位节流
+		setPositionUseTime: 30000, //节流时间
 	},
 	methods: {
 		// unis(data) {
@@ -97,7 +100,7 @@
 			if (type != 1) {
 				if (that.data.butCT == "beginUp") {
 					// 反馈
-					if(that.onPosition){
+					if (that.onPosition) {
 						that.onPosition.overContinued();
 					}
 					uni.redirectTo({
@@ -152,11 +155,19 @@
 										jd: out[0],
 										wd: out[1],
 									}
-									// console.log(d)
-									axios.post(that.data.appenUrl + "trar/submit", d)
-										.then(res => {
-											// console.log('res=>', res);
-										})
+									if (that.setPositionTime) {
+										return;
+									} else {
+										that.setPositionTime = setTimeout(() => {
+											axios.post(that.data.appenUrl +
+													"trar/submit", d)
+												.then(res => {
+													// console.log('res=>', res);
+												})
+											clearTimeout(that.setPositionTime);
+											that.setPositionTime = null;
+										}, that.setPositionUseTime)
+									}
 								} else {
 									console.log("获取定位失败")
 								}
@@ -230,8 +241,8 @@
 					serid: "1123598821738675201,",
 					team: "你,他,它",
 					time: "2022-02-18 14:15:52",
-					type: "2",
-					url: "http://223.82.109.183:2081/zhba/upload/20220218/67f0c8bf3e7b5024c64133691f265072.ico",
+					type: "0",
+					url: "http://61.131.136.25:2081/zhba/upload/20220218/67f0c8bf3e7b5024c64133691f265072.ico",
 				},
 				that = this;
 			//url解码
@@ -240,8 +251,8 @@
 			if (typeof this.data == "string") {
 				this.data = JSON.parse(this.data)
 			}
-			// console.log(this.data)
-			if (this.data.isOn) {
+			console.log(this.data)
+			if (this.data.isOn || this.data.butCT == "beginUp") {
 				//队长开启任务
 				let rid = that.data.id;
 				that.onPosition = new $getPositions({
@@ -261,6 +272,7 @@
 						let out = res.intlat;
 						if (typeof out != "string") {
 							that.addIcon([out[1], out[0]]);
+							console.log(out)
 							//坐标输出
 							let d = {
 								uid: that.data.myid,
@@ -269,10 +281,18 @@
 								wd: out[1],
 							}
 							// console.log(d)
-							axios.post(that.data.appenUrl + "trar/submit", d)
-								.then(res => {
-									// console.log('res=>', res);
-								})
+							if (that.setPositionTime) {
+								return;
+							} else {
+								that.setPositionTime = setTimeout(() => {
+									axios.post(that.data.appenUrl + "trar/submit", d)
+										.then(res => {
+											// console.log('res=>', res);
+										})
+									clearTimeout(that.setPositionTime);
+									that.setPositionTime = null;
+								}, that.setPositionUseTime)
+							}
 						} else {
 							console.log("获取定位失败")
 						}
@@ -339,7 +359,7 @@
 			// desc = "+proj=longlat +datum=WGS84 +no_defs ",
 			// crs = new L.CRS("EPSG:4326", desc, {});
 			// center = [data[0].wd, data[0].jd],
-			// url = `http://223.82.109.183:2082/api/alarm/alarm/APP-getAlarm?id=${data[0].id}`;
+			// url = `http://61.131.136.25:2082/api/alarm/alarm/APP-getAlarm?id=${data[0].id}`;
 			// url = `http://localhost:89/alarm/alarm/APP-getAlarm?id=${data[0].id}`;
 			// this.nowPosition = center;
 			// axios.post(url).then((res) => {
@@ -570,7 +590,7 @@
 				var city = position.city; //城市
 				var addr = position.addr; //详细地址
 				that.lat = position.lat; //
-				that.lng = position.lng; //火星坐标 //TODO 实现业务代码逻辑 
+				that.lng = position.lng; //火星坐标 //TODO 实现业务代码逻辑
 				that.haveShishiweizhi++; //控制只执行一次
 				console.log(position)
 				// console.log(that.haveShishiweizhi)
@@ -616,7 +636,7 @@
 			};
 
 			function showErr() {
-				//TODO 如果出错了调用此方法 
+				//TODO 如果出错了调用此方法
 				// console.log(15)
 			};
 
@@ -837,5 +857,11 @@
 		// 	app.dataList = data.navigation // 赋值
 		// }
 	},
-	wacth: {}
+	wacth: {},
+	beforeDestroy() {
+		let that = this;
+		if (that.onPosition) {
+			that.onPosition.overContinued();
+		}
+	}
 })

--
Gitblit v1.9.3