1
0
forked from dyf/APP

常规小优化

This commit is contained in:
liub
2026-04-22 08:29:06 +08:00
parent 01ff9c7a05
commit 1f88de4710
22 changed files with 1682 additions and 392 deletions

View File

@ -43,22 +43,32 @@
<!-- 设备基本信息 -->
<view class="info-card">
<view class="info-row">
<text class="info-label">IMEI</text>
<text class="info-label">IMEI</text>
<text class="info-value status-running">{{ deviceInfo.deviceImei }}</text>
</view>
<view class="info-row">
<text class="info-label">MAC</text>
<text class="info-value status-running">{{ itemInfo.deviceMac }}</text>
</view>
<view class="info-row">
<text class="info-label">设备状态</text>
<text class="info-value status-running">
{{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus === 2 ? '故障' : '在线' }}
</text>
</view>
<view class="info-row" v-if="itemInfo.deviceMac" @click="bleStatuToggle">
<text class="info-label">蓝牙状态</text>
<text class="info-value status-running" :class="formData.bleStatu?'green':'red'">
{{getbleStatu}}
<view class="info-row" >
<text class="info-label">蓝牙名称</text>
<text class="info-value status-running" >
{{deviceInfo.bluetoothName}}
</text>
</view>
<view class="info-row" v-if="itemInfo.deviceMac" @click="bleStatuToggle">
<view class="info-row" @click="bleStatuToggle">
<text class="info-label">蓝牙状态</text>
<text class="info-value status-running" :class="getbleStatu.cls">
{{getbleStatu.txt}}
</text>
</view>
<view class="info-row" @click="bleStatuToggle">
<text class="info-label">充电状态</text>
<text class="info-value status-running">
{{deviceInfo.chargeState != 0?'充电中':'未充电'}}
@ -433,24 +443,36 @@
return this.modeType === 'main' ? '灯光模式' : '激光模式';
},
getbleStatu() {
let txt="未连接"
let cls="";
if (this.formData.bleStatu === true) {
return '已连接';
txt= '已连接';
cls="green";
}
if (this.formData.bleStatu === 'connecting') {
return '连接中';
txt= '连接中';
}
if (this.formData.bleStatu === 'dicconnect') {
return '正在断开';
txt= '正在断开';
}
if (this.formData.bleStatu === 'err') {
return '连接异常';
txt= '连接异常';
cls="red"
}
return '未连接';
return {txt:txt,cls:cls}
}
},
methods: {
initWatch(){
this.$watch("deviceInfo.batteryPercentage",(newVal,oldVal)=>{
if (this.deviceInfo.batteryPercentage < 20 &&
this.deviceInfo.chargeState == 0) {
this.popupType = 'bettery';
this.popupMessage = '请及时充电';
this.showPopupFlag = true;
}
});
},
onReceive(deviceState, parsedMessage) { //蓝牙/Mq通用消息处理
switch (deviceState[0]) {
// 1设备切换灯光实时返回
@ -482,12 +504,7 @@
this.deviceInfo.batteryRemainingTime = deviceState[5]; //第6位200代表电池剩余续航时间200分钟
}
setTimeout(() => {
if (this.deviceInfo.batteryPercentage < 20 &&
this.deviceInfo.chargeState == 0) {
this.popupType = 'bettery';
this.popupMessage = '请及时充电';
this.showPopupFlag = true;
}
if (this.apiType === 'listA') {
this.fetchDeviceDetail(data.data.id)
} else {
@ -2014,7 +2031,7 @@
},
onLoad(options) {
these = this;
this.initWatch();
rec = BleReceive.getBleReceive();
const eventChannel = this.getOpenerEventChannel();
// 监听 'detailData' 事件,获取传过来的数据