Sfoglia il codice sorgente

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

智方网络_吖荣 4 anni fa
parent
commit
e84690fe7f

+ 14 - 6
src/components/device/device.vue

@@ -23,7 +23,10 @@
         </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"
@@ -70,7 +73,10 @@
       </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"
@@ -85,7 +91,11 @@
                   : '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>
@@ -93,8 +103,7 @@
       </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"
@@ -278,7 +287,6 @@ export default {
                 }
               },
             });
-
           }
         },
       });

+ 4 - 4
src/pages/competition/index.vue

@@ -153,7 +153,7 @@
             <van-row>
               <van-col span="8">
                 <img
-                  src="https://img.shuimuai.com/yu_sai_rank_may_1.png"
+                  src="https://img.shuimuai.com/yu_sai_rank_june_23_1.png"
                   alt=""
                   class="rank_card"
                   @click="changeRankAction(1)"
@@ -167,7 +167,7 @@
               </van-col>
               <van-col span="8">
                 <img
-                  src="https://img.shuimuai.com/raise_rank_may_1.png"
+                  src="https://img.shuimuai.com/raise_rank_june_23.png"
                   alt=""
                   class="rank_card"
                   @click="changeRankAction(2)"
@@ -181,7 +181,7 @@
               </van-col>
               <van-col span="8">
                 <img
-                  src="https://img.shuimuai.com/final_rank_may_1.png"
+                  src="https://img.shuimuai.com/final_rank_june_23.png"
                   alt=""
                   class="rank_card"
                   @click="changeRankAction(3)"
@@ -1000,7 +1000,7 @@ page {
 
 .index_container {
   /* background: url("https://img.shuimuai.com//mp/pk/background_3%402x.png");  小乌龟 */
-  background: url("https://img.shuimuai.com/mppkbackground_May_7.png");
+  background: url("https://img.shuimuai.com/mppkbackground_june_23_2.png");
 
   background-size: 100% 100%;
   background-position: center;

+ 68 - 19
src/pages/start/index.vue

@@ -3,7 +3,10 @@
     <!--    计费面板模块-->
     <div class="game_panel padding-top-sm">
       <van-row gutter="16">
-        <van-col span="8" offset="2">
+        <van-col
+          span="8"
+          offset="2"
+        >
           <view class="text-sm">
             <text class="title">本次游玩时间</text>
           </view>
@@ -11,7 +14,10 @@
             <text class="count_down_text">{{ played_time_text }}</text>
           </view>
         </van-col>
-        <van-col span="10" offset="4">
+        <van-col
+          span="10"
+          offset="4"
+        >
           <view class="text-sm">
             <text class="title">计费模式</text>
             <text class="type padding-left-sm">{{ mode_item.name }}</text>
@@ -34,7 +40,10 @@
     <!--    设备状态-->
     <div class="game_status padding-tb">
       <van-row>
-        <van-col span="10" offset="2">
+        <van-col
+          span="10"
+          offset="2"
+        >
           <div
             class="flex flex-direction align-center justify-center"
             v-if="device_bg"
@@ -46,7 +55,10 @@
             />
             <text class="text-default">已经正确佩戴</text>
           </div>
-          <div class="flex flex-direction align-center justify-center" v-else>
+          <div
+            class="flex flex-direction align-center justify-center"
+            v-else
+          >
             <img
               src="https://img.shuimuai.com/web/touhuanzhuangtai_3.png"
               alt=""
@@ -254,7 +266,7 @@ export default {
     //游戏结束方法
     game_finished() {
       bluetooth.sendEnd();
-      
+
       $this.$emit("closePop", true);
       //取消监听低功耗蓝牙设备
       wx.offBLECharacteristicValueChange();
@@ -280,7 +292,7 @@ export default {
         forbidClick: true,
         mask: true,
         message: "正在生成报告...",
-        duration: 0
+        duration: 0,
       });
     },
     to_report() {
@@ -299,19 +311,17 @@ export default {
         keepScreenOn: true,
       });
 
-
       bluetooth.watchingDevice($this);
       bluetooth.sendControl();
     },
 
     // ArrayBuffer转16进度字符串示例
     ab2hex(buffer) {
-      var hexArr = Array.prototype.map.call(
-        new Uint8Array(buffer),
-        function (bit) {
-          return ("00" + bit.toString(16)).slice(-2);
-        }
-      );
+      var hexArr = Array.prototype.map.call(new Uint8Array(buffer), function(
+        bit
+      ) {
+        return ("00" + bit.toString(16)).slice(-2);
+      });
       return hexArr.join("");
     },
     // 往后端推送一次定时数据
@@ -409,13 +419,53 @@ export default {
       });
     },
     //  处理游戏中数据的方法
