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

---
 pages/grabOrders/map.vue |   42 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/pages/grabOrders/map.vue b/pages/grabOrders/map.vue
index 6125cf9..5d661ae 100644
--- a/pages/grabOrders/map.vue
+++ b/pages/grabOrders/map.vue
@@ -13,12 +13,28 @@
 				urls: '',
 				// dataList: [],
 				fn: null,
-				rid: ''
+				rid: '',
+				webV: null,
+				wv: null,
 			}
 		},
 		methods: {
 			message(event) {
-				console.log(event.detail.data);
+				let data = event.detail.data;
+
+				console.log(data);
+			},
+			sendRequestData(res, plt = 0) {
+				let param = JSON.stringify(res)
+				console.log(param);
+				if (plt == 1) {
+					this.webV.postMessage({
+						type: 'new',
+						data: param
+					})
+				} else {
+					this.wv.evalJS(`requestData(${param})`);
+				}
 			}
 		},
 		computed: {
@@ -79,7 +95,8 @@
 			}
 		},
 		onLoad: function(options) {
-			var data = [];
+			var data = [],
+				that = this;
 			if (options.data == undefined) {
 				data = JSON.stringify({
 					appenUrl: "http://192.168.0.108:83/",
@@ -129,9 +146,28 @@
 			// this.urls = a + "grabOrdersMap/xcxmap.html?data=" + data;
 			// a = a.slice(0, a.indexOf('api'));
 			this.urls = a + "grabOrdersMap/xcxmap.html?data=" + data;
+			// this.urls = "http://localhost:80?data=" + data;
 			// http://127.0.0.1:8848/qfqk-android/grabOrdersMap/xcxmap.html
 			// this.dataList = data;
 			// console.log(this.urls);
+			let type = uni.getSystemInfoSync().platform;
+			if (type == "android") {
+				//webView传值
+				let currentWebview = this.$scope.$getAppWebview();
+				setTimeout(() => {
+					that.wv = currentWebview.children()[0];
+					console.log(that.wv)
+				}, 1000)
+				window.addEventListener('message', e => {
+					console.log(e)
+					that.webV = e.source // window的对象
+					console.log(e.data.data.arg, '接收h5页面发来的消息'); // 接收h5页面发来的消息(11)  ====>H5端
+				}, false)
+				setTimeout(() => {
+					that.sendRequestData("给html", 1);
+					that.sendRequestData("给html", 2);
+				}, 10000)
+			}
 		},
 		beforeDestroy() {
 			this.$store.commit("changegotuGrabOrders");

--
Gitblit v1.9.3