|
@@ -77,14 +77,6 @@ export default {
|
|
|
sendControl() {
|
|
|
let that = this;
|
|
|
that.SendOrder('07')
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
|
|
|
sendControlClose() {
|
|
@@ -127,7 +119,6 @@ export default {
|
|
|
that.SendOrder('8a')
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
@@ -142,7 +133,7 @@ export default {
|
|
|
|
|
|
|
|
|
}
|
|
|
- }, 10000)
|
|
|
+ }, 3000)
|
|
|
},
|
|
|
|
|
|
|
|
@@ -244,6 +235,7 @@ export default {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
+ that.sendControlClose();
|
|
|
game_store.setters.setGameStatus(0);
|
|
|
|
|
|
game_store.setters.clearDeviceToy();
|
|
@@ -395,9 +387,25 @@ export default {
|
|
|
wx.onBLECharacteristicValueChange((characteristic) => {
|
|
|
let hexStr = that.ab2hex(characteristic.value);
|
|
|
|
|
|
- if (hexStr.toUpperCase().indexOf("AADD") != -1) {
|
|
|
+
|
|
|
+ if (hexStr.toUpperCase().indexOf("AAEE70") != -1) {
|
|
|
+ wx.showToast({
|
|
|
+ title: "教具已断开",
|
|
|
+ icon: "error"
|
|
|
+ })
|
|
|
+
|
|
|
+ that.SendOrder("09")
|
|
|
+ setTimeout(() => {
|
|
|
+ that.ReconnectToy()
|
|
|
+ }, 1500)
|
|
|
+ }
|
|
|
+ if (hexStr.toUpperCase().indexOf("AAEE07") != -1) {
|
|
|
+ that.sendControl();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (hexStr.toUpperCase().indexOf("AADD") != -1 || hexStr.toUpperCase().indexOf("AAEE") != -1) {
|
|
|
let nowTime = Math.round(new Date() / 1000);
|
|
|
- console.log(`${(nowTime - logTime)}s`)
|
|
|
+ console.log(`应答耗时:${(nowTime - logTime)}秒`)
|
|
|
console.log(hexStr);
|
|
|
}
|
|
|
let $data = that.get_big_data(hexStr);
|
|
@@ -447,11 +455,13 @@ export default {
|
|
|
|
|
|
|
|
|
if (hexStr.toUpperCase().indexOf("AADD87") != -1) {
|
|
|
- let $datas = that.DoAnalysis(hexStr, 10)
|
|
|
- console.log($datas)
|
|
|
- $this.toy_sn = $datas;
|
|
|
-
|
|
|
- that.SendOrder('8a')
|
|
|
+ let $datas = that.DoAnalysis(hexStr, 10)
|
|
|
+ let $number = $datas.match(/\d+/)
|
|
|
+ let toy_list_pre= {'01': "SW",'02': "KL",'04': "SC",'05': "PP",'06': "SU",'09': "UF"}
|
|
|
+ let $sn = toy_list_pre[current_toy_id] + $number;
|
|
|
+ $this.toy_sn = $sn;
|
|
|
+
|
|
|
+ that.SendOrder('8a')
|
|
|
}
|
|
|
|
|
|
|
|
@@ -497,8 +507,8 @@ export default {
|
|
|
|
|
|
|
|
|
if (hexStr.toUpperCase().indexOf("AADD84") != -1) {
|
|
|
- let $_hexStr = hexStr.substr(6);
|
|
|
- let $datas = $_hexStr.substr(0, 10);
|
|
|
+ let $hex_index = hexStr.toUpperCase().indexOf("AADD84") + 6;
|
|
|
+ let $datas = hexStr.substr($hex_index, 10);
|
|
|
if ($datas != "0000000000") {
|
|
|
console.log("以获取UUID:" + $datas)
|
|
|
current_toy_UUID = $datas;
|
|
@@ -566,6 +576,19 @@ export default {
|
|
|
|
|
|
if (hexStr.toUpperCase().indexOf("AADD07") != -1) {
|
|
|
FlagOpenControl = true;
|
|
|
+ console.log($game_status)
|
|
|
+ if($game_status != 1){
|
|
|
+ setTimeout(() => {
|
|
|
+ mpvue.navigateTo({
|
|
|
+ url: "/pages/start/main",
|
|
|
+ success() {
|
|
|
+
|
|
|
+ game_store.setters.setGameStatus(1);
|
|
|
+ $this.gameStart();
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }, 800);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|