From ab19f14f05298a8ebad565d4324fb721f8674ff7 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 11:14:43 +0800 Subject: [PATCH] =?UTF-8?q?100j=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/100J/HBY100-J.vue | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/pages/100J/HBY100-J.vue b/pages/100J/HBY100-J.vue index dc2514b..2b47e37 100644 --- a/pages/100J/HBY100-J.vue +++ b/pages/100J/HBY100-J.vue @@ -1028,18 +1028,18 @@ item = this.dic.sta_VoiceType[index]; } let val = item.key; + const prevVoiceType = this.formData.sta_VoiceType; if (this.formData.sta_VoiceType === val) { val = '-1'; } this.formData.sta_VoiceType = val; - // 模式类型为7时才去判断 console.log(val, 'valllll'); - const isVoiceOperate = val === '7' || val === '-1'; // 标记是否是语音开启/关闭操作 - if (this.deviceInfo.voiceStrobeAlarm == 1) { - // 如果强制报警已经开启了,那么切换下面的模式需要时,需要触发报警指令 + // 仅「播放语音」7 的开关走播报接口;-1 只有从 7 取消时才视为关播报,避免取消内置音色选中误调播报接口 + const isVoiceOperate = val === '7' || (val === '-1' && prevVoiceType === '7'); + if (this.deviceInfo.voiceStrobeAlarm === 1) { + // 强制报警已开启:切换下方模式需带报警下发 const data = { deviceIds: [this.deviceInfo.deviceId], - // 声光报警开关开启传1 voiceStrobeAlarm: 1, mode: this.formData.sta_VoiceType }; @@ -1055,7 +1055,7 @@ icon: 'none' }); } - }) + }); } else if (isVoiceOperate) { const data = { deviceId: this.deviceInfo.deviceId, @@ -1077,15 +1077,15 @@ }).catch(() => { uni.showToast({ title: '下发失败,请检查蓝牙或网络', icon: 'none' }); }); - } else { - // 非强制报警态下选择内置音色:原先仅改 UI 未下发,设备无播报 + } else if (prevVoiceType === '7' && val !== '7' && val !== '-1') { + // 从「播放语音」切到其它内置音色:先关播报;报警未开启时不走 forceAlarm,仅 UI 预选音色 const data = { - deviceIds: [this.deviceInfo.deviceId], - voiceStrobeAlarm: 0, + deviceId: this.deviceInfo.deviceId, + voiceBroadcast: 0, mode: val }; - deviceForceAlarmActivation(data).then((res) => { - if (res.code === 200) { + deviceVoiceBroadcast(data).then((res) => { + if (res.code == 200) { uni.showToast({ title: res.msg || '已切换', icon: 'none' }); } else { uni.showToast({ title: res.msg || '操作失败', icon: 'none' }); @@ -1094,6 +1094,7 @@ uni.showToast({ title: '下发失败,请检查蓝牙或网络', icon: 'none' }); }); } + // 未开启强制报警时,在 0–6 内置音色间切换或取消选中:只改按钮选中,不下发 }, // 报警模式 sosSetting(item) {