Prechádzať zdrojové kódy

更新被合并的setGameCloseStatus状态

unknown 4 rokov pred
rodič
commit
bd415bfc2e

+ 12 - 25
src/components/device/device.vue

@@ -23,10 +23,7 @@
         </div>
 
         <!-- 已链接 -->
-        <div
-          class="connected_box"
-          v-if="connect_show"
-        >
+        <div class="connected_box" v-if="connect_show">
           <device_connected
             @open_choose_toy="open_choose_toy"
             @change_brain_status="change_device_status"
@@ -73,10 +70,7 @@
       </div>
       <!-- 内容 -->
       <div class="padding toy_list">
-        <van-row
-          gutter="14"
-          class="toy_list_content"
-        >
+        <van-row gutter="14" class="toy_list_content">
           <van-col
             v-for="(toy, index) in toy_list"
             :key="index"
@@ -91,11 +85,7 @@
                   : 'toy_item_normal_bg'
               "
             >
-              <img
-                :src="toy.img"
-                alt=""
-                class="toy_img"
-              />
+              <img :src="toy.img" alt="" class="toy_img" />
               <text class="toy_text padding-top">{{ toy.name }}</text>
             </div>
           </van-col>
@@ -103,7 +93,8 @@
       </div>
       <!-- 结尾 -->
       <div class="toy_actions padding text-center">
-        <view class="text-gray toy_action_text padding">选择你最感兴趣的项目,点击“选好了”以后将会自动连接
+        <view class="text-gray toy_action_text padding"
+          >选择你最感兴趣的项目,点击“选好了”以后将会自动连接
         </view>
         <button
           class="cu-btn lg cu-btn-primary text-white text-center padding"
@@ -125,7 +116,6 @@
     <!--    >-->
     <!--      <gameIng v-if="game_status" @closePop="onStartGameShowClose"></gameIng>-->
     <!--    </van-popup>-->
-
   </div>
 </template>
 
