视频订阅主题和数据看板主题区分开调用,解决图片主题会有延迟问题

This commit is contained in:
qiudan 2023-12-15 10:57:53 +08:00
parent 23d8e88274
commit 0445b6a18f
2 changed files with 63 additions and 46 deletions

View File

@ -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)

View File

@ -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/indexnumber-',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/indexnumber-',this.number)
// window.PubScribe(this.topicSends, this.number, this.realInfo, false, this.$route.query.id);
// imgstreamtrajectorydetectionTargetAnalysisStatusDataTrafficAnalysisStatusData
// triggercycle_timecycle_statisticscycle_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/indexnumber-',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/indexnumber-',this.number)
window.PubScribe(this.topicSends, this.number, this.realInfo, false, this.$route.query.id);
},
//
getAnalysisStatus() {
getVideoStatus(this.$route.query.id).then((res) => {