From 2a45e8331f65e4fc6dee2fba898bfbeaa01b0f5c Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 21 Apr 2025 16:34:15 +0800
Subject: [PATCH] Merge branch 'test' of http://139.196.74.78:10010/r/drone/command-center-dashboard into test

---
 src/views/SignMachineNest/MachineRight/MachineMonitor.vue |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/views/SignMachineNest/MachineRight/MachineMonitor.vue b/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
index 27fdf5e..835382e 100644
--- a/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
+++ b/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
@@ -15,13 +15,17 @@
 import CommonTitle from '@/components/CommonTitle.vue'
 import LiveVideo from '@/components/LiveVideo.vue'
 import { liveStart } from '@/api/home/machineNest'
-// import { CURRENT_CONFIG as config } from '@/utils/http/config'
 import { useStore } from 'vuex'
 
 const store = useStore()
 // 单个机巢信息
 const singleUavHome = computed(() => store.state.home.singleUavHome);
-const osdVisible = computed(() => store.state.home.osdVisible);
+const wsInfo = inject('wsInfo')
+let device_osd_info = computed(() => wsInfo.value?.device_osd || {});
+let device_osd_host = computed(() => device_osd_info?.value?.data?.host || {});
+
+const dockSn = inject('dockSn')
+const droneSn = inject('droneSn')
 // 直播地址
 let airPortUrl = ref('')
 // 获取机巢直播地址
@@ -43,14 +47,13 @@
 
 const isTakeOff = ref(false)
 // 监听ws消息
-watch(() => store.state.home.deviceState, async (newValue) => {
-		const deviceInfo = newValue?.deviceInfo[osdVisible.value.sn]
-		if (!deviceInfo) return
-		const currentIsTakeOff = ![14, 0].includes(deviceInfo?.mode_code)
+watch(device_osd_host, async () => {
+		if (device_osd_host?.value?.mode_code === undefined) return
+	  const currentIsTakeOff = ![14, 0].includes(device_osd_host.value?.mode_code)
 		// 如果还是之前的状态,不切换
 		if (isTakeOff.value === currentIsTakeOff) return
 		isTakeOff.value = currentIsTakeOff
-		isTakeOff.value ? await getDroneLiveUrl(osdVisible.value.sn, 2) : await getVideoUrl(singleUavHome.value.device_sn, 1)
+		isTakeOff.value ? await getDroneLiveUrl(droneSn.value, 2) : await getVideoUrl(dockSn.value, 1)
 	},
 	{
 		immediate: true,
@@ -59,7 +62,7 @@
 )
 
 onMounted(() => {
-	getVideoUrl(singleUavHome.value.device_sn, 1)
+	getVideoUrl(dockSn.value, 2)
 })
 onUnmounted(() => {
 	airPortUrl.value = ''

--
Gitblit v1.9.3