100JBUG修复

This commit is contained in:
fengerli
2026-02-27 17:53:13 +08:00
parent 15d2bbba1f
commit 8fab54032b

View File

@ -62,7 +62,7 @@
</view> </view>
<view class="lampMode"> <view class="lampMode">
<view class="sosContent"> <view class="sosContent">
<view class="btnSos openSos center" :class="{ active: formData.sta_SOSType === 1 }" <view class="btnSos openSos center" :class="{ active: deviceInfo.voiceStrobeAlarm === 1 }"
@click="sosSetting(1)"> @click="sosSetting(1)">
{{ deviceInfo.voiceStrobeAlarm === 1 ? '报警中' : '强制报警' }} {{ deviceInfo.voiceStrobeAlarm === 1 ? '报警中' : '强制报警' }}
</view> </view>
@ -314,7 +314,6 @@
lightBrightness: 10, lightBrightness: 10,
sta_system: '', sta_system: '',
warnTime: 0, warnTime: 0,
sta_SOSType: 0
}, },
dic: { dic: {
sta_VoiceType: { sta_VoiceType: {
@ -497,7 +496,6 @@
} = data; } = data;
// 3. 赋值对应的字段 // 3. 赋值对应的字段
// 续航时间相关 // 续航时间相关
if (funcType == '4') { if (funcType == '4') {
these.deviceInfo.batteryPercentage = data.level //电量 these.deviceInfo.batteryPercentage = data.level //电量
@ -506,18 +504,45 @@
} else if (funcType == '14') { } else if (funcType == '14') {
// 调节相关字段 // 调节相关字段
these.formData.strobeFrequency = led_strobe.frequency || these.formData.strobeFrequency = led_strobe.frequency ||
0.5; //频率 0.5; //频率
these.formData.volume = volume || 10; //音量 these.formData.volume = volume || 10; //音量
these.formData.lightBrightness = brightness.red || these.formData.lightBrightness = brightness.red ||
10; //亮度值,不管红色,蓝色,黄色 10; //亮度值
// 报警模式,选中,首次上报值,或者切换设备按键上报值
const enable = siren_alarm.enable ?? 0; // 报警开关1=开0=关
const mode = siren_alarm.mode ?? 0; // 模式0/1/2/3/4/5/6
if (these.formData.sta_VoiceType != 7) {
if (enable === 1) {
// 开启状
these.formData.sta_VoiceType = mode + '';
} else {
// 关闭状态:赋值-1表示关闭
these.formData.sta_VoiceType = mode + '';
}
} else {
// 播放语音,上报消息
const voiceStrobeAlarm = data.voice_broadcast ?? 0;
if (voiceStrobeAlarm === 1) {
these.formData.sta_VoiceType = '7'
} else {
these.formData.sta_VoiceType = '-1'
}
}
} }
// 报警模式相关字段赋值 // 报警模式相关字段赋值
// 是语音根据这个字段做判断 // 是语音播放根据这个字段
if (funcType === '6') { if (funcType === '6') {
// 语音频闪报警0=关闭1=开启 console.log('我是谁', data.voice_broadcast);
const voiceStrobeAlarm = data.voice_strobe_alarm ?? 0; // 语音频闪报警0=关闭1=开启 ui7是播放的状态
these.formData.sta_VoiceType = voiceStrobeAlarm === 1 ? '1' : const voiceStrobeAlarm = data.voice_broadcast ?? 0;
'-1'; if (voiceStrobeAlarm === 1) {
these.formData.sta_VoiceType = '7'
} else {
these.formData.sta_VoiceType = '-1'
}
} else if (funcType === '12') { } else if (funcType === '12') {
// 报警模式直接用alarmMode作为sta_VoiceType // 报警模式直接用alarmMode作为sta_VoiceType
const alarmMode = data.mode ?? 0; const alarmMode = data.mode ?? 0;
@ -804,8 +829,8 @@
val = '-1'; val = '-1';
} }
this.formData.sta_VoiceType = val; this.formData.sta_VoiceType = val;
console.log(this.formData.sta_VoiceType, 'this.formData.sta_VoiceType')
// 模式类型为7时才去判断 // 模式类型为7时才去判断
console.log(val, 'valllll');
if (val === '7' || val === '-1') { if (val === '7' || val === '-1') {
let data = { let data = {
deviceId: this.deviceInfo.deviceId, deviceId: this.deviceInfo.deviceId,
@ -824,6 +849,28 @@
}); });
} }
}) })
} else if (this.deviceInfo.voiceStrobeAlarm == 1) {
console.log('走到这里了没');
// 如果强制报警已经开启了,那么切换下面的模式需要时,需要触发报警指令
const data = {
deviceIds: [this.deviceInfo.deviceId],
// 声光报警开关开启传1
voiceStrobeAlarm: 1,
mode: this.formData.sta_VoiceType
};
deviceForceAlarmActivation(data).then((res) => {
if (res.code === 200) {
uni.showToast({
title: '强制报警已开启',
icon: 'none'
});
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
})
} }
}, },
@ -848,8 +895,7 @@
showCancel: true, showCancel: true,
buttonCancelText: '取消', buttonCancelText: '取消',
okCallback: () => { okCallback: () => {
console.log(this.formData.sta_SOSType, 'this.formData.sta_SOSType'); this.deviceInfo.voiceStrobeAlarm = isClose ? 0 : 1; //强制报警,报警中 0是强制报警,1是报警中
this.formData.sta_SOSType = isClose ? 0 : 1;
const data = { const data = {
deviceIds: [this.deviceInfo.deviceId], deviceIds: [this.deviceInfo.deviceId],
// 声光报警开关关闭传0开启传1 // 声光报警开关关闭传0开启传1
@ -868,12 +914,7 @@
icon: 'none' icon: 'none'
}); });
} }
}).catch((err) => { }).catch((err) => {});
uni.showToast({
title: '请求失败,请重试',
icon: 'none'
});
});
} }
}; };
}, },
@ -887,7 +928,7 @@
if (receive.deviceId !== this.formData.deviceId) { if (receive.deviceId !== this.formData.deviceId) {
return; return;
} }
if (this.formData.sta_battery <= 20) { if (this.deviceInfo.batteryPercentage <= 20) {
this.showMsg("设备电量低"); this.showMsg("设备电量低");
} }
}, },