From 50b9a87a2dd15445dbc3966510a9da04707fd8ac Mon Sep 17 00:00:00 2001
From: air <30444667+sszdot@users.noreply.github.com>
Date: Wed, 21 May 2025 16:19:35 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=20=20=E5=9E=8B=E3=80=91?=
=?UTF-8?q?=EF=BC=9Afeat=20=E3=80=90=E5=8E=9F=20=20=E5=9B=A0=E3=80=91?=
=?UTF-8?q?=EF=BC=9A=E5=96=8A=E8=AF=9D=E6=A8=A1=E5=9D=97=20=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E6=8E=A7=E5=88=B6=E9=9F=B3=E9=87=8F=E7=9A=84=E7=A9=BA?=
=?UTF-8?q?=E9=97=B4=20=E3=80=90=E8=BF=87=20=20=E7=A8=8B=E3=80=91=EF=BC=9A?=
=?UTF-8?q?=E9=9F=B3=E9=87=8F=E6=8E=A7=E4=BB=B6=E6=8E=A7=E5=88=B6=E5=A3=B0?=
=?UTF-8?q?=E9=9F=B31-9=20=209=E5=A3=B0=E9=9F=B3=E6=9C=80=E5=A4=A7=20?=
=?UTF-8?q?=E3=80=90=E5=BD=B1=20=20=E5=93=8D=E3=80=91=EF=BC=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/ControllerTabs.vue | 67 +++++++++++++++++--
.../layout/components/main/planes/index.vue | 2 +-
2 files changed, 64 insertions(+), 5 deletions(-)
diff --git a/src/components/ControllerTabs.vue b/src/components/ControllerTabs.vue
index f80de64..bc14c75 100644
--- a/src/components/ControllerTabs.vue
+++ b/src/components/ControllerTabs.vue
@@ -84,6 +84,23 @@
@click="publishFun('{initAcce:2}')" type="primary">已摆好
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -91,7 +108,7 @@
@@ -232,7 +249,7 @@
+ @click="publishFun('{hookConteroller:4}'); pesoIsZero(); speakText('重置重量传感器')">
归零
@@ -285,7 +302,8 @@
喇叭控制
-
+
喊话
@@ -358,7 +376,9 @@ export default {
},
waringTags: [], // 任务栏 提示标签 有退款 超重 等
paramItem: '', // 参数 键
- paramValue: ''// 参数 值
+ paramValue: '', // 参数 值
+ talkValue: '', // 喊话参数
+ talkVolume: 9// 喊话音量
}
},
props: {
@@ -559,6 +579,45 @@ export default {
this.$message.warning('与飞机通信未接通,请稍后')
}
},
+ /**
+ * @description: 控制飞机上的喇叭播放语音
+ * @param {*} val 播放文本
+ * @param {*} vol 播放音量 默认音量为1声音最小 范围1-9
+ */
+ playText (val, vol = 1) {
+ const jsonData = {
+ playText: {
+ val: val,
+ vol: parseInt(vol)
+ }
+ }
+ this.publishFun(JSON.stringify(jsonData))
+ },
+ /**
+ * @description: 监听重量传感器是否归零,8秒内 loadweight 进入±60 范围则语音播报
+ */
+ pesoIsZero () {
+ const timeout = 8000 // 最大监听时间 8 秒
+ const interval = 200 // 轮询间隔 200ms
+ const threshold = 60 // 正负60以内
+ let elapsed = 0
+
+ const checkInterval = setInterval(() => {
+ if (!this.plane || !this.plane.planeState) return
+
+ const weight = Number(this.plane.planeState.loadweight)
+ if (Math.abs(weight) <= threshold) {
+ this.playText('重量传感器已归零')
+ this.speakText('重量传感器已归零')
+ clearInterval(checkInterval) // 停止监听
+ }
+
+ elapsed += interval
+ if (elapsed >= timeout) {
+ clearInterval(checkInterval) // 超时后停止监听
+ }
+ }, interval)
+ },
/**
* @description: 执行任务前 先检测订单是否合法,例如:订单重量会不会超出飞机载重上限
*/
diff --git a/src/views/layout/components/main/planes/index.vue b/src/views/layout/components/main/planes/index.vue
index 67a73f2..9236f44 100644
--- a/src/views/layout/components/main/planes/index.vue
+++ b/src/views/layout/components/main/planes/index.vue
@@ -98,7 +98,7 @@ export default {
// 地图长按事件 记录地图经纬度
handleLongPress (lonLat) {
this.isReserveGuidedMaker = false
- this.dialogTitle = '点飞'
+ this.dialogTitle = '指点飞行'
this.dialogVisible = true
this.dialogItem = 'guidedBox'
this.guidedLonLat = lonLat // 设置点击的经纬度