| | |
| | | import mapData from "../../../static/mapData"; |
| | | import rpc from "./rpc"; |
| | | import vueEvents from '@/utils/vueEvent.js' |
| | | import vueEvents from "@/utils/vueEvent.js"; |
| | | window.mapMsg = { |
| | | setTimeInterval: null, |
| | | testMsg(res) { |
| | | this.setMsgMatching({ |
| | | message: res, |
| | | baidu_keys: { |
| | | results: [{ |
| | | results: [ |
| | | { |
| | | word: res |
| | | }] |
| | | } |
| | | ] |
| | | } |
| | | }); |
| | | }, |
| | |
| | | if (this.setTimeInterval) { |
| | | clearInterval(this.setTimeInterval); |
| | | this.setTimeInterval = null; |
| | | |
| | | } |
| | | if (res.data.status === "ok") { |
| | | that.setMsgMatching(res.data.params); |
| | | } |
| | | this.setTimeInterval = setTimeout((res) => { |
| | | this.setTimeInterval = setTimeout(res => { |
| | | vueEvents.$emit("queryData", false); |
| | | rpc.setClearAllMsg(); |
| | | rpc.setLineRoaming() |
| | | rpc.setLineRoaming(); |
| | | clearInterval(this.setTimeInterval); |
| | | this.setTimeInterval = null; |
| | | }, 70000) |
| | | |
| | | }, 70000); |
| | | }); |
| | | |
| | | |
| | | }, |
| | | |
| | | //消息匹配 |
| | | setMsgMatching(result) { |
| | | var param = result.message; |
| | | var rest = mapData.msgMach.rest; |
| | | var rom = mapData.msgMach.lineRoam; |
| | | var closeRomData = mapData.msgMach.closeRoam; |
| | | var valRest = rest.filter((rs) => { |
| | | var valRest = rest.filter(rs => { |
| | | if (param.indexOf(rs) > -1) { |
| | | return rs; |
| | | } |
| | | }) |
| | | }); |
| | | |
| | | // 地图复位 |
| | | if (valRest.length > 0) { |
| | | |
| | | vueEvents.$emit("queryData", false); |
| | | rpc.setClearAllMsg(); |
| | | rpc.setMapRest(); |
| | | return |
| | | return; |
| | | } |
| | | //漫游 |
| | | var valRom = rom.filter((rs) => { |
| | | var valRom = rom.filter(rs => { |
| | | if (param.indexOf(rs) > -1) { |
| | | return rs; |
| | | } |
| | | }) |
| | | }); |
| | | if (valRom.length > 0) { |
| | | |
| | | vueEvents.$emit("queryData", false); |
| | | rpc.setClearAllMsg(); |
| | | rpc.setLineRoaming() |
| | | return |
| | | rpc.setLineRoaming(); |
| | | return; |
| | | } |
| | | // 停止漫游 |
| | | var closeRom = closeRomData.filter((rs) => { |
| | | var closeRom = closeRomData.filter(rs => { |
| | | if (param.indexOf(rs) > -1) { |
| | | return rs |
| | | return rs; |
| | | } |
| | | }); |
| | | if (closeRom.length > 0) { |
| | | rpc.setCloseLineRomaing(); |
| | | return |
| | | return; |
| | | } |
| | | |
| | | rpc.getFuzzyQuery(result) |
| | | |
| | | }, |
| | | rpc.getFuzzyQuery(result); |
| | | } |
| | | }; |
| | | export default mapMsg |
| | | export default mapMsg; |
| | | |