1
0
forked from dyf/APP

7305充电状态修复

This commit is contained in:
微微一笑
2025-12-15 16:00:29 +08:00
parent a6f7d066c7
commit 6fcf9c814b

View File

@ -390,6 +390,7 @@
} }
if (res.deviceId == these.formData.deviceId) { if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = true; this.formData.bleStatu = true;
// 重新连接后状态以设备上报为准
setTimeout(() => { setTimeout(() => {
hideLoading(these, 1000); hideLoading(these, 1000);
}); });
@ -406,6 +407,9 @@
} }
if (res.deviceId == these.formData.deviceId) { if (res.deviceId == these.formData.deviceId) {
this.formData.bleStatu = false; this.formData.bleStatu = false;
// 断开连接时先将充电状态复位,避免保持旧值
this.formData.statu = '未充电';
this.setBleFormData();
setTimeout(() => { setTimeout(() => {
hideLoading(these, 1000); hideLoading(these, 1000);
}); });
@ -491,7 +495,9 @@
} }
}); });
if ('statu' in json) { if ('statu' in json) {
these.formData.statu = json.statu == '1' ? '充电中' : '未充电'; const chargingVal = json.statu;
const isCharging = chargingVal === 1 || chargingVal === '1' || chargingVal === true || chargingVal === '充电中';
these.formData.statu = isCharging ? '充电中' : '未充电';
} }
if ('xuhang' in json) { if ('xuhang' in json) {
these.formData.xuhang = json.xuhang; these.formData.xuhang = json.xuhang;