@@ -327,16 +317,13 @@ export default {
       $this.choose_toy_window.show = true;
       let $serviceId = game_store.getters.getServiceId();
       let $charateristic = game_store.getters.getCharacterId();
-      
+
       bluetooth.shutdownSendControl(
-            $this._deviceId,
-            $serviceId,
-            $charateristic
-          );
-      bluetooth.sendEnd(
-            $this._deviceId,
-            $serviceId,
-            $charateristic);
+        $this._deviceId,
+        $serviceId,
+        $charateristic
+      );
+      bluetooth.sendEnd($this._deviceId, $serviceId, $charateristic);
     },
     // 选好玩具
     choose_ok() {
@@ -537,7 +524,7 @@ export default {
     let $game_status = game_store.getters.getGameStatus();
     // 游戏过程中关闭脑环状态
     let $game_close_status = game_store.getters.getGameCloseStatus();
-    // console.log("游戏中:" + $game_status);
+    console.log("返回时:" + $game_status, $game_close_status);
     if ($game_status == 3) {
       //不在游戏状态
       $this.connect_toy = 0;

+ 1 - 1
src/components/device/toy/connecting.vue

@@ -328,7 +328,7 @@ export default {
       $this.pay_type = $event;
       let $params = {
         type: $event,
-        device_id: $this.toy_id,
+        device_id: $this.toy_id, 
         access_token: wx.getStorageSync("token"),
       };
       gameStart($params).then(

+ 9 - 7
src/utils/bluetooth.js

@@ -447,7 +447,9 @@ export default {
             duration: 0,
             message: '智脑环已断开连接,请重新扫码智脑环'
           });
-          game_store.setters.setGameStatus(0);
+          //   game_store.setters.setGameStatus(0);
+          game_store.setters.setGameCloseStatus(1);
+
 
 
         }
@@ -737,26 +739,26 @@ export default {
   },
 
   //根据错误代码返回字符串信息
-  GetopenBluetoothAdapterError(errCode){
+  GetopenBluetoothAdapterError(errCode) {
 
     let $errmsg = "";
-    if(errCode == 10000){
+    if (errCode == 10000) {
       $errmsg = "未初始化蓝牙适配器"
     }
 
-    if(errCode == 10001){
+    if (errCode == 10001) {
       $errmsg = "当前蓝牙适配器不可用"
     }
 
-    if(errCode == 10002){
+    if (errCode == 10002) {
       $errmsg = "没有找到指定设备"
     }
 
-    if(errCode == 10003){
+    if (errCode == 10003) {
       $errmsg = "连接失败"
     }
 
-    if(errCode == 10006){
+    if (errCode == 10006) {
       $errmsg = "当前连接已断开"
     }
 

+ 70 - 71
src/utils/index.js

@@ -150,19 +150,19 @@ function getLineOption(lineData_att, lineData_med) {
       show: false,
     },
     series: [{
-      name: "Att(专注度)",
-      symbol: "none", //取消折点圆圈
-      type: "line",
-      smooth: true,
-      data: lineData_att,
-    },
-    {
-      name: "Med(放松度)",
-      symbol: "none", //取消折点圆圈
-      type: "line",
-      smooth: true,
-      data: lineData_med,
-    },
+        name: "Att(专注度)",
+        symbol: "none", //取消折点圆圈
+        type: "line",
+        smooth: true,
+        data: lineData_att,
+      },
+      {
+        name: "Med(放松度)",
+        symbol: "none", //取消折点圆圈
+        type: "line",
+        smooth: true,
+        data: lineData_med,
+      },
     ],
     animation: false,
   };
@@ -241,33 +241,33 @@ function getBaseOption(delta, theta, alpha, beta) {
       show: false,
     },
     series: [{
-      name: "Delta",
-      symbol: "none", //取消折点圆圈
-      type: "line",
-      smooth: true,
-      data: delta,
-    },
-    {
-      name: "Theta",
-      symbol: "none", //取消折点圆圈
-      type: "line",
-      smooth: true,
-      data: theta,
-    },
-    {
-      name: "Alpha",
-      symbol: "none", //取消折点圆圈
-      type: "line",
-      smooth: true,
-      data: alpha,
-    },
-    {
-      name: "Beta",
-      symbol: "none", //取消折点圆圈
-      type: "line",
-      smooth: true,
-      data: beta,
-    },
+        name: "Delta",
+        symbol: "none", //取消折点圆圈
+        type: "line",
+        smooth: true,
+        data: delta,
+      },
+      {
+        name: "Theta",
+        symbol: "none", //取消折点圆圈
+        type: "line",
+        smooth: true,
+        data: theta,
+      },
+      {
+        name: "Alpha",
+        symbol: "none", //取消折点圆圈
+        type: "line",
+        smooth: true,
+        data: alpha,
+      },
+      {
+        name: "Beta",
+        symbol: "none", //取消折点圆圈
+        type: "line",
+        smooth: true,
+        data: beta,
+      },
     ],
     animation: false,
   };
@@ -394,29 +394,29 @@ export function getRadarChartOption($params) {
         },
       },
       indicator: [{
-        name: "专注力平均值指数",
-        max: 100
-      },
-      {
-        name: "专注力广度指数",
-        max: 100
-      },
-      {
-        name: "专注力爆发指数",
-        max: 100
-      },
-      {
-        name: "专注力抗性指数",
-        max: 100
-      },
-      {
-        name: "专注力启动指数",
-        max: 100
-      },
-      {
-        name: "高专注力占比指数",
-        max: 100
-      },
+          name: "专注力平均值指数",
+          max: 100
+        },
+        {
+          name: "专注力广度指数",
+          max: 100
+        },
+        {
+          name: "专注力爆发指数",
+          max: 100
+        },
+        {
+          name: "专注力抗性指数",
+          max: 100
+        },
+        {
+          name: "专注力启动指数",
+          max: 100
+        },
+        {
+          name: "高专注力占比指数",
+          max: 100
+        },
       ],
       splitArea: {
         show: true,
@@ -440,8 +440,8 @@ export function getRadarChartOption($params) {
         // name: '实际开销(Actual Spending)'
         name: "专注力要素分析数据",
 
-      },],
-    },],
+      }, ],
+    }, ],
   };
   return $option;
 }
@@ -482,7 +482,7 @@ export function getPieChartsOption($pie_datas) {
           show: true,
         },
         data: $pie_datas["datas"],
-      },],
+      }, ],
     };
     return option;
   }
@@ -492,8 +492,7 @@ export function getPieChartsOption($pie_datas) {
 export function filterPieData(datas) {
   let $this = this;
   let legends = [];
-  let $att_region = [
-    {
+  let $att_region = [{
       min: 0,
       max: 20,
     },
@@ -585,7 +584,7 @@ export function getInterfereChartsOption(interfere_datas) {
         type: "line",
         large: true,
         areaStyle: {}
-      },],
+      }, ],
     }
     return option
   }
@@ -593,7 +592,7 @@ export function getInterfereChartsOption(interfere_datas) {
 
 //  能力调整 getAdjustmentChartsOption
 export function getAdjustmentChartsOption(interfere_datas) {
-  console.log('调整初始化', interfere_datas)
+  //   console.log('调整初始化', interfere_datas)
   if (interfere_datas) {
     let option = {
       color: '#F3A100',
@@ -638,7 +637,7 @@ export function getAdjustmentChartsOption(interfere_datas) {
         type: "line",
         large: true,
         areaStyle: {}
-      },],
+      }, ],
     }
     return option
   }