|
@@ -470,7 +470,7 @@ export default {
|
|
|
onOpened() {
|
|
|
setTimeout(() => {
|
|
|
$this.endTheGame();
|
|
|
-
|
|
|
+ that.clearStatus($this);
|
|
|
}, 2000)
|
|
|
}
|
|
|
});
|
|
@@ -514,27 +514,25 @@ export default {
|
|
|
that.reconnect(res.deviceId, $this)
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
-
|
|
|
} else {
|
|
|
-
|
|
|
-
|
|
|
- game_store.setters.setGameStatus(0);
|
|
|
-
|
|
|
- ble_store.setters.clearDeviceToy();
|
|
|
- $this.connect_toy = 0;
|
|
|
-
|
|
|
- $this.device_bg = false;
|
|
|
- $this.device_status = 0;
|
|
|
-
|
|
|
-
|
|
|
- $this.$forceUpdate();
|
|
|
- wx.closeBluetoothAdapter();
|
|
|
-
|
|
|
+ that.clearStatus($this);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+
|
|
|
+ * 清除状态
|
|
|
+ * @param $this
|
|
|
+ */
|
|
|
+ clearStatus($this){
|
|
|
+ wx.closeBluetoothAdapter();
|
|
|
+ game_store.setters.setGameStatus(0);
|
|
|
+ ble_store.setters.clearDeviceToy();
|
|
|
+ $this.device_bg = false;
|
|
|
+ $this.device_status = 0;
|
|
|
+ $this.connect_toy = 0;
|
|
|
+ $this.$forceUpdate();
|
|
|
+ },
|
|
|
|
|
|
|
|
|
* todo:重新连接蓝牙
|
|
@@ -571,6 +569,7 @@ export default {
|
|
|
})
|
|
|
if ($connect_count >= 3) {
|
|
|
$this.endTheGame();
|
|
|
+ that.clearStatus($this);
|
|
|
clearInterval($rec)
|
|
|
}
|
|
|
$connect_count += 1;
|
|
@@ -613,21 +612,14 @@ export default {
|
|
|
Toast.success({
|
|
|
message: "断开蓝牙连接成功",
|
|
|
});
|
|
|
- ble_store.setters.clearDeviceToy();
|
|
|
- wx.closeBluetoothAdapter();
|
|
|
LOG_WECHAT($code, "断开蓝牙连接成功", deviceId);
|
|
|
},
|
|
|
fail(err) {
|
|
|
LOG_WECHAT_ERROR($code, "断开蓝牙连接"+deviceId+"失败error:", JSON.stringify(err));
|
|
|
},
|
|
|
complete() {
|
|
|
-
|
|
|
-
|
|
|
- $this.device_bg = false;
|
|
|
- $this.connect_toy = 0;
|
|
|
- $this.device_status = 0;
|
|
|
- $this.$forceUpdate();
|
|
|
-
|
|
|
+
|
|
|
+ that.clearStatus($this);
|
|
|
},
|
|
|
});
|
|
|
},500);
|