|
@@ -80,12 +80,17 @@ export default {
|
|
|
})
|
|
|
.then(async (res) => {
|
|
|
if (res.data.code !== 0) return this.$showToast(res.data.msg);
|
|
|
- this.$showToast('解绑成功');
|
|
|
+ this.$showToast('解绑成功');
|
|
|
+
|
|
|
+ xBlufi.notifyStartDiscoverBle({
|
|
|
+ 'isStart': false
|
|
|
+ })
|
|
|
xBlufi.notifyConnectBle({
|
|
|
isStart: false,
|
|
|
deviceId: item.id,
|
|
|
});
|
|
|
- xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
|
|
+ xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent);
|
|
|
+
|
|
|
this.connectedId = item.id;
|
|
|
console.log(this.connectedId, 'this.connectedId');
|
|
|
const ready = await this.ensureBtReady();
|
|
@@ -125,14 +130,15 @@ export default {
|
|
|
},
|
|
|
closeBluetooth() {
|
|
|
// 2.1 断开设备
|
|
|
- if (this.connectedId) {
|
|
|
+ if (this.connectedId) {
|
|
|
+ console.log('断开连接', this.connectedId);
|
|
|
uni.closeBLEConnection({
|
|
|
deviceId: this.connectedId,
|
|
|
success: () => {
|
|
|
console.log('断开连接成功');
|
|
|
},
|
|
|
- fail: () => {
|
|
|
- /* 已断开或其它异常不用提示 */
|
|
|
+ fail: (err) => {
|
|
|
+ console.log('断开连接失败',err);
|
|
|
}
|
|
|
});
|
|
|
this.connectedId = '';
|
|
@@ -144,8 +150,8 @@ export default {
|
|
|
success: () => {
|
|
|
console.log('关闭蓝牙适配器成功');
|
|
|
},
|
|
|
- fail: () => {
|
|
|
- /* 同样可吞掉 */
|
|
|
+ fail: (err) => {
|
|
|
+ console.log('关闭适配器',err)
|
|
|
}
|
|
|
});
|
|
|
this.isBluetoothOpen = false;
|