【类 型】:feat

【原  因】:喊话模块 添加控制音量的空间
【过  程】:音量控件控制声音1-9  9声音最大
【影  响】:
This commit is contained in:
air 2025-05-21 16:19:35 +08:00
parent f80031cea8
commit 50b9a87a2d
2 changed files with 64 additions and 5 deletions

View File

@ -84,6 +84,23 @@
@click="publishFun('{initAcce:2}')" type="primary">已摆好</el-button>
</span>
</template>
<!-- 喊话参数 -->
<template v-else-if="dialogItem === 'talkBox'">
<el-form label-position="left">
<el-form-item label="喊话内容" label-width="80px">
<el-input v-model="talkValue" type="textarea" :autosize="{ minRows: 2, maxRows: 4 }"
placeholder="请输入喊话内容"></el-input>
</el-form-item>
<el-form-item label="音量设置" label-width="80px">
<el-slider class="w-90" v-model="talkVolume" :show-tooltip="false" :min="1" :max="9">
</el-slider>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button size="medium" @click="dialogVisible = false">关闭</el-button>
<el-button size="medium" type="primary" @click="playText(talkValue, talkVolume);">发送</el-button>
</span>
</template>
<!-- 读写参数 -->
<template v-else-if="dialogItem === 'paramBox'">
<el-input v-model="paramItem" placeholder="参数名"></el-input>
@ -91,7 +108,7 @@
<span slot="footer" class="dialog-footer">
<el-button size="medium" @click="dialogVisible = false">关闭</el-button>
<el-button size="medium" type="primary"
@click="paramValue = '';clearPlanePar(); publishFun(`{'getParam':'${paramItem}'}`);">读取</el-button>
@click="paramValue = ''; clearPlanePar(); publishFun(`{'getParam':'${paramItem}'}`);">读取</el-button>
<el-button size="medium" type="primary"
@click="publishFun(`{'setParam':{'item':'${paramItem}','value':'${paramValue}'}}`)">写入</el-button>
</span>
@ -232,7 +249,7 @@
</div>
<div class="butIconBox m-b-15 gap10 flex">
<el-button size="medium" type="primary" class="flex1 butIcon"
@click="publishFun('{hookConteroller:4}'); speakText('重置重量传感器')">
@click="publishFun('{hookConteroller:4}'); pesoIsZero(); speakText('重置重量传感器')">
<i class="iconfont icon-zhongliang f-s-24"></i>
<div class="m-t-5">归零</div>
</el-button>
@ -285,7 +302,8 @@
<span>喇叭控制</span>
</div>
<div class="butIconBox gap10 flex">
<el-button size="medium" type="primary" class="flex1 butIcon">
<el-button size="medium" type="primary" class="flex1 butIcon"
@click="dialogVisible = true; dialogTitle = '喊话参数'; dialogItem = 'talkBox';">
<i class="iconfont icon-icon-test f-s-24"></i>
<div class="m-t-5">喊话</div>
</el-button>
@ -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: 执行任务前 先检测订单是否合法例如订单重量会不会超出飞机载重上限
*/

View File

@ -98,7 +98,7 @@ export default {
//
handleLongPress (lonLat) {
this.isReserveGuidedMaker = false
this.dialogTitle = '点飞'
this.dialogTitle = '点飞'
this.dialogVisible = true
this.dialogItem = 'guidedBox'
this.guidedLonLat = lonLat //