diff --git a/src/main.js b/src/main.js index 0bbff4b..aacde26 100644 --- a/src/main.js +++ b/src/main.js @@ -165,18 +165,12 @@ window.PubScribe = function (topic, number, _callback, other = false, fromName = }, (err) => { if (!err) { console.log("订阅成功1", topic); - // setTimeout(function() { - console.log("订阅成功1"); console.log("订阅成功1-fromName注释:url里的id字符串来于分析index视频页面,videoId来于分析AnalysisMain,融合页面来之融合"); console.log("订阅成功1-fromName", fromName); console.log("订阅成功1-number", number); client.publish('msg_stream', JSON.stringify({ "msg_flag": parseInt(number) })) - // if(number!= -1 &&number!= '001' ){ - // client.publish('Custom',JSON.stringify({"type":'getImage',"videoid":videoid})) - // } - } else { console.log('消息订阅失败!') } @@ -187,6 +181,7 @@ window.PubScribe = function (topic, number, _callback, other = false, fromName = } } } + window.publish = function (topic, message) { if (mqtt.mqttClient.connected == true) { // console.log("topic",topic) diff --git a/src/views/index.vue b/src/views/index.vue index b5092ad..8c46440 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -951,18 +951,11 @@ export default { this.videoAnalysisShow = false; this.trafficAnalysisShow = false; this.createMqtt(); - // document.getElementById('mapModule').contentWindow.lixianVideo(JSON.stringify(this.analysis)); } else if (this.$route.query.type == '离线视频') { this.videoAnalysisShow = true; this.trafficAnalysisShow = true; this.getAnalysisStatus(); this.createMqtt(); - // if(this.$route.query.status=='未分析'){ - // } - // if(this.$route.query.status=='未分析'){ - // // document.getElementById('mapModule').contentWindow.lixianVideo("实时视频"); - // }else{ - // } } }, mounted() { @@ -1068,19 +1061,21 @@ export default { }, // 数据看板的标签点击 handleClick: function (tab, event) { - if (tab._props.name == 'second') { + // console.log(tab) + if (tab.name == 'first') { + if (this.$route.query.type == '实时视频') { + //实时视频页面需要订阅的主题 + this.videoTopicSends(); + } + } else if (tab.name == 'second') { this.$nextTick(() => { if (this.$route.query.type == '离线视频') { this.$refs.dataBoardRef.getNew(this.getHistory); } else { + //数据看板需要订阅的主题 + this.dataBoardTopicSends(); this.$refs.dataBoardRef.getNew(); } - // this.$refs.dataBoardRef.getNew(this.getHistory); - // setTimeout(() => { - // debugger - // this.getHistory() - // }, 10000); - // this.getHistory(); }); } }, @@ -1116,38 +1111,65 @@ export default { // this.getHistory(); // }, 5000); } else if (this.$route.query.type == '实时视频') { - this.topicSends = [ - 'stream' + this.number, - 'trajectory' + this.number, - 'detection' + this.number, - 'trigger-' + this.$route.query.id, - 'cycle_time-' + this.$route.query.id, - 'cycle_statistics-' + this.$route.query.id, - 'cycle_accumulate-' + this.$route.query.id, - 'TargetAnalysisStatusData', - 'TrafficAnalysisStatusData', - 'img' + this.number - // 'hert', - // 'img0', - // 'img1', - // 'img2', - // 'img3', - // 'img4', - // 'img5', - // 'img6', - // 'img7', - // 'Contorl_server' - //目标数量 - // 'simulator_target-' + this.$route.query.id - ]; - // console.log('在test1/index视频页面number-',this.number) - window.PubScribe(this.topicSends, this.number, this.realInfo, false, this.$route.query.id); + // this.topicSends = [ + // 'stream' + this.number, + // 'trajectory' + this.number, + // 'detection' + this.number, + // 'trigger-' + this.$route.query.id, + // 'cycle_time-' + this.$route.query.id, + // 'cycle_statistics-' + this.$route.query.id, + // 'cycle_accumulate-' + this.$route.query.id, + // 'TargetAnalysisStatusData', + // 'TrafficAnalysisStatusData', + // 'img' + this.number + // // 'hert', + // // 'img0', + // // 'img1', + // // 'img2', + // // 'img3', + // // 'img4', + // // 'img5', + // // 'img6', + // // 'img7', + // // 'Contorl_server' + // //目标数量 + // // 'simulator_target-' + this.$route.query.id + // ]; + // // console.log('在test1/index视频页面number-',this.number) + // window.PubScribe(this.topicSends, this.number, this.realInfo, false, this.$route.query.id); + //视频页面需要订阅的主题有 img,stream,trajectory,detection,TargetAnalysisStatusDataTraffic,AnalysisStatusData + //数据看板需要订阅的主题有 trigger,cycle_time,,cycle_statistics,cycle_accumulate + this.videoTopicSends(); } this.timer2 = null; this.timer2 = setTimeout(() => { window.publish('Custom', JSON.stringify({ type: 'getImage', videoid: this.$route.query.id })); }, 5000); }, + //实时视频页面需要订阅的主题 + videoTopicSends() { + this.topicSends = [ + 'stream' + this.number, + 'trajectory' + this.number, + 'detection' + this.number, + 'TargetAnalysisStatusData', + 'TrafficAnalysisStatusData', + 'img' + this.number + ]; + // console.log('在test1/index视频页面number-',this.number) + window.PubScribe(this.topicSends, this.number, this.realInfo, false, this.$route.query.id); + }, + //数据看板需要订阅的主题 + dataBoardTopicSends() { + this.topicSends = [ + 'trigger-' + this.$route.query.id, + 'cycle_time-' + this.$route.query.id, + 'cycle_statistics-' + this.$route.query.id, + 'cycle_accumulate-' + this.$route.query.id + ]; + // console.log('在test1/index视频页面number-',this.number) + window.PubScribe(this.topicSends, this.number, this.realInfo, false, this.$route.query.id); + }, //获取视频分析,交通分析状态数据 getAnalysisStatus() { getVideoStatus(this.$route.query.id).then((res) => {