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
---
leafletMapOur/grabOrdersMap/js/vueMain.js | 186 +++++++++++++++++++++---------------
store/positions.js | 16 +-
leafletMapOur/grabOrdersMap/js/getPosition.js | 2
pages/grabOrders/map.vue | 42 +++++++
store/lid/getPosition.js | 2
5 files changed, 158 insertions(+), 90 deletions(-)
diff --git a/leafletMapOur/grabOrdersMap/js/getPosition.js b/leafletMapOur/grabOrdersMap/js/getPosition.js
index a154b87..7a4ac09 100644
--- a/leafletMapOur/grabOrdersMap/js/getPosition.js
+++ b/leafletMapOur/grabOrdersMap/js/getPosition.js
@@ -77,7 +77,7 @@
}
}
})
- }, 3000)
+ }, 30000)
}
overContinued() {
diff --git a/leafletMapOur/grabOrdersMap/js/vueMain.js b/leafletMapOur/grabOrdersMap/js/vueMain.js
index 43b7ccf..7d797c9 100644
--- a/leafletMapOur/grabOrdersMap/js/vueMain.js
+++ b/leafletMapOur/grabOrdersMap/js/vueMain.js
@@ -39,58 +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")
- }
+ // 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;
@@ -103,20 +103,54 @@
});
} else if (that.data.butCT == "begin") {
// 开始任务
- 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";
+ // 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";
+ // }
+ // }
+ // })
+ let rid = that.data.id,
+ serid = that.data.serid,
+ type = 'start',
+ url = that.data.appenUrl + "taskqd/startTask?" +
+ `rid=${rid}&serid=${serid}&type=${type}`;
+ axios.get(url).then((res) => {
+ // console.log(res);
+ that.onPosition = new $getPositions({
+ id: rid,
+ fn: function(res) {
+ // console.log(res);
+ // state.isOnTaskValue[id] = {
+ // id: id,
+ // intlat: res.intlat
+ // }
+ // state.changes = !state.changes;
+ // console.log(state.isOnTaskValue)
+ // $store.commit("setMsg", {
+ // id: id,
+ // intlat: res.intlat
+ // })
+ let out = res.intlat;
+ if (typeof out != "string") {
+ that.addIcon([out[1], out[0]]);
+ } else {
+ console.log("获取定位失败")
+ }
}
- }
+ })
+ that.onPosition.continuedTime();
+ that.data.butCT = "beginUp";
+ that.data.rtype = '0';
+ that.data.type = "0";
})
}
} else {
@@ -409,8 +443,6 @@
console.log(res)
if (typeof res.intlat === "string") {
// that.parent.showTip("获取定位失败")
- //向uniapp传值
- that.setUniAppMsg("showTip")
} else {
that.addIcon([res.intlat[1], res.intlat[0]]);
@@ -716,7 +748,7 @@
});
this.domMove.init();
// console.log(window.parent.setIntLat)
- that.setUniAppMsg("setIntLat")
+ // that.setUniAppMsg("setIntLat")
// window.parent.setIntLat({
// rid: this.data.id,
// fn: (out) => {
@@ -725,18 +757,18 @@
// 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)
+ // 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 // 赋值
- }
+ // // HTML 接受APP发送过来的消息 (APP端)
+ // function requestData(data) {
+ // console.log(JSON.stringify(data), 'HTML 接受APP发送过来的消息 (APP端)');
+ // app.dataList = data.navigation // 赋值
+ // }
},
wacth: {}
})
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");
diff --git a/store/lid/getPosition.js b/store/lid/getPosition.js
index 510d2b8..6fc0442 100644
--- a/store/lid/getPosition.js
+++ b/store/lid/getPosition.js
@@ -77,7 +77,7 @@
}
}
})
- }, 3000)
+ }, 30000)
}
overContinued() {
diff --git a/store/positions.js b/store/positions.js
index 8f46b50..b8cd667 100644
--- a/store/positions.js
+++ b/store/positions.js
@@ -28,16 +28,16 @@
id: id,
fn: function(res) {
// console.log(res);
- state.isOnTaskValue[id] = {
- id: id,
- intlat: res.intlat
- }
- state.changes = !state.changes;
- console.log(state.isOnTaskValue)
- // $store.commit("setMsg", {
+ // state.isOnTaskValue[id] = {
// id: id,
// intlat: res.intlat
- // })
+ // }
+ // state.changes = !state.changes;
+ // console.log(state.isOnTaskValue)
+ $store.commit("setMsg", {
+ id: id,
+ intlat: res.intlat
+ })
}
})
}
--
Gitblit v1.9.3