Browse Source

修改游戏指标

plg 11 months ago
parent
commit
bce72677f5
2 changed files with 174 additions and 8 deletions
  1. 85 4
      src/renderer/components/AnimationDes.vue
  2. 89 4
      src/renderer/components/AnimationDouble.vue

+ 85 - 4
src/renderer/components/AnimationDes.vue

@@ -32,6 +32,23 @@
             </el-option>
           </el-select>
           &nbsp;&nbsp;&nbsp;&nbsp;
+          <span class="desSty">游戏指标</span>&nbsp;
+          <el-select
+            v-model="gameTarget"
+            placeholder="请选择"
+            class="selectSty"
+            size="mini"
+            @change="gameDiffFun"
+          >
+            <el-option
+              v-for="item in gameTargetObj"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+          &nbsp;&nbsp;&nbsp;&nbsp;
           <span class="desSty">游戏难度</span>&nbsp;
           <el-select
             v-model="gameDifficulty"
@@ -283,6 +300,25 @@ export default {
       widthIframe: 900,
       heightIframe: 600,
 
+      //游戏指标
+      //1表示专注度指标
+      //2表示放松度指标
+      //3表示rmssd指标//心率变异性
+      gameTarget: 1,
+      gameTargetObj: [
+        {
+          value: 1,
+          label: "专注度",
+        },
+        {
+          value: 2,
+          label: "放松度",
+        },
+        {
+          value: 3,
+          label: "心率变异性",
+        },
+      ],
       flag: 1,
       //游戏场景
       gameScene: 1,
@@ -508,6 +544,21 @@ export default {
     that.listTimeFlag = setInterval(that.connectList, 6000);
     that.timeSendFlag = setInterval(that.sendAtten, 1000);
     that.ecgTimeFlag = setInterval(that.readFile, 5000);
+
+    //刚进来后判断选的是脑电还是心电
+    if (this.equipment == 1) {
+      this.gameTargetObj = [
+        {
+          value: 1,
+          label: "专注度",
+        },
+        {
+          value: 2,
+          label: "放松度",
+        },
+      ];
+      this.gameTarget = 1;
+    }
   },
   beforeDestroy() {
     clearTimeout(this.mergeTimeFlag);
@@ -747,13 +798,19 @@ export default {
             }
 
             //记录脑电指标
-            this.attentionAnimation = arg["_c"].get("Attention");
-
+            //当时专注度时
+            if (this.gameTarget == 1) {
+              this.attentionAnimation = arg["_c"].get("Attention");
+            }
             this.attentionData.push(arg["_c"].get("Attention"));
             this.attentionDataAll.push(arg["_c"].get("Attention"));
             if (this.attentionData.length > ll) {
               this.attentionData.shift();
             }
+            //当前选项时放松度时
+            if (this.gameTarget == 2) {
+              this.attentionAnimation = arg["_c"].get("Meditation");
+            }
             this.meditationData.push(arg["_c"].get("Meditation"));
             this.meditationDataAll.push(arg["_c"].get("Meditation"));
             if (this.meditationData.length > ll) {
@@ -1301,6 +1358,30 @@ export default {
     equipmentFun(val) {
       //将发送的数据改为0
       this.attentionAnimation = 0;
+
+      //判断当前是脑电还是心电
+      if (val == 1) {
+        this.gameTargetObj = [
+          {
+            value: 1,
+            label: "专注度",
+          },
+          {
+            value: 2,
+            label: "放松度",
+          },
+        ];
+        this.gameTarget = 1;
+      } else {
+        this.gameTargetObj = [
+          {
+            value: 3,
+            label: "心率变异性",
+          },
+        ];
+        this.gameTarget = 3;
+      }
+
       //先判断当选择的设备是否连接
       //如果已连接,则继续测试
       //如果未连接则提示连接设备
@@ -1766,7 +1847,7 @@ export default {
           text: "心电信号",
           subtext: "",
           left: "center",
-          bottom:'20'
+          bottom: "20",
         },
         grid: {
           bottom: 80,
@@ -2491,7 +2572,7 @@ canvas {
 .dialog_bo .el-dialog {
   background: #efefef !important ;
 }
-.dialog_bo .el-dialog__title{
+.dialog_bo .el-dialog__title {
   line-height: 20px;
   font-size: 20px;
   color: #303133;

+ 89 - 4
src/renderer/components/AnimationDouble.vue

@@ -23,6 +23,24 @@
             >
             </el-option>
           </el-select>
+
+          &nbsp;&nbsp;&nbsp;&nbsp;
+          <span class="desSty">游戏指标</span>&nbsp;
+          <el-select
+            v-model="gameTarget"
+            placeholder="请选择"
+            class="selectSty"
+            size="mini"
+            @change="gameDiffFun"
+          >
+            <el-option
+              v-for="item in gameTargetObj"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
           &nbsp;&nbsp;&nbsp;&nbsp;
           <span class="desSty">游戏难度</span>&nbsp;
           <el-select
@@ -393,10 +411,27 @@ export default {
       pulseFlag: "未连接",
       widthIframe: 900,
       heightIframe: 600,
+      //游戏指标
+      gameTarget: 1,
+      gameTargetObj: [
+        {
+          value: 1,
+          label: "专注度",
+        },
+        {
+          value: 2,
+          label: "放松度",
+        },
+        {
+          value: 3,
+          label: "心率变异性",
+        },
+      ],
 
       flag: 1,
       //游戏场景
       gameScene: 1,
+
       optionsGame: [
         {
           value: 1,
@@ -707,6 +742,21 @@ export default {
     that.attentionTime = setInterval(that.sendAtten, 1000);
 
     that.ecgTimeFlag = setInterval(that.readFile, 5000);
+
+    //刚进来后判断选的是脑电还是心电
+    if (this.equipment == 1) {
+      this.gameTargetObj = [
+        {
+          value: 1,
+          label: "专注度",
+        },
+        {
+          value: 2,
+          label: "放松度",
+        },
+      ];
+      this.gameTarget = 1;
+    }
   },
   beforeDestroy() {
     clearTimeout(this.attentionTime);
@@ -1121,12 +1171,18 @@ export default {
 
             // this.send(Math.random()*10)
             // console.log(arg["_c"].get("Attention")/100)
-            this.attentionAnimation = arg["_c"].get("Attention");
+            if (this.gameTarget == 1) {
+              this.attentionAnimation = arg["_c"].get("Attention");
+            }
+
             this.attentionData.push(arg["_c"].get("Attention"));
             this.attentionDataAll.push(arg["_c"].get("Attention"));
             if (this.attentionData.length > ll) {
               this.attentionData.shift();
             }
+            if (this.gameTarget == 2) {
+              this.attentionAnimation = arg["_c"].get("Meditation");
+            }
             this.meditationData.push(arg["_c"].get("Meditation"));
             this.meditationDataAll.push(arg["_c"].get("Meditation"));
             if (this.meditationData.length > ll) {
@@ -1321,12 +1377,18 @@ export default {
             // console.log(arg["_c"].get("Attention")/100)
 
             //设置一个公共变量 注意力的公共变量
-            this.attentionSecondAnimation = arg["_c"].get("Attention");
+            if (this.gameTarget == 1) {
+              this.attentionSecondAnimation = arg["_c"].get("Attention");
+            }
+
             this.attentionDataSecond.push(arg["_c"].get("Attention"));
             this.attentionDataAllSecond.push(arg["_c"].get("Attention"));
             if (this.attentionDataSecond.length > ll) {
               this.attentionDataSecond.shift();
             }
+            if (this.gameTarget == 2) {
+              this.attentionSecondAnimation = arg["_c"].get("Meditation");
+            }
             this.meditationDataSecond.push(arg["_c"].get("Meditation"));
             this.meditationDataAllSecond.push(arg["_c"].get("Meditation"));
             if (this.meditationDataSecond.length > ll) {
@@ -1960,6 +2022,29 @@ export default {
       this.attentionAnimation = 0;
       //脑电--第二个人的测试数据
       this.attentionSecondAnimation = 0;
+
+      //判断当前是脑电还是心电
+      if (val == 1) {
+        this.gameTargetObj = [
+          {
+            value: 1,
+            label: "专注度",
+          },
+          {
+            value: 2,
+            label: "放松度",
+          },
+        ];
+        this.gameTarget = 1;
+      } else {
+        this.gameTargetObj = [
+          {
+            value: 3,
+            label: "心率变异性",
+          },
+        ];
+        this.gameTarget = 3;
+      }
       //先判断当选择的设备是否连接
       //如果已连接,则继续测试
       //如果未连接则提示连接设备
@@ -2421,7 +2506,7 @@ export default {
           text: "心电信号",
           subtext: "",
           left: "center",
-          bottom:'20'
+          bottom: "20",
         },
         grid: {
           bottom: 80,
@@ -2511,7 +2596,7 @@ export default {
           text: "心电信号",
           subtext: "",
           left: "center",
-          bottom:'20'
+          bottom: "20",
         },
         grid: {
           bottom: 80,