|
@@ -40,17 +40,17 @@ Page({
|
|
|
BtHelper.getInstance().startScan(
|
|
|
that.data.connectDevice,
|
|
|
async function (b) {
|
|
|
- if (!b) {
|
|
|
- that.setStatus(1);
|
|
|
+ if (!b) {
|
|
|
+ that.setStatus(1);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async function (res) {
|
|
|
+ await BtHelper.getInstance().stopSearch();
|
|
|
+ that.setStatus(2);
|
|
|
+ that.data.connectDevice.deviceId = res.deviceId;
|
|
|
+ that.data.connectDevice.connectable = res.connectable;
|
|
|
+ that.data.connectDevice.mac = res.mac;
|
|
|
}
|
|
|
- },
|
|
|
- async function (res) {
|
|
|
- await BtHelper.getInstance().stopSearch();
|
|
|
- that.setStatus(2);
|
|
|
- that.data.connectDevice.deviceId = res.deviceId;
|
|
|
- that.data.connectDevice.connectable = res.connectable;
|
|
|
- that.data.connectDevice.mac = res.mac;
|
|
|
- }
|
|
|
);
|
|
|
},
|
|
|
|
|
@@ -73,10 +73,12 @@ Page({
|
|
|
wx.hideLoading();
|
|
|
that.setStatus(data ? 3 : 4)
|
|
|
if (data) {
|
|
|
- that.data.connectDevice.connectType = 1;
|
|
|
- that.data.connectDevice.state = 'online';
|
|
|
- getCurrentPages()[0].addConnectBlueDevice(that.data.connectDevice);
|
|
|
- route_util.goBackRoute(route_constant.indexRoot);
|
|
|
+ setTimeout(() => {
|
|
|
+ that.data.connectDevice.connectType = 1;
|
|
|
+ that.data.connectDevice.state = 'online';
|
|
|
+ getCurrentPages()[0].addConnectBlueDevice(that.data.connectDevice);
|
|
|
+ route_util.goBackRoute(route_constant.indexRoot);
|
|
|
+ }, 200);
|
|
|
}
|
|
|
});
|
|
|
},
|