2025年4月1日10:43:29
This commit is contained in:
@@ -36,6 +36,8 @@ App({
|
|||||||
|
|
||||||
plugin.bus.subscribe("connectState", (res) => {
|
plugin.bus.subscribe("connectState", (res) => {
|
||||||
console.log("app.js ===> connectState", res);
|
console.log("app.js ===> connectState", res);
|
||||||
|
|
||||||
|
wx.hideLoading();
|
||||||
});
|
});
|
||||||
|
|
||||||
plugin.bus.subscribe("devicesModel", (res) => {
|
plugin.bus.subscribe("devicesModel", (res) => {
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ Page({
|
|||||||
getDeviceSetting: false,
|
getDeviceSetting: false,
|
||||||
|
|
||||||
initText: "",
|
initText: "",
|
||||||
devicesList: []
|
devicesList: [],
|
||||||
|
searchDevicesList: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
@@ -161,6 +162,7 @@ Page({
|
|||||||
app.globalData.ppScale.plugin.Blue.start(deviceNames, false);
|
app.globalData.ppScale.plugin.Blue.start(deviceNames, false);
|
||||||
app.globalData.ppScale.plugin.bus.subscribe("devicesList", (res) => {
|
app.globalData.ppScale.plugin.bus.subscribe("devicesList", (res) => {
|
||||||
console.log("searchDevice ===> devicesList", res);
|
console.log("searchDevice ===> devicesList", res);
|
||||||
|
|
||||||
this.setData({
|
this.setData({
|
||||||
devicesList: res
|
devicesList: res
|
||||||
});
|
});
|
||||||
@@ -169,12 +171,11 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
selectDevice() {
|
selectDevice() {
|
||||||
setTimeout(() => {
|
if(this.data.devicesList && this.data.devicesList.length && this.data.searchDevicesList) {
|
||||||
if(this.data.devicesList && this.data.devicesList.length) {
|
|
||||||
this.setData({
|
this.setData({
|
||||||
getDeviceSetting: false,
|
searchDevicesList: false
|
||||||
initText: "设备搜索完成"
|
|
||||||
});
|
});
|
||||||
|
setTimeout(() => {
|
||||||
app.globalData.ppScale.plugin.Blue.stopBluetoothDevicesDiscovery();
|
app.globalData.ppScale.plugin.Blue.stopBluetoothDevicesDiscovery();
|
||||||
app.globalData.ppScale.device.list = this.data.devicesList;
|
app.globalData.ppScale.device.list = this.data.devicesList;
|
||||||
if(this.data.devicesList.length === 1) {
|
if(this.data.devicesList.length === 1) {
|
||||||
@@ -200,9 +201,7 @@ Page({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.selectDevice();
|
|
||||||
}
|
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user