Merge branch 'liubiao-new-20250827'
This commit is contained in:
@ -78,6 +78,7 @@
|
||||
ble.removeReceiveCallback(pagePath);
|
||||
},
|
||||
onUnload() {
|
||||
console.log("返回时断开蓝牙连接,取消订阅");
|
||||
ble.removeReceiveCallback(pagePath);
|
||||
},
|
||||
onLoad(option) {
|
||||
@ -86,12 +87,12 @@
|
||||
ble.addReceiveCallback((receive,f,path) => {
|
||||
console.log("收到设备消息,", receive);
|
||||
if (these.device.deviceId == receive.deviceId) {
|
||||
console.log("11111");
|
||||
// console.log("11111");
|
||||
|
||||
if (receive.bytes[0] == 0xFC || receive.str.indexOf('mac address:') == 0) {
|
||||
if (f && f.macAddress) {
|
||||
these.device.macAddress = f.macAddress;
|
||||
console.log("222222");
|
||||
// console.log("222222");
|
||||
these.initDevice();
|
||||
}
|
||||
}
|
||||
@ -99,13 +100,23 @@
|
||||
},pagePath);
|
||||
eventChannel = this.getOpenerEventChannel();
|
||||
eventChannel.on('LinkItem', function(data) {
|
||||
console.log("data=",data);
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.deviceId = data.deviceId;
|
||||
return v.deviceId == data.deviceId;
|
||||
});
|
||||
if (f) {
|
||||
these.device = Object.assign({}, these.device, f);
|
||||
console.log("获取到设备", f);
|
||||
|
||||
let keys=Object.keys(f);
|
||||
keys.forEach((v,index)=>{
|
||||
these.device[v]=f[v];
|
||||
})
|
||||
console.log("LinkedList=",ble.data.LinkedList)
|
||||
console.log("f=", f);
|
||||
console.log("获取到设备", these.device);
|
||||
if (f.macAddress) {
|
||||
these.device.macAddress = f.macAddress;
|
||||
|
||||
these.initDevice();
|
||||
}
|
||||
} else {
|
||||
console.log("未获取到设备");
|
||||
}
|
||||
@ -117,6 +128,7 @@
|
||||
showLoading(these, {
|
||||
text: '正在获取设备信息'
|
||||
});
|
||||
console.log("these.device=",these.device);
|
||||
request({
|
||||
url: '/app/device/getDeviceInfoByDeviceMac',
|
||||
method: 'GET',
|
||||
@ -130,12 +142,12 @@
|
||||
if (data) {
|
||||
let keys = Object.keys(data);
|
||||
ble.data.LinkedList.find((v) => {
|
||||
if(v.deviceId = these.device.deviceId){
|
||||
if(v.deviceId == these.device.deviceId){
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
let key = keys[i];
|
||||
v[key] = data[key];
|
||||
console.log("key="+key);
|
||||
console.log("value="+data[key]);
|
||||
// console.log("key="+key);
|
||||
// console.log("value="+data[key]);
|
||||
|
||||
|
||||
these.$set(these.device, key, data[key]);
|
||||
@ -163,7 +175,7 @@
|
||||
// 调用绑定设备接口
|
||||
|
||||
let f = ble.data.LinkedList.find((v) => {
|
||||
return v.deviceId = these.device.deviceId;
|
||||
return v.deviceId == these.device.deviceId;
|
||||
});
|
||||
if (!f) {
|
||||
these.Statu.bound = false;
|
||||
@ -195,7 +207,7 @@
|
||||
if (res.code == 200) {
|
||||
these.Statu.bound = true;
|
||||
these.Statu.boundRemark = "设备绑定成功!";
|
||||
|
||||
ble.removeReceiveCallback(pagePath);
|
||||
|
||||
uni.$emit("refreshDeviceList");
|
||||
setTimeout(() => {
|
||||
|
@ -136,7 +136,7 @@
|
||||
},
|
||||
onHide: function() {
|
||||
ble.StopSearch();
|
||||
ble.removeReceiveCallback(pagePath);
|
||||
|
||||
},
|
||||
onBackPress: (e) => {
|
||||
ble.StopSearch();
|
||||
@ -145,8 +145,7 @@
|
||||
},
|
||||
onUnload(){
|
||||
ble.StopSearch();
|
||||
ble.removeDeviceFound(pagePath);
|
||||
ble.removeReceiveCallback(pagePath);
|
||||
|
||||
},
|
||||
onLoad() {
|
||||
these = this;
|
||||
@ -172,7 +171,12 @@
|
||||
}
|
||||
}
|
||||
},pagePath);
|
||||
|
||||
// ble.addReceiveCallback((receivData) => {
|
||||
// console.log("收到数据了:", receivData);//数据格式:{bytes:[109,97],str:"",hexs:"FA 01"}
|
||||
|
||||
// // let data=uni.getStorageSync(ble.StorageKey);
|
||||
// console.log("LinkedList=",ble.data.LinkedList);
|
||||
// },pagePath);
|
||||
},
|
||||
|
||||
onShow: function() {
|
||||
@ -187,12 +191,7 @@
|
||||
});
|
||||
|
||||
|
||||
ble.addReceiveCallback((receivData) => {
|
||||
console.log("收到数据了:", receivData);//数据格式:{bytes:[109,97],str:"",hexs:"FA 01"}
|
||||
console.log("LinkedList=",ble.data.LinkedList);
|
||||
let data=uni.getStorageSync(ble.StorageKey);
|
||||
console.log("data=",data);
|
||||
},pagePath);
|
||||
|
||||
|
||||
|
||||
},
|
||||
@ -241,7 +240,7 @@
|
||||
|
||||
these.PairEquip.push(item);
|
||||
}
|
||||
ble.removeReceiveCallback(pagePath);
|
||||
console.log("连接成功");
|
||||
uni.navigateTo({
|
||||
url:"/pages/common/addBLE/LinkBle",
|
||||
events:{
|
||||
|
@ -486,6 +486,10 @@
|
||||
// 列表跳转
|
||||
handleFile(item) {
|
||||
let url = item.detailPageUrl;
|
||||
// console.log("url=",url);
|
||||
// if(!url){
|
||||
//url="/pages/670/HBY670"
|
||||
// }
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
events: {
|
||||
@ -498,6 +502,8 @@
|
||||
deviceType: this.tabs[this.activeTab].id || '',
|
||||
apiType: 'listA' //标识,根据这个参数,区分普通详情,分享跳转详情,查不一样的权限信息
|
||||
});
|
||||
},fail(ex) {
|
||||
console.log("ex=",ex);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
Reference in New Issue
Block a user