From b822243b7bbdb0704e58db6fd5237076b3a432c9 Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Tue, 22 Feb 2022 11:19:44 +0800
Subject: [PATCH] +细节  错开地图定位和上传定位时间

---
 leafletMapOur/grabOrdersMap/js/vueMain.js     |   43 +++++++++++++++++++++++++++++++------------
 pages/grabOrders/feedback.vue                 |   10 +++++++---
 leafletMapOur/grabOrdersMap/js/getPosition.js |    2 +-
 pages/grabOrders/map.vue                      |    2 +-
 4 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/leafletMapOur/grabOrdersMap/js/getPosition.js b/leafletMapOur/grabOrdersMap/js/getPosition.js
index bf87d99..8746a6a 100644
--- a/leafletMapOur/grabOrdersMap/js/getPosition.js
+++ b/leafletMapOur/grabOrdersMap/js/getPosition.js
@@ -78,7 +78,7 @@
 					}
 				}
 			})
-		}, 30000)
+		}, 3000)
 
 	}
 	overContinued() {
diff --git a/leafletMapOur/grabOrdersMap/js/vueMain.js b/leafletMapOur/grabOrdersMap/js/vueMain.js
index f45a300..d6000c6 100644
--- a/leafletMapOur/grabOrdersMap/js/vueMain.js
+++ b/leafletMapOur/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("获取定位失败")
 								}
@@ -209,7 +220,7 @@
 		beginCome() {
 			var data = {
 					appenUrl: "http://192.168.0.108:83/",
-					butCT: "begin",
+					butCT: "beginUp",
 					buttype: 0,
 					captain: "我",
 					city: "南昌市",
@@ -230,7 +241,7 @@
 					serid: "1123598821738675201,",
 					team: "你,他,它",
 					time: "2022-02-18 14:15:52",
-					type: "2",
+					type: "0",
 					url: "http://223.82.109.183:2081/zhba/upload/20220218/67f0c8bf3e7b5024c64133691f265072.ico",
 				},
 				that = this;
@@ -269,10 +280,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("获取定位失败")
 						}
diff --git a/pages/grabOrders/feedback.vue b/pages/grabOrders/feedback.vue
index 72d4e4d..1df3499 100644
--- a/pages/grabOrders/feedback.vue
+++ b/pages/grabOrders/feedback.vue
@@ -13,13 +13,13 @@
 			<view class="title" style="padding-top: 0.5rem;">请输入任务心得:</view>
 			<view class="f">
 				<view class="main" style="margin:0 1rem;">
-					<textarea rows="9" cols="27" placeholder="请输入任务心得。" v-model="content"></textarea>
+					<textarea rows="9" cols="27" placeholder="请输入任务心得。" class="textareas" v-model="content"></textarea>
 				</view>
 			</view>
 			<view class="title" style="padding-top: 0.5rem;">请输入任务意见:</view>
 			<view class="f">
 				<view class="main" style="margin:0 1rem;">
-					<textarea rows="9" cols="27" placeholder="请输入任务意见。" v-model="yj"></textarea>
+					<textarea rows="9" cols="27" placeholder="请输入任务意见。" class="textareas" v-model="yj"></textarea>
 				</view>
 			</view>
 			<view class="title">照片上传:</view>
@@ -304,7 +304,7 @@
 
 			.main {
 				margin: 0.5rem;
-				border: 1px solid rgba($color: #000000, $alpha: 0.5);
+				// border: 1px solid rgba($color: #000000, $alpha: 0.5);
 				height: 8rem;
 			}
 		}
@@ -396,4 +396,8 @@
 			color: #ffffff;
 		}
 	}
+	
+	// .main{
+	// 	border: 1px solid transparent;
+	// }
 </style>
diff --git a/pages/grabOrders/map.vue b/pages/grabOrders/map.vue
index 5d661ae..e9994e7 100644
--- a/pages/grabOrders/map.vue
+++ b/pages/grabOrders/map.vue
@@ -135,7 +135,7 @@
 			// console.log(a)
 			// let a = "grabOrdersMap/xcxmap.html";
 			// this.urls = "http://223.82.109.183:2082/" + a + "?data=" + data;
-			let name = 2; //1是本地  2是服务器
+			let name = 1; //1是本地  2是服务器
 			// let name = 1;
 			let b = this.$store.state.piAPI;
 			if (b == '/api') {

--
Gitblit v1.9.3