【类 型】:feat
【原 因】:喊话模块 添加控制音量的空间 【过 程】:音量控件控制声音1-9 9声音最大 【影 响】:
This commit is contained in:
parent
f80031cea8
commit
50b9a87a2d
@ -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: 执行任务前 先检测订单是否合法,例如:订单重量会不会超出飞机载重上限
|
||||
*/
|
||||
|
@ -98,7 +98,7 @@ export default {
|
||||
// 地图长按事件 记录地图经纬度
|
||||
handleLongPress (lonLat) {
|
||||
this.isReserveGuidedMaker = false
|
||||
this.dialogTitle = '点飞'
|
||||
this.dialogTitle = '指点飞行'
|
||||
this.dialogVisible = true
|
||||
this.dialogItem = 'guidedBox'
|
||||
this.guidedLonLat = lonLat // 设置点击的经纬度
|
||||
|
Loading…
Reference in New Issue
Block a user