From a7e6761ba0cfccdf33ed552eb2d3b783c8e4ab4a Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 16 Apr 2025 20:49:12 +0800
Subject: [PATCH] feat:事件弹窗显示调整

---
 src/views/SignMachineNest/MachineRight/MachineMonitor.vue |   39 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/src/views/SignMachineNest/MachineRight/MachineMonitor.vue b/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
index 5c8d29e..a0b30b8 100644
--- a/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
+++ b/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
@@ -1,6 +1,6 @@
 <!-- 机巢监控 -->
 <template>
-  <CommonTitle title="机巢监控" />
+  <CommonTitle title="直播监控" />
   <div :style="{ marginLeft: pxToRem(14) }">
     <div class="machine-monitor">
       <LiveVideo :videoUrl="airPortUrl" />
@@ -22,14 +22,43 @@
 // 直播地址
 let airPortUrl = ref('');
 // 获取直播地址
-const getVideoUrl = () => {
-  liveStart(singleUavHome.value.device_sn).then(res => {
+const getVideoUrl = (sn,quality) => {
+  liveStart(sn, quality).then(res => {
     if (res.data.code !== 0) return;
     airPortUrl.value = res.data.data.rtcs_url;
   });
 };
+let isCurrentSn = ref(false);
+let CurrentSn = ref('');
+// 监听ws消息
+watch(
+  () => store.state.home.deviceState.deviceInfo,
+  (newValue) => {
+    CurrentSn.value = Object.keys(newValue)[0];
+    const currentDevice = newValue[CurrentSn.value];
+    if (currentDevice && currentDevice?.mode_code > 0) {
+      isCurrentSn.value = true;
+    } else if (currentDevice && currentDevice?.mode_code === 14) {
+      isCurrentSn.value = false;
+    } else {
+      isCurrentSn.value = false;
+    }
+  },
+  {
+    immediate: true,
+    deep: true,
+  }
+);
+// 监听 isCurrentSn
+watch(isCurrentSn, (newVal) => {
+  if (newVal) {
+    getVideoUrl(CurrentSn.value, 2);
+  } else {
+    getVideoUrl(singleUavHome.value.device_sn,1);
+  }
+}, { immediate: true,deep: true });
 onMounted(() => {
-  getVideoUrl();
+  getVideoUrl(singleUavHome.value.device_sn,1);
 });
 </script>
 
@@ -49,4 +78,4 @@
     justify-content: space-between;
     padding: 12px 10px 0;
  }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.3