2025年4月1日10:43:29

This commit is contained in:
17792275749
2025-04-01 10:43:31 +08:00
parent f6301affba
commit bffc0e7d58
2 changed files with 12 additions and 11 deletions
+2
View File
@@ -36,6 +36,8 @@ App({
plugin.bus.subscribe("connectState", (res) => {
console.log("app.js ===> connectState", res);
wx.hideLoading();
});
plugin.bus.subscribe("devicesModel", (res) => {
+10 -11
View File
@@ -5,7 +5,8 @@ Page({
getDeviceSetting: false,
initText: "",
devicesList: []
devicesList: [],
searchDevicesList: true,
},
onLoad(options) {
@@ -161,6 +162,7 @@ Page({
app.globalData.ppScale.plugin.Blue.start(deviceNames, false);
app.globalData.ppScale.plugin.bus.subscribe("devicesList", (res) => {
console.log("searchDevice ===> devicesList", res);
this.setData({
devicesList: res
});
@@ -169,12 +171,11 @@ Page({
},
selectDevice() {
setTimeout(() => {
if(this.data.devicesList && this.data.devicesList.length) {
this.setData({
getDeviceSetting: false,
initText: "设备搜索完成"
});
if(this.data.devicesList && this.data.devicesList.length && this.data.searchDevicesList) {
this.setData({
searchDevicesList: false
});
setTimeout(() => {
app.globalData.ppScale.plugin.Blue.stopBluetoothDevicesDiscovery();
app.globalData.ppScale.device.list = this.data.devicesList;
if(this.data.devicesList.length === 1) {
@@ -200,9 +201,7 @@ Page({
}
})
}
} else {
this.selectDevice();
}
}, 3000);
}, 3000);
}
}
})