| | |
| | | window.mapMsg = { |
| | | setTimeInterval: null, |
| | | testMsg(res) { |
| | | // console.log(res); |
| | | console.log(res); |
| | | this.setMsgMatching({ |
| | | message: res, |
| | | baidu_keys: { |
| | |
| | | init() { |
| | | var that = this; |
| | | window.addEventListener("message", res => { |
| | | // if (res.data.status === "ok") { |
| | | // that.setMsgMatching(res.data.params); |
| | | // } |
| | | if (res.data.type === "command") { |
| | | let info = res.data.params |
| | | let info = res.data.params; |
| | | let resIndex = ''; |
| | | if (info.includes("定位到")) { |
| | | info.search("。") != -1 ? mapMsg.testMsg(info.slice(3, -1)) : mapMsg.testMsg(info.slice(3)) |
| | | resIndex = info.search('定位到') + 3; |
| | | } else if (info.includes("定位")) { |
| | | info.search("。") != -1 ? mapMsg.testMsg(info.slice(2, -1)) : mapMsg.testMsg(info.slice(2)) |
| | | resIndex = info.search('定位') + 2; |
| | | } else { |
| | | info.search("。") != -1 ? mapMsg.testMsg(info.slice(0, -1)) : mapMsg.testMsg(info.slice(0)) |
| | | // mapMsg.testMsg(info.slice(0, -1))//有句号 |
| | | // mapMsg.testMsg(info.slice(0))//没句号 |
| | | resIndex = info.search('') + 0; |
| | | } |
| | | info.search("。") != -1 ? mapMsg.testMsg(info.slice(resIndex, -1)) : mapMsg.testMsg(info.slice(resIndex)); |
| | | } |
| | | // // if (res.data.status === "ok") { |
| | | // // that.setMsgMatching(res.data.params); |
| | | // // } |
| | | // if (res.data.type === "command") { |
| | | // let info = res.data.params |
| | | // if (info.includes("定位到")) { |
| | | // info.search("。") != -1 ? mapMsg.testMsg(info.slice(3, -1)) : mapMsg.testMsg(info.slice(3)) |
| | | // } else if (info.includes("定位")) { |
| | | // info.search("。") != -1 ? mapMsg.testMsg(info.slice(2, -1)) : mapMsg.testMsg(info.slice(2)) |
| | | // } else { |
| | | // info.search("。") != -1 ? mapMsg.testMsg(info.slice(0, -1)) : mapMsg.testMsg(info.slice(0)) |
| | | // // mapMsg.testMsg(info.slice(0, -1))//有句号 |
| | | // // mapMsg.testMsg(info.slice(0))//没句号 |
| | | // } |
| | | // } |
| | | }); |
| | | }, |
| | | // clearTime() { |
| | |
| | | var rom = mapData.msgMach.lineRoam;//'漫游', '导航' |
| | | var closeRomData = mapData.msgMach.closeRoam;//'停止漫游', '停止导航' |
| | | // var acceptData = mapData.msgMach.acceptMsg; |
| | | |
| | | |
| | | // 地图复位 |
| | | var valRest = rest.filter((rs) => { |
| | | if (param.indexOf(rs) > -1) { |