From 243e0266d7bd1dad2224fefd9a1d3ef8ced6345e Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Sat, 19 Apr 2025 13:33:59 +0800
Subject: [PATCH] feat: 优化返航按钮
---
src/components/CurrentTaskDetails/CurrentTaskDetails.vue | 36 ++++++++++++++++++++----------------
1 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/src/components/CurrentTaskDetails/CurrentTaskDetails.vue b/src/components/CurrentTaskDetails/CurrentTaskDetails.vue
index be5398b..c6ae4c4 100644
--- a/src/components/CurrentTaskDetails/CurrentTaskDetails.vue
+++ b/src/components/CurrentTaskDetails/CurrentTaskDetails.vue
@@ -58,35 +58,36 @@
const trueAltitude = ref('') // 真实高度
const isAiLive = ref(false) // 是ai直播
const video_id = ref('') // 直播视频id
-
const isShow = defineModel('show') // 是否显示当前任务详情
const props = defineProps(['id'])
const currentLiveUrl = ref('') // 当前直播地址
const isTakeOff = ref(false) // 是在飞行中
const isMaxMap = ref(false) //是大地图
-
+const client_id = ref('') //是大地图
const workspace_id = ref('')
-let wsInfo = useDroneWS(workspace_id) //ws信息,是一个ref对象
-watch(wsInfo, () => {
- // wsInfo 变化触发
- setCurrentLiveUrl()
-}, { deep: true })
+let { wsInfo, removeWS } = useDroneWS(workspace_id) //ws信息,是一个ref对象
provide('wsInfo', wsInfo)
-
-
-provide('isAutoControl', isAutoControl)
-provide('lineQuality', lineQuality)
-provide('taskDetailsViewer', taskDetailsViewer)
-provide('taskDetails', taskDetails)
provide('deviceOsdInfo', deviceOsdInfo)
provide('dockOsdInfo', wsInfo?.value?.dock_osd)
provide('dockSn', dockSn)
provide('droneSn', droneSn)
+provide('isAutoControl', isAutoControl)
+provide('lineQuality', lineQuality)
+provide('taskDetailsViewer', taskDetailsViewer)
+provide('taskDetails', taskDetails)
provide('trueAltitude', trueAltitude)
provide('isAiLive', isAiLive)
provide('video_id', video_id)
+provide('client_id', client_id)
-
+watch(
+ wsInfo,
+ () => {
+ // wsInfo 变化触发
+ setCurrentLiveUrl()
+ },
+ { deep: true }
+)
// 获取机巢直播
const getDeviceLiveUrl = async () => {
@@ -105,11 +106,14 @@
}
// 获取无人机直播url
-async function getDroneLiveUrl() {
+async function getDroneLiveUrl(reset = false) {
+ currentLiveUrl.value = ''
+ await nextTick()
const res = await liveStart(droneSn.value, lineQuality.value)
currentLiveUrl.value = res.data.data.rtcs_url
video_id.value = res.data.data.video_id
isAiLive.value = false
+ reset && ElMessage.success('刷新成功')
}
// 无人机直播画质切换
@@ -121,7 +125,7 @@
// 设置当前直播地址
const setCurrentLiveUrl = async () => {
const deviceInfo = deviceOsdInfo.value?.data?.host
- if (!deviceInfo) return
+ if (!deviceInfo) return
const currentIsTakeOff = ![14, 0].includes(deviceInfo?.mode_code)
// 如果还是之前的状态,不切换
if (isTakeOff.value === currentIsTakeOff) return
--
Gitblit v1.9.3