Procházet zdrojové kódy

Merge branch 'master' of gitee.com:sh_13808852820/program

Foystor před 3 roky
rodič
revize
f5376ab319
2 změnil soubory, kde provedl 12 přidání a 12 odebrání
  1. 1 1
      src/pages/index/index.vue
  2. 11 11
      src/utils/bluetooth.js

+ 1 - 1
src/pages/index/index.vue

@@ -200,7 +200,7 @@ export default {
   },
   onLoad($option) {
     if (process.env.NODE_ENV == "development") {
-      wx.setStorageSync("token", "ogsti72oUSkbPl4OL7gl9woLTxR6fk4V");
+      // wx.setStorageSync("token", "ogsti72oUSkbPl4OL7gl9woLTxR6fk4V");
     }
 
     if (game_store.getters.getGameStatus() == 1) {

+ 11 - 11
src/utils/bluetooth.js

@@ -97,7 +97,7 @@ export default {
       if (!control_close) {
         that.SendOrder('09')
         //如果是jellyfish则发送00教具
-        if(!is_new){
+        if (!is_new) {
           that.sendConnectOneToMore('00')
         }
 
@@ -137,7 +137,7 @@ export default {
           that.SendOrder('8a')
         }
       }, 3000)
-    }else{
+    } else {
       console.log("旧脑环不支持获取教具电量")
     }
   },
@@ -164,38 +164,38 @@ export default {
     let $delta_1 = hex.substr(hex.indexOf("0418") + 4, 2);
     let $delta_2 = hex.substr(hex.indexOf("0418") + 6, 2);
     let $delta_3 = hex.substr(hex.indexOf("0418") + 8, 2);
-    let $delta = parseInt($delta_1 + $delta_2 + $delta_3, 16);
+    let $delta = parseInt($delta_1, 16) + parseInt($delta_2, 16) + parseInt($delta_3, 16);
 
     //Theta数据
     let $theta_1 = hex.substr(hex.indexOf("0418") + 10, 2);
     let $theta_2 = hex.substr(hex.indexOf("0418") + 12, 2);
     let $theta_3 = hex.substr(hex.indexOf("0418") + 14, 2);
-    let $theta = parseInt($theta_1 + $theta_2 + $theta_3, 16);
+    let $theta = parseInt($theta_1, 16) + parseInt($theta_2, 16) + parseInt($theta_3, 16);
 
 
     //low_Alpha
     let $low_alpha_1 = hex.substr(hex.indexOf("0418") + 16, 2);
     let $low_alpha_2 = hex.substr(hex.indexOf("0418") + 18, 2);
     let $low_alpha_3 = hex.substr(hex.indexOf("0418") + 20, 2);
-    let $low_alpha = parseInt($low_alpha_1 + $low_alpha_2 + $low_alpha_3, 16);
+    let $low_alpha = parseInt($low_alpha_1, 16) + parseInt($low_alpha_2, 16) + parseInt($low_alpha_3, 16);
 
     //high_Alpha
     let $high_alpha_1 = hex.substr(hex.indexOf("0418") + 22, 2);
     let $high_alpha_2 = hex.substr(hex.indexOf("0418") + 24, 2);
     let $high_alpha_3 = hex.substr(hex.indexOf("0418") + 26, 2);
-    let $high_alpha = parseInt($high_alpha_1 + $high_alpha_2 + $high_alpha_3, 16);
+    let $high_alpha = parseInt($high_alpha_1, 16) + parseInt($high_alpha_2, 16) + parseInt($high_alpha_3, 16);
 
     //low_beta
     let $low_beta_1 = hex.substr(hex.indexOf("0418") + 28, 2);
     let $low_beta_2 = hex.substr(hex.indexOf("0418") + 30, 2);
     let $low_beta_3 = hex.substr(hex.indexOf("0418") + 32, 2);
-    let $low_beta = parseInt($low_beta_1 + $low_beta_2 + $low_beta_3, 16);
+    let $low_beta = parseInt($low_beta_1, 16) + parseInt($low_beta_2, 16) + parseInt($low_beta_3, 16);
 
     //high_beta
     let $high_beta_1 = hex.substr(hex.indexOf("0418") + 34, 2);
     let $high_beta_2 = hex.substr(hex.indexOf("0418") + 36, 2);
     let $high_beta_3 = hex.substr(hex.indexOf("0418") + 38, 2);
-    let $high_beta = parseInt($high_beta_1 + $high_beta_2 + $high_beta_3, 16);
+    let $high_beta = parseInt($high_beta_1, 16) + parseInt($high_beta_2, 16) + parseInt($high_beta_3, 16);
     let $max_num = 30000;
     return {
       att: $att,
@@ -280,7 +280,7 @@ export default {
         wx.createBLEConnection({
           deviceId: $deviceInfo.deviceId,
           success(res) {
-            Notify({type: 'success', message: `第${$connect_count}次重新连接成功`});
+            Notify({ type: 'success', message: `第${$connect_count}次重新连接成功` });
             let $system = wx.getSystemInfoSync()
             if ($system.platform == 'ios') {
               that.getBLEDeviceServices($deviceInfo.deviceId)
@@ -293,7 +293,7 @@ export default {
             clearInterval($rec)
           },
           fail(res) {
-            Notify({type: 'danger', message: `第${$connect_count}次重新连接失败`});
+            Notify({ type: 'danger', message: `第${$connect_count}次重新连接失败` });
             game_store.setters.setGameCloseStatus(1);
           }
         })
@@ -496,7 +496,7 @@ export default {
         let $mHexStr = hexStr.substr(hexStr.toUpperCase().indexOf("AADD87"))
         let $datas = that.DoAnalysis($mHexStr, 10)
         let $number = $datas.match(/\d+/)
-        let toy_list_pre = {'01': "SW", '02': "KL", '04': "SC", '05': "PP", '06': "SU", '09': "UF"}
+        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;
         //获取教具电量