From 0be474833723f98d3347880c874e939b55f920ed Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Sat, 19 Apr 2025 16:36:40 +0800
Subject: [PATCH] feat: 修复智引即飞和多在线无人机直播
---
src/views/SignMachineNest/MachineRight/MachineMonitor.vue | 74 ++++++++++++++++--------------------
src/store/modules/home.js | 1
src/assets/images/offLine.png | 0
src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue | 3 +
src/views/SignMachineNest/SignMachineNest.vue | 1
src/views/SignMachineNest/MachineLeft/InspectionRaskDetails.vue | 4 +
6 files changed, 40 insertions(+), 43 deletions(-)
diff --git a/src/assets/images/offLine.png b/src/assets/images/offLine.png
new file mode 100644
index 0000000..fbc31ef
--- /dev/null
+++ b/src/assets/images/offLine.png
Binary files differ
diff --git a/src/store/modules/home.js b/src/store/modules/home.js
index f4b0ca8..4012aeb 100644
--- a/src/store/modules/home.js
+++ b/src/store/modules/home.js
@@ -77,6 +77,7 @@
window.localStorage.setItem('bs_workspace_id', id)
},
setOsdVisibleInfo: (state, info) => {
+ console.log('存储',info)
state.osdVisible = Object.assign({}, info)
window.localStorage.setItem('bs_osd', JSON.stringify(info))
},
diff --git a/src/views/SignMachineNest/MachineLeft/InspectionRaskDetails.vue b/src/views/SignMachineNest/MachineLeft/InspectionRaskDetails.vue
index 2c24401..32aa725 100644
--- a/src/views/SignMachineNest/MachineLeft/InspectionRaskDetails.vue
+++ b/src/views/SignMachineNest/MachineLeft/InspectionRaskDetails.vue
@@ -155,7 +155,9 @@
label: {
show: true,
position: 'inside',
- formatter: '{c}%',
+ formatter: function(params) {
+ return params.value > 0 ? params.value : ''
+ },
fontSize: 12,
color: '#fff',
},
diff --git a/src/views/SignMachineNest/MachineRight/MachineMonitor.vue b/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
index 8f44c2f..993dfd4 100644
--- a/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
+++ b/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
@@ -1,19 +1,12 @@
-<!--
- * @Author: shuishen 1109946754@qq.com
- * @Date: 2025-04-15 17:19:35
- * @LastEditors: shuishen 1109946754@qq.com
- * @LastEditTime: 2025-04-17 21:16:50
- * @FilePath: \command-center-dashboard\src\views\SignMachineNest\MachineRight\MachineMonitor.vue
- * @Description:
- *
- * Copyright (c) 2025 by shuishen, All Rights Reserved.
--->
-<!-- 机巢监控 -->
+<!-- 直播监控 -->
<template>
<CommonTitle title="直播监控" />
<div :style="{ marginLeft: pxToRem(14) }">
<div class="machine-monitor">
- <LiveVideo :videoUrl="airPortUrl" />
+ <div v-if="singleUavHome.status === 'OFFLINE'" class="off-line">
+ <span>当前设备已关机,无法进行直播</span>
+ </div>
+ <LiveVideo v-else :videoUrl="airPortUrl" />
</div>
</div>
</template>
@@ -27,52 +20,38 @@
const store = useStore()
// 单个机巢信息
-const singleUavHome = computed(() => store.state.home.singleUavHome)
+const singleUavHome = computed(() => store.state.home.singleUavHome);
+const osdVisible = computed(() => store.state.home.osdVisible);
// 直播地址
let airPortUrl = ref('')
// 获取直播地址
const getVideoUrl = (sn, quality) => {
+ if (singleUavHome.value.status === 'OFFLINE') return;
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('')
+
+const isTakeOff = ref(false)
// 监听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
- }
+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)
+ // 如果还是之前的状态,不切换
+ if (isTakeOff.value === currentIsTakeOff) return
+ isTakeOff.value = currentIsTakeOff
+ isTakeOff.value ? await getVideoUrl(osdVisible.value.sn, 2) : await getVideoUrl(singleUavHome.value.device_sn, 1)
},
{
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(singleUavHome.value.device_sn,1);
+ getVideoUrl(singleUavHome.value.device_sn, 1)
})
</script>
@@ -82,9 +61,22 @@
height: 228px;
background: linear-gradient(270deg, #1f3e7a 0%, rgba(31, 62, 122, 0.35) 79%, rgba(31, 62, 122, 0) 100%);
opacity: 0.85;
- // margin: 2px 0 13 0;
display: flex;
justify-content: space-between;
padding: 10px 10px;
+ .off-line {
+ position: relative;
+ width: 100%;
+ height: 100%;
+ background: url(@/assets/images/offLine.png) no-repeat center / 100% 100%;
+ color: #EDEDED;
+ font-size: 16px;
+ span {
+ position: absolute;
+ text-align: center;
+ bottom: 20px;
+ left: 20%;
+ }
+ }
}
</style>
diff --git a/src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue b/src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue
index 7cd955b..3f40360 100644
--- a/src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue
+++ b/src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue
@@ -7,7 +7,7 @@
<img src="../../../../assets/images/signMachineNest/machineRight/wrj.png" alt="">
<div class="info-right">
<!-- <div class="name">{{ osdVisible?.callsign || '--' }}</div> -->
- <div class="name">{{ singleUavHome?.nickname || '--' }}</div>
+ <div class="name">{{ osdVisible?.nickname || '--' }}</div>
<div class="wz">
<span class="left">当前位置:</span>
<span class="right">{{ detailInfo.longitude }},{{ detailInfo.latitude }}</span>
@@ -172,6 +172,7 @@
);
// 获取最新机场状态
watch(store.state.home.deviceState, (newValue) => {
+ // console.log('newValue', newValue);
if (newValue.currentType === EDeviceTypeName.Dock && newValue?.dockInfo[newValue.currentSn]) {
// 机场状态
mode_code.value = EDockModeText[newValue?.dockInfo[newValue.currentSn]?.basic_osd?.mode_code];
diff --git a/src/views/SignMachineNest/SignMachineNest.vue b/src/views/SignMachineNest/SignMachineNest.vue
index e87d72d..3e2828f 100644
--- a/src/views/SignMachineNest/SignMachineNest.vue
+++ b/src/views/SignMachineNest/SignMachineNest.vue
@@ -74,6 +74,7 @@
const child = result.children
// 对应store 里面数据结构
+ osdVisible.value.nickname = result.nickname || '--'
osdVisible.value.sn = child?.device_sn || ''
osdVisible.value.callsign = child?.nickname || '--'
osdVisible.value.model = EModeCode.Disconnected || ''
--
Gitblit v1.9.3