diff --git a/pages/100J/HBY100-J.vue b/pages/100J/HBY100-J.vue index 30d0073..c6e121f 100644 --- a/pages/100J/HBY100-J.vue +++ b/pages/100J/HBY100-J.vue @@ -62,7 +62,7 @@ - {{ deviceInfo.voiceStrobeAlarm === 1 ? '报警中' : '强制报警' }} @@ -314,7 +314,6 @@ lightBrightness: 10, sta_system: '', warnTime: 0, - sta_SOSType: 0 }, dic: { sta_VoiceType: { @@ -497,7 +496,6 @@ } = data; // 3. 赋值对应的字段 - // 续航时间相关 if (funcType == '4') { these.deviceInfo.batteryPercentage = data.level //电量 @@ -506,18 +504,45 @@ } else if (funcType == '14') { // 调节相关字段 these.formData.strobeFrequency = led_strobe.frequency || - 0.5; //频率 + 0.5; //频率 these.formData.volume = volume || 10; //音量 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') { - // 语音频闪报警:0=关闭,1=开启 - const voiceStrobeAlarm = data.voice_strobe_alarm ?? 0; - these.formData.sta_VoiceType = voiceStrobeAlarm === 1 ? '1' : - '-1'; + console.log('我是谁', data.voice_broadcast); + // 语音频闪报警:0=关闭,1=开启 ui7是播放的状态 + const voiceStrobeAlarm = data.voice_broadcast ?? 0; + if (voiceStrobeAlarm === 1) { + these.formData.sta_VoiceType = '7' + } else { + these.formData.sta_VoiceType = '-1' + } + } else if (funcType === '12') { // 报警模式:直接用alarmMode作为sta_VoiceType const alarmMode = data.mode ?? 0; @@ -804,8 +829,8 @@ val = '-1'; } this.formData.sta_VoiceType = val; - console.log(this.formData.sta_VoiceType, 'this.formData.sta_VoiceType') // 模式类型为7时才去判断 + console.log(val, 'valllll'); if (val === '7' || val === '-1') { let data = { 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, buttonCancelText: '取消', okCallback: () => { - console.log(this.formData.sta_SOSType, 'this.formData.sta_SOSType'); - this.formData.sta_SOSType = isClose ? 0 : 1; + this.deviceInfo.voiceStrobeAlarm = isClose ? 0 : 1; //强制报警,报警中 0是强制报警,1是报警中 const data = { deviceIds: [this.deviceInfo.deviceId], // 声光报警开关:关闭传0,开启传1 @@ -868,12 +914,7 @@ icon: 'none' }); } - }).catch((err) => { - uni.showToast({ - title: '请求失败,请重试', - icon: 'none' - }); - }); + }).catch((err) => {}); } }; }, @@ -887,7 +928,7 @@ if (receive.deviceId !== this.formData.deviceId) { return; } - if (this.formData.sta_battery <= 20) { + if (this.deviceInfo.batteryPercentage <= 20) { this.showMsg("设备电量低"); } },