[plg137200.] 1 年間 前
コミット
9d93859981
1 ファイル変更40 行追加9 行削除
  1. 40 9
      src/renderer/components/AnimationDes.vue

+ 40 - 9
src/renderer/components/AnimationDes.vue

@@ -236,8 +236,8 @@ export default {
       widthIframe: 900,
       widthIframe: 900,
       heightIframe: 600,
       heightIframe: 600,
       // this.urlThreeP = "../../../static/BuildFlower/index.html";
       // this.urlThreeP = "../../../static/BuildFlower/index.html";
-      // urlThreeP: "../../../static/candle/index.html",
-      urlThreeP: __static + "/candle/index.html",
+      urlThreeP: "../../../static/candle/index.html",
+      // urlThreeP: __static + "/candle/index.html",
       flag: 1,
       flag: 1,
       //游戏场景
       //游戏场景
       gameScene: 1,
       gameScene: 1,
@@ -366,10 +366,9 @@ export default {
     window.addEventListener("resize", function () {
     window.addEventListener("resize", function () {
       // that.getSize();
       // that.getSize();
       if (flagAnimation) {
       if (flagAnimation) {
-        
         setTimeout(() => {
         setTimeout(() => {
           that.getSize();
           that.getSize();
-           that.echartsOne.resize();
+          that.echartsOne.resize();
           that.echartsTwo.resize();
           that.echartsTwo.resize();
           that.echartsThree.resize();
           that.echartsThree.resize();
           flagAnimation = true;
           flagAnimation = true;
@@ -395,7 +394,7 @@ export default {
         }
         }
       } else {
       } else {
         if (arg["_c"].size == 11) {
         if (arg["_c"].size == 11) {
-          console.log(arg);
+          // console.log(arg);
           // 当不为undefined时
           // 当不为undefined时
           let ll = 11;
           let ll = 11;
           // 获取长度
           // 获取长度
@@ -409,6 +408,11 @@ export default {
           if (this.noiseData.length > ll) {
           if (this.noiseData.length > ll) {
             this.noiseData.shift();
             this.noiseData.shift();
           }
           }
+          // this.send(arg["_c"].get("Attention")/100)
+          //先设为随机数
+
+          // this.send(Math.random()*10)
+          // console.log(arg["_c"].get("Attention")/100)
           this.attentionData.push(arg["_c"].get("Attention"));
           this.attentionData.push(arg["_c"].get("Attention"));
           this.attentionDataAll.push(arg["_c"].get("Attention"));
           this.attentionDataAll.push(arg["_c"].get("Attention"));
           if (this.attentionData.length > ll) {
           if (this.attentionData.length > ll) {
@@ -493,6 +497,7 @@ export default {
     //进行解析脑电数据
     //进行解析脑电数据
 
 
     linkFun(index, val) {
     linkFun(index, val) {
+      console.log(val)
       // debugger;
       // debugger;
       let that = this;
       let that = this;
       that.$http.postTmp(
       that.$http.postTmp(
@@ -507,8 +512,18 @@ export default {
           // debugger;
           // debugger;
           if (res.data.code == 200) {
           if (res.data.code == 200) {
             this.linkIndex = index;
             this.linkIndex = index;
-            that.openData();
-            this.$message.success("设备连接成功");
+
+            //如果是脑电的话直接调用打开数据接口
+            //如果是心电需要先调用写入输入数据-发送指令接口
+
+            if (val.Name == "BW-ECG-01") {
+              this.writeData(val);
+            } else {
+              //脑电的情况下
+              that.openData();
+              this.$message.success("设备连接成功");
+            }
+
             // that.tableData = res.data;
             // that.tableData = res.data;
             // that.totolSize = res.data.totalElements;
             // that.totolSize = res.data.totalElements;
           } else {
           } else {
@@ -518,6 +533,22 @@ export default {
         }
         }
       );
       );
     },
     },
+    //写入数据--发送指令
+    writeData(val) {
+      let that = this;
+      let userName= sessionStorage.getItem("name");
+      that.$http.postTmp(`/v1/device/write/data`, {mac:val.MAC,userName:userName}, (res) => {
+        // debugger;
+        that.openData();
+        console.log(res);
+        if (res.code == 200) {
+          // that.scanData = res.data;
+          // that.totolSize = res.data.totalElements;
+        } else {
+          this.$message.error("访问服务器失败!");
+        }
+      });
+    },
     //打开数据接口
     //打开数据接口
     openData() {
     openData() {
       let that = this;
       let that = this;
@@ -895,8 +926,8 @@ export default {
       this.clearDataFun();
       this.clearDataFun();
       switch (val) {
       switch (val) {
         case 1:
         case 1:
-          // this.urlThreeP = "../../../static/candle/index.html";
-          this.urlThreeP = __static + "/candle/index.html";
+          this.urlThreeP = "../../../static/candle/index.html";
+          // this.urlThreeP = __static + "/candle/index.html";
           this.delayTime();
           this.delayTime();
           break;
           break;
         case 2:
         case 2: