更新100、670电量低的提示方式为监听式

This commit is contained in:
liub
2026-03-09 16:10:48 +08:00
parent 0aa012d9c7
commit 1eae2d1d91
7 changed files with 214 additions and 244 deletions

View File

@ -223,11 +223,11 @@
</view>
<view class="proinfo lamp">
<text class="title">产品信息</text>
<view class="itemcontent">
@ -245,18 +245,18 @@
</view>
</view>
</view>
<!-- 弹窗通知 -->
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
v-model="Status.Pop.modelValue" @closePop="closePop" :buttonCancelText="Status.Pop.buttonCancelText"
:showCancel="Status.Pop.showCancel" @cancelPop="closePop" />
<!-- 下方菜单 -->
<!-- <BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
:buttonBgColor="Status.Pop.buttonBgColor" :buttonTextColor="Status.Pop.buttonTextColor"
:iconUrl="Status.Pop.iconUrl" :message="Status.Pop.message" :buttonText="Status.Pop.buttonText"
@buttonClick="HidePop" :visiblePrompt="Status.Pop.visiblePrompt" :promptTitle="Status.Pop.promptTitle"
v-model="Status.Pop.modelValue" @closePop="closePop" :buttonCancelText="Status.Pop.buttonCancelText"
:showCancel="Status.Pop.showCancel" @cancelPop="closePop" />
<!-- 下方菜单 -->
<!-- <BottomSlideMenuPlus :config="Status.BottomMenu" @close="closeMenu" @itemClick="handleItemClick"
@btnClick="btnClick">
<view>
<view class="addIco">
@ -266,8 +266,8 @@
</view>
</view>
</BottomSlideMenuPlus> -->
<global-loading ref="loading" />
<global-loading ref="loading" />
</view>
</template>
@ -518,6 +518,11 @@
recei = BleReceive.getBleReceive();
ble = BleTool.getBleTool();
this.$watch("formData.sta_battery", (newVal, oldVal) => {
if (newVal <= 20 && this.formData.sta_system==2) {
this.showMsg("设备电量低");
}
});
ble.addReceiveCallback(this.bleValueNotify, pagePath);
ble.addStateBreakCallback(this.bleStateBreak, pagePath);
@ -572,10 +577,10 @@
these.formData.bleStatu = false;
these.formData.deviceId = f.deviceId;
these.formData.bleStatu = 'connecting';
these.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
}).catch(ex=>{
}).catch(ex => {
these.formData.bleStatu = 'err';
});
these.setBleFormData();
@ -592,17 +597,17 @@
this.Status.pageHide = false;
},
computed: {
getbleStatu(){
if(this.formData.bleStatu===true){
getbleStatu() {
if (this.formData.bleStatu === true) {
return '已连接';
}
if(this.formData.bleStatu==='connecting'){
if (this.formData.bleStatu === 'connecting') {
return '连接中';
}
if(this.formData.bleStatu==='dicconnect'){
if (this.formData.bleStatu === 'dicconnect') {
return '正在断开';
}
if(this.formData.bleStatu==='err'){
if (this.formData.bleStatu === 'err') {
return '连接异常';
}
return '未连接';
@ -1196,9 +1201,9 @@
return;
}
if (res.deviceId == these.formData.deviceId) {
if(res.device){
if (res.device) {
these.formData.bleStatu = 'connecting';
}else{
} else {
this.formData.bleStatu = false;
}
setTimeout(() => {
@ -1233,14 +1238,14 @@
showLoading(this, {
text: "蓝牙恢复可用,正在连接设备"
});
these.formData.bleStatu='connecting';
these.formData.bleStatu = 'connecting';
ble.LinkBlue(these.formData.deviceId).then(() => {
these.formData.bleStatu = true;
updateLoading(these, {
text: '连接成功'
});
}).catch(ex => {
these.formData.bleStatu='err';
these.formData.bleStatu = 'err';
updateLoading(these, {
text: ex.msg
})
@ -1313,9 +1318,10 @@
}
});
if (this.formData.sta_battery <= 20) {
this.showMsg("设备电量低");
}
},
getDevice: function() {
@ -1327,32 +1333,32 @@
return f;
},
bleStatuToggle(){
let f=this.getDevice();
if(!f){
bleStatuToggle() {
let f = this.getDevice();
if (!f) {
this.showBleUnConnect();
return;
}
if(this.formData.bleStatu===true){
this.formData.bleStatu='dicconnect';
ble.disconnectDevice(f.deviceId).finally(r=>{
this.formData.bleStatu=false;
if (this.formData.bleStatu === true) {
this.formData.bleStatu = 'dicconnect';
ble.disconnectDevice(f.deviceId).finally(r => {
this.formData.bleStatu = false;
});
return;
}
if(this.formData.bleStatu===false || this.formData.bleStatu==='err'){
this.formData.bleStatu='connecting';
if (this.formData.bleStatu === false || this.formData.bleStatu === 'err') {
this.formData.bleStatu = 'connecting';
ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId).then(res => {
these.formData.bleStatu = true;
}).catch(ex=>{
}).catch(ex => {
these.formData.bleStatu = 'err';
});
return;
}
},