chaooo 1 рік тому
батько
коміт
d0d54aa44f
2 змінених файлів з 13 додано та 23 видалено
  1. 2 12
      src/components/connection/index.vue
  2. 11 11
      src/utils/connection.js

+ 2 - 12
src/components/connection/index.vue

@@ -144,9 +144,6 @@ export default {
     }
     //判断是否游戏中
     $this.game_status = game_store.getters.getGameStatus()*1;
-    // 游戏过程中关闭脑机状态
-    let $game_close_status = game_store.getters.getGameCloseStatus();
-
     if ($this.game_status === 3) {
       // getBluetoothLinkStatus
       let $ble_status = ble_store.getters.getBluetoothLinkStatus();
@@ -154,25 +151,18 @@ export default {
         //断开蓝牙连接
         $this.setDeviceStatus(0);
       }
-
       //不在游戏状态
       $this.connect_toy = 0;
-      //$this.connect_show = true;
       // 监听数据
       $this.$connection.notifyDatas($this);
       $this.$connection.watchBLEstatus($this);
-
-      //$this.toy_UUID = "";
-
-      // 重新连接失败
+      // 游戏过程中脑机断连
+      let $game_close_status = game_store.getters.getGameCloseStatus();
       if ($game_close_status === 1) {
-        console.log("---------------------------------------------------------------------")
         // 重置默认条件
         $this.connect_toy = 0;
-        //$this.connect_show = false;
         $this.device_status = 0;
         $this.$connection.watchBLEstatus($this);
-        //$this.toy_UUID = "";
         // 清空链接的设备
         ble_store.setters.clearDeviceToy();
         game_store.setters.setPlayedTime(0);

+ 11 - 11
src/utils/connection.js

@@ -508,19 +508,19 @@ export default {
         let $game_status = game_store.getters.getGameStatus();
         LOG_DEBUG("智脑机已断开连接,游戏状态:", $game_status);
         if ($game_status === 1 || $game_status === 2) {
-          if($this && $this.$options.name && $this.$options.name === "StartGames"){
-            $this.endTheGame();
-          }
           // if($this && $this.$options.name && $this.$options.name === "StartGames"){
-          //   Notify({
-          //     type: 'danger',
-          //     duration: 0,
-          //     message: '智脑机已断开连接,正在尝试重新连接',
-          //     onOpened() {
-          //       that.reconnect(res.deviceId, $this)
-          //     }
-          //   });
+          //   $this.endTheGame();
           // }
+          if($this && $this.$options.name && $this.$options.name === "StartGames"){
+            Notify({
+              type: 'danger',
+              duration: 0,
+              message: '智脑机已断开连接,正在尝试重新连接',
+              onOpened() {
+                that.reconnect(res.deviceId, $this);
+              }
+            });
+          }
         } else {
           that.clearStatus($this);
         }