From edc56b92df9a70dcdc8a185d5af2ce854bae3462 Mon Sep 17 00:00:00 2001
From: liuyg <liuyg@qq.com>
Date: Mon, 21 Feb 2022 19:39:03 +0800
Subject: [PATCH] +
---
leafletMapOur/grabOrdersMap/js/vueMain.js | 64 ++++++++++++++++++++++++++------
1 files changed, 52 insertions(+), 12 deletions(-)
diff --git a/leafletMapOur/grabOrdersMap/js/vueMain.js b/leafletMapOur/grabOrdersMap/js/vueMain.js
index 5e850b4..43b7ccf 100644
--- a/leafletMapOur/grabOrdersMap/js/vueMain.js
+++ b/leafletMapOur/grabOrdersMap/js/vueMain.js
@@ -39,19 +39,57 @@
onPosition: false, //持续定位指示
},
methods: {
- setUniAppMsg(state, data) {
- let that = this;
-
- state == "hBackMsg" ? window.parent.hBackMsg(data);
- state == "setIntLat" ? window.parent.setIntLat({
- rid: that.data.id,
- fn: (out) => {
- // console.log(out,"1111");
- // that.addIcon(out);
- that.addIcon([out[1], out[0]]);
+ unis(data) {
+ //向uniapp传值
+ uni.postMessage({
+ data: {
+ action: data
}
});
- state == "showTip" ? that.parent.showTip("获取定位失败");
+ },
+ 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)
@@ -65,7 +103,7 @@
});
} else if (that.data.butCT == "begin") {
// 开始任务
- that.setUniAppMsg({
+ that.setUniAppMsg("hBackMsg", {
type: "start",
data: {
id: that.data.id,
@@ -372,6 +410,7 @@
if (typeof res.intlat === "string") {
// that.parent.showTip("获取定位失败")
//向uniapp传值
+ that.setUniAppMsg("showTip")
} else {
that.addIcon([res.intlat[1], res.intlat[0]]);
@@ -677,6 +716,7 @@
});
this.domMove.init();
// console.log(window.parent.setIntLat)
+ that.setUniAppMsg("setIntLat")
// window.parent.setIntLat({
// rid: this.data.id,
// fn: (out) => {
--
Gitblit v1.9.3