Selaa lähdekoodia

修改NaN参数传为0

plg 11 kuukautta sitten
vanhempi
commit
d6bdc8fbef

+ 6 - 1
src/renderer/components/AnimationDes.vue

@@ -642,7 +642,12 @@ export default {
           if (b > 100) {
             b = 100;
           }
-          this.attentionAnimation = parseFloat(b);
+          if (a == "NaN") {
+            this.attentionAnimation = 0;
+          } else {
+            this.attentionAnimation = parseFloat(b);
+          }
+
           this.HRV1 = [
             {
               name: "SDNN",

+ 26 - 19
src/renderer/components/AnimationDouble.vue

@@ -83,7 +83,7 @@
             >还剩{{ timeShow }}开始</span
           > -->
           <span
-          style="font-size: 12px; color: #1fd18e"
+            style="font-size: 12px; color: #1fd18e"
             v-show="buttonFlag == '结束' && gameTimeTimerFlag"
             >{{ timeShow }}</span
           >
@@ -841,7 +841,12 @@ export default {
           if (b > 100) {
             b = 100;
           }
-          this.attentionAnimation = parseFloat(b);
+          if (a == "NaN") {
+            this.attentionAnimation = 0;
+          } else {
+            this.attentionAnimation = parseFloat(b);
+          }
+
           this.HRV1 = [
             {
               name: "SDNN",
@@ -912,7 +917,12 @@ export default {
           if (b > 100) {
             b = 100;
           }
-          this.attentionSecondAnimation = parseFloat(b);
+          if (a == "NaN") {
+            this.attentionSecondAnimation = 0;
+          } else {
+            this.attentionSecondAnimation = parseFloat(b);
+          }
+
           this.HRV1 = [
             {
               name: "SDNN",
@@ -978,30 +988,27 @@ export default {
       //如果是普通就乘以0.9
       //如果是困难就乘以0.8
 
-      let a=null;
-      let b=null;
-      if(this.gameDifficulty==1){
-        a=parseFloat(this.attentionAnimation / 100);
-        b=parseFloat(this.attentionSecondAnimation / 100);
-      }else if(this.gameDifficulty==2){
-        a=parseFloat(this.attentionAnimation / 100)*0.9
-        b=parseFloat(this.attentionSecondAnimation / 100)*0.9;
-      }else if(this.gameDifficulty==3){
-        a=parseFloat(this.attentionAnimation / 100)*0.8
-        b=parseFloat(this.attentionSecondAnimation / 100)*0.8;
+      let a = null;
+      let b = null;
+      if (this.gameDifficulty == 1) {
+        a = parseFloat(this.attentionAnimation / 100);
+        b = parseFloat(this.attentionSecondAnimation / 100);
+      } else if (this.gameDifficulty == 2) {
+        a = parseFloat(this.attentionAnimation / 100) * 0.9;
+        b = parseFloat(this.attentionSecondAnimation / 100) * 0.9;
+      } else if (this.gameDifficulty == 3) {
+        a = parseFloat(this.attentionAnimation / 100) * 0.8;
+        b = parseFloat(this.attentionSecondAnimation / 100) * 0.8;
       }
 
-      let one =
-       a +
-        "," +
-        b;
+      let one = a + "," + b;
       // console.log(one);
       //当按钮状态是结束时
       if (this.buttonFlag == "结束") {
         this.send(one);
         let left = `Player1,${this.userLink.num}, ${a},${this.userLink.mac}`;
         let right = `Player2,${this.userTwoLink.num},${b},${this.userTwoLink.mac}`;
-        this.sendTarget(left,right);
+        this.sendTarget(left, right);
       }
     },
     sendTarget(valLeft, valRight) {