Просмотр исходного кода

mqtt传参防呆取消
监控播放样式微调

dedsudiyu недель назад: 2
Родитель
Сommit
0e7eb62242
3 измененных файлов с 30 добавлено и 32 удалено
  1. 3 8
      src/App.vue
  2. 23 24
      src/components/alarmWindow/AlertModal.vue
  3. 4 0
      src/components/mpegtsVideo/mpegtsVideo.vue

+ 3 - 8
src/App.vue

@@ -109,15 +109,10 @@ export default {
       })
 
       this.mqttClient.on('message', async (topic, message) => {
-        try {
-          const payload = JSON.parse(message.toString())
-          if (payload) {
-            this.getTriggerInfo();
-          }
-        } catch (e) {
-          console.error('MQTT消息处理失败:', e)
+        if(message){
+          this.getTriggerInfo();
         }
-      })
+      });
 
       this.mqttClient.on('error', (err) => {
         console.error('MQTT连接错误:', err)

+ 23 - 24
src/components/alarmWindow/AlertModal.vue

@@ -57,7 +57,7 @@
               <!--</div>-->
               <!--<H5PlayerVideo style="margin:10px 0 0 12px;" v-if="videoData" :videoProps="videoData"></H5PlayerVideo>-->
               <p v-if="!videoData" style="line-height:210px;text-align: center;color:#fff;font-size:16px;">该实验室无监控</p>
-              <mpegts-video style="display: inline-block" :videoProps="videoData"></mpegts-video>
+              <mpegts-video v-if="videoData" style="display: inline-block" :videoProps="videoData"></mpegts-video>
             </div>
           </div>
         </div>
@@ -164,29 +164,28 @@ export default {
       this.$emit('close')
     },
     async getVideoList(data) {
-      try {
-        let obj = {
-          page:'1',
-          pageSize:'1',
-          buildId:'',
-          floorId:'',
-          passageway:'',
-          subIds:[data.subId],
-          protocol:window.location.href.indexOf('https') !== -1?'wss':'ws',
-          streamType:1,
-          source:1,
-        }
-        const res = await getVideoList(obj)
-        if(res.data.list[0]){
-          this.$set(this,'videoData',{
-            width: 400, //(宽度:非必传-默认600)
-            height: 210, //(高度:非必传-默认338)
-            url: res.data.records[0].streamUrl,
-            cameraIndexCode: res.data.records[0].deviceNo,
-          });
-        }
-      } catch (e) {
-        console.error('AlertModal:', e)
+      console.log('data',data);
+      let self = this;
+      let obj = {
+        page:'1',
+        pageSize:'1',
+        buildId:'',
+        floorId:'',
+        passageway:'',
+        subIds:[data.subId],
+        protocol:window.location.href.indexOf('https') !== -1?'wss':'ws',
+        streamType:1,
+        source:1,
+      }
+      const res = await getVideoList(obj)
+      if(res.data.records[0]){
+        console.log('res',res);
+        self.$set(self,'videoData',{
+          width: 400, //(宽度:非必传-默认600)
+          height: 210, //(高度:非必传-默认338)
+          url: res.data.records[0].streamUrl,
+          cameraIndexCode: res.data.records[0].deviceNo,
+        });
       }
     },
     //全屏开启

+ 4 - 0
src/components/mpegtsVideo/mpegtsVideo.vue

@@ -192,6 +192,10 @@
   }
 </script>
 <style scoped lang="scss">
+  .mpegtsVideo ::-webkit-scrollbar {
+    width: 4px;
+    height: 0;
+  }
   .mpegtsVideo{
     *{
       margin:0;