优化100J问题
This commit is contained in:
@ -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') {
|
||||
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 }),
|
||||
'语音播报'
|
||||
);
|
||||
}
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user