| | |
| | | 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; |
| | |
| | | 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 + "?", '提示', { |
| | |
| | | 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, |
| | |
| | | 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) |
| | |
| | | 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) { |
| | |
| | | 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: {} |
| | | }) |