From e3dcaeb0180a4e37347ac9ceb44c8a59ae7af37f Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Mon, 21 Feb 2022 19:40:20 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/qfqk-android

---
 leafletMapOur/grabOrdersMap/js/vueMain.js |  134 +++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 117 insertions(+), 17 deletions(-)

diff --git a/leafletMapOur/grabOrdersMap/js/vueMain.js b/leafletMapOur/grabOrdersMap/js/vueMain.js
index 99be971..43b7ccf 100644
--- a/leafletMapOur/grabOrdersMap/js/vueMain.js
+++ b/leafletMapOur/grabOrdersMap/js/vueMain.js
@@ -39,6 +39,58 @@
 		onPosition: false, //持续定位指示
 	},
 	methods: {
+		unis(data) {
+			//向uniapp传值
+			uni.postMessage({
+				data: {
+					action: data
+				}
+			});
+		},
+		setUniAppMsg(state, data) {
+			let that = this;
+			if (window.parent) {
+				console.log("有window.parent")
+				if (state == "hBackMsg") {
+					window.parent.hBackMsg(data);
+				}
+				if (state == "setIntLat") {
+					window.parent.setIntLat({
+						rid: that.data.id,
+						fn: (out) => {
+							// console.log(out,"1111");
+							// that.addIcon(out);
+							that.addIcon([out[1], out[0]]);
+						}
+					});
+				}
+				if (state == "showTip") {
+					that.parent.showTip("获取定位失败");
+				}
+			} else {
+				console.log("没window.parent")
+				if (state == "hBackMsg") {
+					// window.parent.hBackMsg(data);
+					that.unis("hBackMsg")
+				}
+				if (state == "setIntLat") {
+					// window.parent.setIntLat({
+					// 	rid: that.data.id,
+					// 	fn: (out) => {
+					// 		// console.log(out,"1111");
+					// 		// that.addIcon(out);
+					// 		that.addIcon([out[1], out[0]]);
+					// 	}
+					// });
+					that.unis("setIntLat")
+				}
+				if (state == "showTip") {
+					// that.parent.showTip("获取定位失败");
+					that.unis("showTip")
+				}
+
+			}
+		},
 		openAPP(type) {
 			// console.log(type)
 			let that = this;
@@ -46,13 +98,26 @@
 				if (that.data.butCT == "beginUp") {
 					// 反馈
 					uni.navigateTo({
-						url: '/pages/grabOrders/feedback?data=' + JSON.stringify(this.data)
+						url: '/pages/grabOrders/feedback?data=' + JSON.stringify(this.data) +
+							'&other="11111"'
 					});
 				} else if (that.data.butCT == "begin") {
 					// 开始任务
-					// uni.navigateTo({
-					// 	url: '/pages/grabOrders/feedback?data=' + JSON.stringify(this.data)
-					// });
+					that.setUniAppMsg("hBackMsg", {
+						type: "start",
+						data: {
+							id: that.data.id,
+							serid: that.data.serid
+						},
+						fn: function(val) {
+							if (val == "success") {
+								// console.log("成功开启任务")
+								that.data.butCT = "beginUp";
+								that.data.rtype = '0';
+								that.data.type = "0";
+							}
+						}
+					})
 				}
 			} else {
 				this.$confirm('是否参与活动:' + this.data.rname + "?", '提示', {
@@ -103,7 +168,7 @@
 				district: "西湖区",
 				id: 37,
 				integral: "222",
-				iscation: "0",
+				iscation: "1",
 				jnum: 3,
 				line: "LINESTRING(115.8995839881188 28.687205773173343,115.89391916267935 28.678966027079593,115.90404718391959 28.673644524394046,115.91211526863638 28.681369286356936)",
 				num: 1,
@@ -116,15 +181,15 @@
 				serid: "1123598821738675201,",
 				team: "你,他,它",
 				time: "2022-02-18 14:15:52",
-				type: "0",
+				type: "2",
 				url: "http://223.82.109.183:2081/zhba/upload/20220218/67f0c8bf3e7b5024c64133691f265072.ico",
 			}
 			//url解码
 			this.data = this.getQueryVariable('data') || data;
-			if (this.data.team) {
+			console.log(this.data)
+			if (typeof this.data.team === "string") {
 				this.data.team = this.data.team.split(',');
 			}
-			console.log(this.data)
 			let lines = this.data.line
 			let position = lines.slice(lines.indexOf("(") + 1, lines.indexOf(",")).split(" ");
 			// console.log(position)
@@ -338,21 +403,33 @@
 				this.oncePosition = new $getPositions({
 					id: 1,
 					fn: function(res) {
-						console.log(res);
+						// console.log(res);
 						that.mapPositionLoding = res.state;
 						if (!res.state) {
-							that.addIcon(res.intlat);
+							console.log(res)
+							if (typeof res.intlat === "string") {
+								// that.parent.showTip("获取定位失败")
+								//向uniapp传值
+								that.setUniAppMsg("showTip")
+
+							} else {
+								that.addIcon([res.intlat[1], res.intlat[0]]);
+							}
 						}
 					}
 				}).init();
-			}
-			if (!this.onPosition) {
-				this.oncePosition.continued();
-				this.onPosition = !this.onPosition;
+				this.oncePosition.once();
 			} else {
-				this.oncePosition.overContinued();
-				this.onPosition = !this.onPosition;
+				this.oncePosition.once();
 			}
+
+			// if (!this.onPosition) {
+			// 	this.oncePosition.continuedTime();
+			// 	this.onPosition = !this.onPosition;
+			// } else {
+			// 	this.oncePosition.overContinued();
+			// 	this.onPosition = !this.onPosition;
+			// }
 		},
 		//添加图标
 		addIcon(intlat) {
@@ -633,10 +710,33 @@
 				if (res.state === true || res.state === false) {
 					that.map.invalidateSize(true);
 				}
-				document.getElementsByClassName("dingwei")[0].style.bottom = res.height + 10 + "px";
+				document.getElementsByClassName("dingwei")[0].style.bottom = res.height +
+					10 + "px";
 			},
 		});
 		this.domMove.init();
+		// console.log(window.parent.setIntLat)
+		that.setUniAppMsg("setIntLat")
+		// window.parent.setIntLat({
+		// 	rid: this.data.id,
+		// 	fn: (out) => {
+		// 		// console.log(out,"1111");
+		// 		// that.addIcon(out);
+		// 		that.addIcon([out[1], out[0]]);
+		// 	}
+		// })
+		window.addEventListener('message', e => {
+			console.log(e, 'HTML 接受APP发送过来的消息 (H5端)');
+			app.dataList = JSON.parse(e.data.data).navigation
+			console.log(app.dataList, '+++++++++');
+		}, false)
+
+
+		// HTML 接受APP发送过来的消息 (APP端)
+		function requestData(data) {
+			console.log(JSON.stringify(data), 'HTML 接受APP发送过来的消息 (APP端)');
+			app.dataList = data.navigation // 赋值
+		}
 	},
 	wacth: {}
 })

--
Gitblit v1.9.3