2025年4月1日10:43:29
This commit is contained in:
@@ -36,6 +36,8 @@ App({
|
||||
|
||||
plugin.bus.subscribe("connectState", (res) => {
|
||||
console.log("app.js ===> connectState", res);
|
||||
|
||||
wx.hideLoading();
|
||||
});
|
||||
|
||||
plugin.bus.subscribe("devicesModel", (res) => {
|
||||
|
||||
@@ -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) {
|
||||
if(this.data.devicesList && this.data.devicesList.length && this.data.searchDevicesList) {
|
||||
this.setData({
|
||||
getDeviceSetting: false,
|
||||
initText: "设备搜索完成"
|
||||
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);
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user