1
0
forked from dyf/APP

018A初步完成

This commit is contained in:
liub
2026-04-14 15:19:05 +08:00
parent d82ae6445e
commit 01ff9c7a05
43 changed files with 2626 additions and 892 deletions

View File

@ -43,7 +43,7 @@
<text class="lbl">设备名称</text>
<text class="value valueFont">{{device.deviceName}}</text>
</view>
<view class="item">
<text class="lbl">Mac地址</text>
@ -62,13 +62,13 @@
<text class="value valueFont">{{formData.sta_system}}</text>
</view>
</view>
<ProParams :id="device.id"></ProParams>
<MsgBox ref="msgPop" />
<global-loading ref="loading" />
</view>
</template>
@ -100,7 +100,7 @@
var ble = null;
var recei = null;
var mq = null;
var pagePath="pages/008A/HBY008A";
var pagePath = "pages/008A/HBY008A";
export default {
data() {
@ -112,9 +112,11 @@
apiType: "listA",
navbar: {
icons: [{
type:'msg',
src: '/static/images/common/msg.png'
},
{
type:'share',
src: '/static/images/common/shape.png'
}
],
@ -196,11 +198,11 @@
onUnload() {
console.log("页面卸载,释放资源");
let statusTopic = `A/${this.formData.imei?this.formData.imei:this.device.deviceImei}`;
if(ble){
ble.removeAllCallback(pagePath);
ble.removeReceiveCallback(pagePath);
if (ble) {
ble.removeAllCallback(pagePath);
ble.removeReceiveCallback(pagePath);
}
if (mq) {
mq.unsubscribe(statusTopic);
mq.disconnect();
@ -216,7 +218,7 @@
},
onLoad() {
these = this;
recei = BleReceive.getBleReceive();
ble = BleTool.getBleTool();
@ -230,8 +232,8 @@
eventChannel = this.getOpenerEventChannel();
eventChannel.on('detailData', (data)=> {
eventChannel.on('detailData', (data) => {
console.log("收到父页面的参数:" + JSON.stringify(data));
var device = data.data;
these.Status.apiType = data.apiType;
@ -285,7 +287,7 @@
these.formData.bleStatu = true;
}).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
MsgError("连接错误:" + ex.msg, "确定", these);
});
});
@ -312,12 +314,43 @@
these.formData.bleStatu = true;
}).catch(ex => {
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
MsgError("连接错误:" + ex.msg, "确定", these);
});
return;
}
},
getDevice: function() {
let f = ble.data.LinkedList.find((v) => {
return v.macAddress == these.device.deviceMac;
});
return f;
},
showBleUnConnect() {
MsgError("蓝牙未连接过该设备,请使用蓝牙重新添加该设备", "去连接", these, () => {
uni.navigateTo({
url: "/pages/common/addBLE/addEquip",
events: {
BindOver: function(data) {
console.log(data)
these.formData.bleStatu = true;
}
},
success: function(res) {
// 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('detailData', {
data: these.device
})
},
fail(ex) {
console.log("跳转失败", ex);
}
})
})
},
initMQ() {
@ -442,8 +475,8 @@
updateLoading(these, {
text: ex.msg
})
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
these.formData.bleStatu = 'err';
MsgError("连接错误:" + ex.msg, "确定", these);
}).finally(() => {
setTimeout(() => {
hideLoading(these);
@ -451,7 +484,7 @@
});
},
prevPage() {
uni.navigateBack({