From b6ce2dbe2530c13a9afa993793004217d8033b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=AE=E5=BE=AE=E4=B8=80=E7=AC=91?= <709648985@qq.com> Date: Fri, 27 Mar 2026 18:07:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96100J=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/100J/HBY100-J.js | 12 +++++++++--- pages/100J/HBY100-J.vue | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/api/100J/HBY100-J.js b/api/100J/HBY100-J.js index 37eb207..f470974 100644 --- a/api/100J/HBY100-J.js +++ b/api/100J/HBY100-J.js @@ -1200,21 +1200,27 @@ export function deviceUpdateVolume(data) { ); } -/** 蓝牙侧语音播报:自定义音(mode=7)部分固件需先 0x0C 带模式再 0x06,否则无声音 */ +/** 蓝牙侧语音播报:自定义音(mode=7)且强制报警仍开时,需先 0x0C 关报警+模式7 再 0x06;已解除则不必重复下发 0x0C */ function bleVoiceBroadcastChain(data) { const on = Number(data.voiceBroadcast) === 1; const mode = data.mode != null ? String(data.mode) : ''; if (on && mode === '7') { - return protocolInstance.setForceAlarm(0, 7).then(() => protocolInstance.setVoiceBroadcast(1)); + const alarmOn = Number(data.voiceStrobeAlarm) === 1; + if (alarmOn) { + return protocolInstance.setForceAlarm(0, 7).then(() => protocolInstance.setVoiceBroadcast(1)); + } + return protocolInstance.setVoiceBroadcast(1); } return protocolInstance.setVoiceBroadcast(on ? 1 : 0); } // 语音播放(HTTP 透传 data,便于后端识别 mode) export function deviceVoiceBroadcast(data) { + const httpData = data && typeof data === 'object' ? { ...data } : data; + if (httpData && typeof httpData === 'object') delete httpData.voiceStrobeAlarm; return execWithBleFirst( () => bleVoiceBroadcastChain(data).then(() => ({ code: 200, msg: '操作成功(蓝牙)' })), - () => request({ url: `/app/hby100j/device/voiceBroadcast`, method: 'post', data }), + () => request({ url: `/app/hby100j/device/voiceBroadcast`, method: 'post', data: httpData }), '语音播报' ); } \ No newline at end of file diff --git a/pages/100J/HBY100-J.vue b/pages/100J/HBY100-J.vue index d57d905..6197ce3 100644 --- a/pages/100J/HBY100-J.vue +++ b/pages/100J/HBY100-J.vue @@ -1065,7 +1065,8 @@ const data = { deviceId: this.deviceInfo.deviceId, voiceBroadcast: Number(this.formData.sta_VoiceType) === -1 ? 0 : 1, - mode: this.formData.sta_VoiceType + mode: this.formData.sta_VoiceType, + voiceStrobeAlarm: this.deviceInfo.voiceStrobeAlarm }; deviceVoiceBroadcast(data).then((res) => { if (res.code == 200) { @@ -1090,7 +1091,8 @@ const data = { deviceId: this.deviceInfo.deviceId, voiceBroadcast: 0, - mode: val + mode: val, + voiceStrobeAlarm: this.deviceInfo.voiceStrobeAlarm }; deviceVoiceBroadcast(data).then((res) => { if (res.code == 200) { @@ -1118,6 +1120,15 @@ console.log(this.deviceInfo, '44444'); console.log(item, 'tent'); const isClose = item === 0; + // 与「已解除不再重复关报警」对称:已在报警中不再弹窗重复下发「开启」,未报警时不再重复「解除」 + if (!isClose && this.deviceInfo.voiceStrobeAlarm === 1) { + uni.showToast({ title: '当前已在报警中', icon: 'none' }); + return; + } + if (isClose && this.deviceInfo.voiceStrobeAlarm !== 1) { + uni.showToast({ title: '当前未在报警中', icon: 'none' }); + return; + } if (!this.Status) this.Status = {}; if (!this.Status.Pop) this.Status.Pop = { showPop: false