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 | 112 +++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 99 insertions(+), 13 deletions(-)
diff --git a/leafletMapOur/grabOrdersMap/js/vueMain.js b/leafletMapOur/grabOrdersMap/js/vueMain.js
index 9af9922..43b7ccf 100644
--- a/leafletMapOur/grabOrdersMap/js/vueMain.js
+++ b/leafletMapOur/grabOrdersMap/js/vueMain.js
@@ -39,8 +39,57 @@
onPosition: false, //持续定位指示
},
methods: {
- setUniAppMsg(data) {
- window.parent.hBackMsg(data)
+ 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)
@@ -54,15 +103,18 @@
});
} else if (that.data.butCT == "begin") {
// 开始任务
- this.setUniAppMsg({
+ that.setUniAppMsg("hBackMsg", {
type: "start",
data: {
id: that.data.id,
serid: that.data.serid
},
fn: function(val) {
- if(val == "success"){
- console.log("成功开启任务")
+ if (val == "success") {
+ // console.log("成功开启任务")
+ that.data.butCT = "beginUp";
+ that.data.rtype = '0';
+ that.data.type = "0";
}
}
})
@@ -351,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.continuedTime();
- 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) {
@@ -651,6 +715,28 @@
},
});
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