-    do_datas: function ($data) {
+    do_datas: function($data) {
+      var $delta =
+        Math.round($data["delta"]) > 10000
+          ? parseInt(
+              Math.round($data["delta"])
+                .toString()
+                .slice(0, 4)
+            )
+          : Math.round($data["delta"]);
+      var $alpha =
+        Math.round($data["alpha"]) > 1000
+          ? Math.round($data["alpha"])
+              .toString()
+              .slice(0, 4)
+          : Math.round($data["alpha"]);
+      var $theta =
+        Math.round($data["theta"]) > 1000
+          ? Math.round($data["theta"])
+              .toString()
+              .slice(0, 4)
+          : Math.round($data["theta"]);
+      var $beta =
+        Math.round($data["theta"]) > 1000
+          ? Math.round($data["delta"])
+              .toString()
+              .slice(0, 4)
+          : Math.round($data["beta"]);
       $this.att_list.push($data["att"]);
       $this.med_list.push($data["med"]);
-      $this.delta_list.push(Math.round($data["delta"] / 10000));
-      $this.alpha_list.push(Math.round($data["alpha"] / 10000));
-      $this.theta_list.push(Math.round($data["theta"] / 10000));
-      $this.beta_list.push(Math.round($data["beta"]) / 10000);
+      // $this.delta_list.push(Math.round($data["delta"]));
+      // $this.alpha_list.push(Math.round($data["alpha"] / 10000));
+      // $this.theta_list.push(Math.round($data["theta"]));
+      // $this.beta_list.push(Math.round($data["beta"]) / 10000);
+      $this.delta_list.push($delta);
+      // $this.delta_list.push(8888);
+      $this.alpha_list.push($alpha);
+      $this.theta_list.push($theta);
+      $this.beta_list.push($beta);
+      console.log(
+        "游戏中的4个基本脑波 ----------------------------",
+        $delta,
+        $alpha,
+        $theta,
+        $beta,
+        "delta",
+        $this.delta_list
+      );
 
       if ($this.att_list.length > 50) {
         $this.att_list.shift();
@@ -502,7 +552,6 @@ export default {
     //         message: '智脑环已断开连接,请重新扫码智脑环',
     //         duration: 0,
     //       });
-
   },
   created() {
     $this = this;

+ 11 - 9
src/utils/bluetooth.js

@@ -94,10 +94,10 @@ export default {
       ("0x" + $low_beta_3);
     //Beta数据
     let $beta = parseInt(($high_beta << 8) | $low_beta, 16);
-    console.log("delta: "+$delta,
-      "heta: "+ $theta,
-      "alpha: "+ $alpha,
-      "beta: "+ $beta,);
+    console.log("delta: " + $delta,
+      "heta: " + $theta,
+      "alpha: " + $alpha,
+      "beta: " + $beta);
     return {
       att: $att,
       med: $med,
@@ -143,7 +143,9 @@ export default {
             duration: 0,
             message: '智脑环已断开连接,请重新扫码智脑环'
           });
-          game_store.setters.setGameStatus(0);
+          // game_store.setters.setGameStatus(0);
+          // 结束状态更改为1
+          game_store.setters.setGameCloseStatus(1);
 
 
         }
@@ -263,17 +265,17 @@ export default {
           let $hex = $this.toy_item["hex"].substr($this.toy_item["hex"].length - 2, 2);
           if (hexStr.substr(8, 2) == $hex) {
             wx.showToast({
-              title:"已连接到"+$this.toy_item.name
+              title: "已连接到" + $this.toy_item.name
             });
             $this.change_toy_connect_status(2);
-          }else if(hexStr.substr(8, 2) == "00"){
-                    $this.change_toy_connect_status(3);
+          } else if (hexStr.substr(8, 2) == "00") {
+            $this.change_toy_connect_status(3);
           }
         }
       }
 
       //暂停脑控,切断教具连接
-      if(hexStr.substr(0, 8).toLowerCase() == "aadd0900"){
+      if (hexStr.substr(0, 8).toLowerCase() == "aadd0900") {
         this.shutdownSendControl();
       }
 

+ 89 - 88
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,
   };
@@ -171,9 +171,10 @@ function getLineOption(lineData_att, lineData_med) {
 
 // 基本脑波图
 function getBaseOption(delta, theta, alpha, beta) {
+  console.log('delta是否有值~~~~~~~', delta)
   const that = this;
   var option = {
-    color: ["#4b8cb4", "#ed4b59", "#fdb64b", "#F6CB90"],
+    color: ["#00ccff", "#0cda2e", "#f8a117", "#d1d310"],
     legend: {
       data: ["Delta", "Theta", "Alpha", "Beta"],
       left: "center",
@@ -241,33 +242,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 +395,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 +441,8 @@ export function getRadarChartOption($params) {
         // name: '实际开销(Actual Spending)'
         name: "专注力要素分析数据",
 
-      }, ],
-    }, ],
+      },],
+    },],
   };
   return $option;
 }
@@ -482,7 +483,7 @@ export function getPieChartsOption($pie_datas) {
           show: true,
         },
         data: $pie_datas["datas"],
-      }, ],
+      },],
     };
     return option;
   }
@@ -493,25 +494,25 @@ export function filterPieData(datas) {
   let $this = this;
   let legends = [];
   let $att_region = [{
-      min: 0,
-      max: 20,
-    },
-    {
-      min: 21,
-      max: 40,
-    },
-    {
-      min: 41,
-      max: 60,
-    },
-    {
-      min: 61,
-      max: 80,
-    },
-    {
-      min: 81,
-      max: 100,
-    },
+    min: 0,
+    max: 20,
+  },
+  {
+    min: 21,
+    max: 40,
+  },
+  {
+    min: 41,
+    max: 60,
+  },
+  {
+    min: 61,
+    max: 80,
+  },
+  {
+    min: 81,
+    max: 100,
+  },
   ];
   datas.forEach(($val, $index) => {
     legends.push(
@@ -584,7 +585,7 @@ export function getInterfereChartsOption(interfere_datas) {
         type: "line",
         large: true,
         areaStyle: {}
-      }, ],
+      },],
     }
     return option
   }
@@ -637,7 +638,7 @@ export function getAdjustmentChartsOption(interfere_datas) {
         type: "line",
         large: true,
         areaStyle: {}
-      }, ],
+      },],
     }
     return option
   }