[plg137200.] 1 gadu atpakaļ
vecāks
revīzija
2da4b47cb9

+ 4 - 4
src/main/index.js

@@ -58,11 +58,11 @@ let loadingWindow
 //设置访问路径
 //打包访问的路径
 
-let serveUrl = "./resources/exe"
-let serveUrlJar = '\\resources\\exe'
+// let serveUrl = "./resources/exe"
+// let serveUrlJar = '\\resources\\exe'
 //本地访问的路径
-// let serveUrl = "./exe"
-// let serveUrlJar = '\\exe'
+let serveUrl = "./exe"
+let serveUrlJar = '\\exe'
 /**
  * Set `__static` path to static files in production
  * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html

+ 144 - 149
src/renderer/components/AnimationDes.vue

@@ -113,7 +113,7 @@
             >{{ buttonFlag }}</el-button
           >
         </div>
-
+        <el-button @click="send"></el-button>
         <el-row> </el-row>
         <el-row> </el-row>
         <el-row>
@@ -178,10 +178,10 @@
                 class="xl_d_button"
                 size="mini"
                 slot="reference"
-                @click="linkJudge(scope.$index, scope.row, scope.row.connent)"
+                @click="linkJudge(scope.$index, scope.row, scope.row.connect)"
               >
-                <span v-if="scope.row.connent">断开连接</span
-                ><span v-if="!scope.row.connent">连接</span></el-button
+                <span v-if="scope.row.connect">断开连接</span
+                ><span v-if="!scope.row.connect">连接</span></el-button
               >
             </template>
           </el-table-column>
@@ -386,7 +386,9 @@ export default {
       // 全量
       focusNaoAll: [],
       // urlThreeP: "../../../static/candle/index.html",
-      urlThreeP: __static + "/candle/index.html",
+      // urlThreeP: __static + "/candle/index.html",
+      urlThreeP: "../../../static/balance/index.html",
+      // urlThreeP: __static + "/balance/index.html",
       // pubSrc: "../../../static",
       pubsrc: __static,
       userLink: {
@@ -421,6 +423,9 @@ export default {
       //按钮状态
       disabledTimeFlag: null,
       intervalLength: 500,
+
+      //新增已选列表变量
+      isSelectedList: [],
     };
   },
   mounted() {
@@ -464,10 +469,10 @@ export default {
     setTimeout(() => {
       that.getSize();
     }, 5000);
-    setTimeout(() => {
-      that.changeGame(parseInt(that.$route.query.gameType));
-      console.log(that.$route.query.gameType);
-    }, 3000);
+    // setTimeout(() => {
+    //   that.changeGame(parseInt(that.$route.query.gameType));
+    //   console.log(that.$route.query.gameType);
+    // }, 3000);
     that.singleFlag = that.$route.query.single;
     console.log(that.singleFlag);
 
@@ -475,7 +480,7 @@ export default {
     this.initWebsocket();
     //当点击开始时调用方法开发发送游戏数据
     //上来就查询已连接列表
-    
+
     //根据扫描列表和已连接列表看看哪些是重复的//重复的就是已连接的
     that.mergeTimeFlag = setInterval(that.mergeDataFun, 1000);
     //进入页面就开始扫描
@@ -483,8 +488,6 @@ export default {
     //进入生物反馈页面扫描设备
     this.queryScan();
     that.listTimeFlag = setInterval(that.connectList, 2000);
-
-    
   },
   beforeDestroy() {
     //关闭扫描
@@ -505,7 +508,12 @@ export default {
   methods: {
     //合并数据
     mergeDataFun() {
+      console.log(this.scanData);
+      console.log(this.connectedData);
       let that = this;
+
+      //先选出扫描列表
+      //list为扫描列表
       let scanDataTmp = JSON.stringify(this.scanData);
       let scanDataTmpFin = JSON.parse(scanDataTmp);
 
@@ -515,7 +523,7 @@ export default {
           rssi: "",
           name: "",
           mac: "",
-          connent: false,
+          connect: false,
           type: "",
           ai: "",
           at: "",
@@ -523,7 +531,7 @@ export default {
         obj.rssi = scanDataTmpFin[i].rssi;
         obj.name = scanDataTmpFin[i].name;
         obj.mac = scanDataTmpFin[i].mac;
-        obj.connent = false;
+        obj.connect = false;
         obj.type = scanDataTmpFin[i].type;
         obj.ai = scanDataTmpFin[i].ai;
         obj.at = scanDataTmpFin[i].at;
@@ -549,7 +557,11 @@ export default {
       //已选列表
       let connectedDataTmp = JSON.stringify(this.connectedData);
       let connectedDataTmpFin = JSON.parse(connectedDataTmp);
+
+      //知道了已选列表
+      //在已选列表中找到与扫描列表不同的对象
       //不包含的列表
+      //以下listBarring是已选列表中且与扫描列表不同的
       let listBarring = [];
       for (let i = 0; i < connectedDataTmpFin.length; i++) {
         let flag = false;
@@ -563,10 +575,12 @@ export default {
         }
       }
 
+      //在找出扫描列表与已选列表相同的,将已选列表的数据同步给扫描列表
+
       for (let i = 0; i < list.length; i++) {
         for (let j = 0; j < connectedDataTmpFin.length; j++) {
           if (list[i].mac == connectedDataTmpFin[j].mac) {
-            list[i].connent = true;
+            list[i].connect = true;
             list[i].rssi = connectedDataTmpFin[j].rssi;
           }
         }
@@ -574,7 +588,7 @@ export default {
       //然后合并两个数组
 
       let listFin = list.concat(listBarring);
-      console.log("------1111111111111111111");
+      console.log("合并后的数据组");
       console.log(listFin);
       //判断当前选择的是脑电还是心电
       let currentDeviceList = [];
@@ -765,9 +779,9 @@ export default {
       that.$http.postTmp(
         `/v2/device/conn`,
         {
-          ai: val.ai+'',
+          ai: val.ai + "",
           mac: val.mac,
-          at: val.at+'',
+          at: val.at + "",
         },
         (res) => {
           that.disableStatus();
@@ -775,23 +789,12 @@ export default {
             // this.linkIndex = index;
             //如果是脑电的话直接调用打开数据接口
             //如果是心电需要先调用写入输入数据-发送指令接口
-
+            that.userLink.mac = val.mac;
             if (val.type == "1") {
-              // this.writeData(val);
-              that.userLink.mac = val.mac;
-            } else {
-              //判断脑电设备
-
-              //脑电的情况下
-              //记录下当前mac,
-              that.userLink.mac = val.mac;
-              //然后调用已连接列表确定改mac是否存在在列表中,如果已存在则表示该设备已连接
-
-              // that.openData();
-              // this.$message.success("设备连接成功");
+              this.writeData(val);
+              // that.userLink.mac = val.mac;
             }
-            // that.tableData = res.data;
-            // that.totolSize = res.data.totalElements;
+            // this.$message.success("设备连接成功");
           } else {
             // this.$message.error("访问服务器失败!");
             this.$message.error(res.data.message);
@@ -804,7 +807,7 @@ export default {
       let that = this;
       let userName = sessionStorage.getItem("name");
       that.$http.postTmp(
-        `/v1/device/write/data`,
+        `/v2/device/write/data`,
         { mac: val.mac, userName: userName },
         (res) => {
           // that.openData();
@@ -838,8 +841,9 @@ export default {
     disconnectEquipment(val) {
       let that = this;
       that.buttonLinkFlag = true;
-      that.$http.getTmp(`v1/device/${val.mac}/disconnect`, {}, (res) => {
+      that.$http.postTmp(`v2/device/dis/conn`, { mac: val.mac }, (res) => {
         that.disableStatus();
+        debugger;
         if (res.code == 200) {
           //关闭连接的时候看是不是当前绑定的mac与用户的mac是否相同
           //如果相同则  连接标志变为false;
@@ -862,52 +866,6 @@ export default {
       that.$http.getTmp(`v2/device/connected/list`, {}, (res) => {
         // console.log(res)
         //判断当前的列表是否存在该用户已点击的列表
-        if (res.code == 200) {
-          if (res.data) {
-            if (res.data) {
-              let list = [];
-              for (let i = 0; i < res.data.length; i++) {
-                let obj = {
-                  rssi: "",
-                  name: "",
-                  mac: "",
-                  connent: false,
-                  deviceType: "",
-                };
-                obj.rssi = "";
-                obj.name = res.data[i].Name;
-                obj.mac = res.data[i].MAC;
-                obj.connent = true;
-                obj.deviceType = res.data[i].DeviceType;
-                obj.userNum = "";
-                list.push(obj);
-              }
-              that.connectedData = list;
-              // console.log(list);
-              if (list.length == 0) {
-                //表示未连接
-                that.linkStatus = false;
-              } else {
-                //标识已连接
-                for (let k = 0; k < list.length; k++) {
-                  if (
-                    that.userLink.mac !== "" &&
-                    that.userLink.mac == list[k].mac
-                  ) {
-                    that.linkStatus = true;
-                  }
-                }
-              }
-            }
-          } else {
-            that.connectedData = [];
-          }
-          //打开数据接口
-          // that.tableData = res.data;
-          // that.totolSize = res.data.totalElements;
-        } else {
-          // this.$message.error("访问服务器失败!");
-        }
       });
     },
     typeFormatter(val) {
@@ -954,7 +912,7 @@ export default {
     initWebsocket() {
       // const wsuri = "ws://192.168.1.103:8000/ws?uid=client&to_uid=server";
       // const wsuri = "ws://localhost:8000/ws?uid=client&to_uid=server";
-      const wsuri = "ws://192.168.1.102:8000/ws?uid=client&to_uid=server";
+      const wsuri = "ws://192.168.1.100:8000/ws?uid=client&to_uid=server";
       this.websock = new WebSocket(wsuri);
       this.websock.onmessage = this.websocketonmessage;
       this.websock.onopen = this.websocketonopen;
@@ -979,83 +937,118 @@ export default {
       //数据接收
       const redata = JSON.parse(e.data);
       console.log(redata);
-      // console.log(redata);
       if (
         redata.content != "开启扫描成功" &&
         redata.content != "设置过滤成功" &&
         redata.content != "Successful connection to socket service" &&
         redata.content != "关闭扫描成功" &&
-        redata.content != "设置UUID成功"&&
+        redata.content != "设置UUID成功" &&
         redata.content != "设备连接成功"
       ) {
         //首先判断是否redata.content是否是未定义
         // console.log(redata.content)
         if (redata.hasOwnProperty("content")) {
-          let dataLin = JSON.parse(redata.content);
-          if (redata.msgType == "device") {
-            // let dataLin = JSON.parse(redata.content);
-            console.log("-------------");
-            console.log(dataLin);
-            let a = {
-              mac: dataLin.m,
-              name: dataLin.n,
-              rssi: dataLin.rssi,
-              ai: dataLin.ai,
-              at: dataLin.at,
-              type: dataLin.t, //当type为1时为心电
-            };
-            that.changeList(a);
-            //获取到很多数据,取每秒最大的包含量
-          } else if (redata.msgType == "eegData") {
-            // let dataLin = JSON.parse(redata.content);
-            // console.log(dataLin);
-            console.log("11111111111111111111");
-            console.log(dataLin.value);
-            ///先判断第一个用户是否有mac---有mac代表已连接
-            if (that.userLink.mac !== "" && that.userLink.mac == dataLin.id) {
-              ipcRenderer.send("asynchronoushrv-naoData", {
-                value: dataLin.value,
-                mac: dataLin.id,
-              });
-            }
-            if (
-              that.userTwoLink.mac !== "" &&
-              that.userTwoLink.mac == dataLin.id
-            ) {
-              ipcRenderer.send("asynchronoushrv-naoTwoData", {
-                value: dataLin.value,
-                mac: dataLin.id,
-              });
-            }
-            //判断第二个用户的mac是否有,有则代表已连接  --
-          } else if (redata.msgType == "ecgData") {
-            //判断该数据对应的mac是否是当前绑定过用户的
-            //判断当前是否是绑定该用户的数据,是的话进行用户处理
-            //接到数据进行处理
-            //当该用户的mac与id相同时,取这个数据
-            // console.log(dataLin.id === that.userLink.mac);
-            if (dataLin.id === that.userLink.mac) {
-              let list = dataLin.value.split(",");
-              // console.log(list)
-              list.forEach((item) => {
-                let tmp = parseInt(item);
-                that.userLink.ecgAllList.push(tmp);
-                that.userLink.ecgSectionList.push(tmp);
-                if (that.userLink.ecgSectionList.length > that.intervalLength) {
-                  that.userLink.ecgSectionList.shift();
-                }
-                if (that.userLink.ecgAllList.length % 100 == 0) {
-                  // console.log(that.ecgAllList.length);
-                  if (that.echartsVisible) {
-                    that.renderEcgOne();
+          if (redata.content != "") {
+            let dataLin = JSON.parse(redata.content);
+
+            if (redata.msgType == "device") {
+              // let dataLin = JSON.parse(redata.content);
+              console.log("-------------");
+              console.log(dataLin);
+              let a = {
+                mac: dataLin.m,
+                name: dataLin.n,
+                rssi: dataLin.rssi,
+                ai: dataLin.ai,
+                at: dataLin.at,
+                type: dataLin.t, //当type为1时为心电
+              };
+              that.changeList(a);
+              //获取到很多数据,取每秒最大的包含量
+            } else if (redata.msgType == "eegData") {
+              // let dataLin = JSON.parse(redata.content);
+              // console.log(dataLin);
+              console.log("11111111111111111111");
+              console.log(dataLin.value);
+              ///先判断第一个用户是否有mac---有mac代表已连接
+              if (that.userLink.mac !== "" && that.userLink.mac == dataLin.id) {
+                ipcRenderer.send("asynchronoushrv-naoData", {
+                  value: dataLin.value,
+                  mac: dataLin.id,
+                });
+              }
+              if (
+                that.userTwoLink.mac !== "" &&
+                that.userTwoLink.mac == dataLin.id
+              ) {
+                ipcRenderer.send("asynchronoushrv-naoTwoData", {
+                  value: dataLin.value,
+                  mac: dataLin.id,
+                });
+              }
+              //判断第二个用户的mac是否有,有则代表已连接  --
+            } else if (redata.msgType == "ecgData") {
+              //判断该数据对应的mac是否是当前绑定过用户的
+              //判断当前是否是绑定该用户的数据,是的话进行用户处理
+              //接到数据进行处理
+              //当该用户的mac与id相同时,取这个数据
+              // console.log(dataLin.id === that.userLink.mac);
+              if (dataLin.id === that.userLink.mac) {
+                let list = dataLin.value.split(",");
+                // console.log(list)
+                list.forEach((item) => {
+                  let tmp = parseInt(item);
+                  that.userLink.ecgAllList.push(tmp);
+                  that.userLink.ecgSectionList.push(tmp);
+                  if (
+                    that.userLink.ecgSectionList.length > that.intervalLength
+                  ) {
+                    that.userLink.ecgSectionList.shift();
+                  }
+                  if (that.userLink.ecgAllList.length % 100 == 0) {
+                    // console.log(that.ecgAllList.length);
+                    if (that.echartsVisible) {
+                      that.renderEcgOne();
+                    }
+                  }
+                });
+              }
+            } else if (redata.msgType == "connectedList") {
+              //数组储存每次返回的已选列表
+              //将每次的数据进行储存,然后经过去重及为已选列表的数据
+              let obj = {
+                mac: dataLin.m,
+                name: dataLin.n,
+                rssi: dataLin.rssi,
+                connect: true,
+                ai: dataLin.ai,
+                at: dataLin.at,
+                type: dataLin.t, //当type为1时为心
+              };
+
+              that.isSelectedList.push(obj);
+
+              //创建一个变量,将变量赋值根据mac进行去重
+              let list = JSON.parse(JSON.stringify(that.isSelectedList));
+              //然后将list进行去重
+
+              //然后将该结果去重
+              let listBarring = [];
+              for (let i = 0; i < list.length; i++) {
+                let flag = false;
+                for (let j = 0; j < listBarring.length; j++) {
+                  if (list[i].mac == list[j].mac) {
+                    flag = true;
                   }
                 }
-              });
+                if (!flag) {
+                  listBarring.push(list[i]);
+                }
+              }
+              that.connectedData = JSON.parse(JSON.stringify(listBarring));
+              console.log(that.connectedData);
+              //listBarring  将值赋值给已选列表的值
             }
-          }else if(redata.msgType == "connectedList"){
-            //数组储存每次返回的已选列表
-            
-
           }
         }
       }
@@ -1093,6 +1086,7 @@ export default {
       // console.log(JSON.stringify(newArr));
       //listTmp即使最大扫描列表
       that.scanData = newArr;
+      console.log(that.scanData);
     },
     websocketclose(e) {
       if (e.code == 1005) {
@@ -1192,13 +1186,13 @@ export default {
                   rssi: "",
                   name: "",
                   mac: "",
-                  connent: false,
+                  connect: false,
                   deviceType: "",
                 };
                 obj.rssi = "";
                 obj.name = res.data[i].Name;
                 obj.mac = res.data[i].MAC;
-                obj.connent = true;
+                obj.connect = true;
                 obj.deviceType = res.data[i].DeviceType;
                 obj.userNum = "";
                 list.push(obj);
@@ -1535,7 +1529,8 @@ export default {
       this.$refs.unityIframe.contentWindow.changeSize(width, height);
     },
     send(val) {
-      this.$refs.unityIframe.contentWindow.Bloomsize(val);
+      // this.$refs.unityIframe.contentWindow.Bloomsize(val);
+      this.$refs.unityIframe.contentWindow.CallUnity();
     },
     // btt() {
     //   let that = this;

+ 1 - 1
src/renderer/components/Smart1.vue

@@ -416,7 +416,7 @@ export default {
                 let score = parseInt(sleep[i].value[0]);
                 if (score >= 0 && score <= 20) {
                   this.askEndMul(
-                    '	轻度:建议您使用系统中的虚拟现实、生物反馈训练<span onclick="jumpPage(1)" style="color:blue;cursor:pointer">(点击跳转)</span>、认知行为干预<span  onclick="jumpPage(2)" style="color:blue;cursor:pointer">(点击跳转--走出抑郁)</span>功能进行心理状态调'
+                    '	轻度:建议您使用系统中的虚拟现实、生物反馈训练<span onclick="jumpPage(1)" style="color:blue;cursor:pointer">(点击跳转)</span>、认知行为干预<span  onclick="jumpPage(2)" style="color:blue;cursor:pointer">(点击跳转--走出抑郁)</span>功能进行心理状态调试。'
                   );
                 }
               }

+ 109 - 43
src/renderer/components/treatDepression.vue

@@ -203,6 +203,21 @@
         >
       </span>
     </el-dialog>
+
+    <el-dialog
+      title=""
+      :visible.sync="openDialogFlag"
+      width="30%"
+      center
+    >
+      <span>需要注意的是内容是默认不居中的</span>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="openDialogFlag = false">取 消</el-button>
+        <el-button type="primary" @click="openDialogFlag = false"
+          >确 定</el-button
+        >
+      </span>
+    </el-dialog>
     <!-- <el-button @click="centerDialogVisible = true">打开窗口</el-button> -->
   </div>
 </template>
@@ -271,6 +286,7 @@ export default {
       pageSize: 10,
       printIndex: 0,
       flagTime: null,
+      openDialogFlag: true,
     };
   },
   created() {},
@@ -282,7 +298,11 @@ export default {
     // this.selectScale("20220805135201");
     //上来就查询之前的聊天记录
     scrollview.addEventListener("scroll", this.handleScroll, true);
+
+    //先调用接口知道是否出来弹窗
+
     this.selectPage();
+
     //判断是否是第一次进来,如果查询记录为空,则是第一次进来--则需要调用出初始化语句
     //如果不是第一次进来--则接着上次的记录说
   },
@@ -293,6 +313,9 @@ export default {
   },
 
   methods: {
+    openDialog() {
+      openDialogFlag = true;
+    },
     handleScroll() {
       let scrollview = this.$refs["scrollview"];
       if (scrollview.scrollTop == 0) {
@@ -356,35 +379,41 @@ export default {
                 if (
                   res.data.intelligentDialogueEntities.content[i].label == "0"
                 ) {
-                  this.chatContents.unshift({
-                    from: 1,
-                    //是否是量表的信息
-                    isScale: false,
-                    //是单选还是文字  0单选  1填空  -1描述
-                    isType: -1,
-                    //可点击可不点击 0单选   1填空
-                    disabled: false,
-                    //问题
-                    question:
-                      res.data.intelligentDialogueEntities.content[i].content,
-                    //头像
-                    from1: HeadImg,
-                  });
+                  //当是第一页第一个时,不取了
+
+                  if (!(that.pageNum == 1 && i == 0)) {
+                    this.chatContents.unshift({
+                      from: 1,
+                      //是否是量表的信息
+                      isScale: false,
+                      //是单选还是文字  0单选  1填空  -1描述
+                      isType: -1,
+                      //可点击可不点击 0单选   1填空
+                      disabled: false,
+                      //问题
+                      question:
+                        res.data.intelligentDialogueEntities.content[i].content,
+                      //头像
+                      from1: HeadImg,
+                    });
+                  }
                 } else {
-                  this.chatContents.unshift({
-                    from: 2,
-                    //是否是量表的信息
-                    isScale: false,
-                    //是单选还是文字  0单选  1填空  -1描述
-                    isType: -1,
-                    //可点击可不点击 0单选   1填空
-                    disabled: false,
-                    //问题
-                    question:
-                      res.data.intelligentDialogueEntities.content[i].content,
-                    //头像
-                    from1: HeadImg,
-                  });
+                  if (!(that.pageNum == 1 && i == 0)) {
+                    this.chatContents.unshift({
+                      from: 2,
+                      //是否是量表的信息
+                      isScale: false,
+                      //是单选还是文字  0单选  1填空  -1描述
+                      isType: -1,
+                      //可点击可不点击 0单选   1填空
+                      disabled: false,
+                      //问题
+                      question:
+                        res.data.intelligentDialogueEntities.content[i].content,
+                      //头像
+                      from1: HeadImg,
+                    });
+                  }
                 }
               }
               console.log(this.chatContents);
@@ -396,10 +425,12 @@ export default {
               //当是第一次进来时,需要调用question  获取第一次问答信息,但是传输的是type为5
               if (res.data.intelligentDialogueEntities.content.length == 0) {
                 //将当前的设置为5
-                // that.interveneId = 5;
-                that.getQuestion('');
+                that.interveneId = 5;
+                that.getQuestion("", false);
               } else {
-                 that.getQuestion('');
+                let id =
+                  res.data.intelligentDialogueEntities.content[0].questionNo;
+                that.getQuestion(id, false);
               }
             }
           } else {
@@ -491,7 +522,7 @@ export default {
       );
     },
     init(val) {
-      this.getQuestion(1);
+      this.getQuestion(1, true);
       let contant1 = document.getElementById("contant1");
       this.sleep(101).then(() => {
         contant1.scrollTop = contant1.scrollHeight;
@@ -511,9 +542,16 @@ export default {
         //当标志是5时,则不需要保存
         if (this.interveneId != 5) {
           this.saveRecord(paramsSave);
+          this.getQuestion(id, true);
+        } else {
+          //当标志是5时需要调用修改昵称接口
+          //且当前问题编号为2时
+          if (questionNo == "2") {
+            console.log(123);
+            this.updateName(val.text, id);
+          }
         }
-
-        this.getQuestion(id);
+        console.log(1234);
       } else {
         this.chatContents.push({
           //是问题还是答案
@@ -542,13 +580,34 @@ export default {
         });
       }
     },
+    updateName(val, id) {
+      let that = this;
+      let data = {
+        identifier: sessionStorage.getItem("num"),
+        userName: val,
+      };
+      this.$http.post(`/v1/user/updateUserName`, data, (res) => {
+        console.log("updateUserName");
+        if (res.data.code == 200) {
+          //当等于5且编号的能够与
+          that.getQuestion(id, false);
+        } else {
+        }
+      });
+    },
     // 获取问题
-    getQuestion(id) {
+
+    //第二个参数判断是否是需要回显的,如果是数据已返回就不回显了
+    //或保存,当第二个参数为true时需要保存,当第二个参数为false时不需要保存
+
+    getQuestion(id, flag) {
+      let that = this;
       if (this.interveneId == 4) {
         if (id == "109" || id == "117" || id == "119") {
           this.centerDialogVisible = true;
         }
       }
+
       this.$http.get(
         `chat/getQuestion/${this.interveneId}`,
         {
@@ -556,6 +615,11 @@ export default {
         },
         (res) => {
           if (res.code == "200") {
+            if (that.interveneId == 5 && id == 3) {
+              that.interveneId = that.$route.query.id;
+              //然后再调用question
+              that.getQuestion("", true);
+            }
             let result = res.data;
             if (result == null) {
               //将结束对话
@@ -578,13 +642,13 @@ export default {
               //头像
               from1: HeadImg,
             });
-            this.pFun(result.question, true, result);
+            this.pFun(result.question, true, result, flag);
           }
         }
       );
     },
     //修改文本打印效果
-    pFun(val, flag, result) {
+    pFun(val, flag, result, saveFlag) {
       let that = this;
       //3个循环播放
       this.chatContents[this.chatContents.length - 1].question = "";
@@ -639,7 +703,9 @@ export default {
                   content: result ? result.question : "",
                   questionNo: result.id,
                 };
-                this.saveRecord(paramsSave);
+                if (saveFlag) {
+                  this.saveRecord(paramsSave);
+                }
               }
 
               //         identifier: sessionStorage.getItem("num"),
@@ -659,7 +725,7 @@ export default {
                 this.getScaleInfo(this.flag);
               } else {
                 // 下一题非量表,继续查询下一题
-                this.getQuestion(result.nextQuestionNo);
+                this.getQuestion(result.nextQuestionNo, true);
               }
             } else {
               this.printIndex = 0;
@@ -828,7 +894,7 @@ export default {
           contant1.scrollTop = contant1.scrollHeight;
         });
       } else {
-        this.getQuestion(id);
+        this.getQuestion(id, true);
       }
       //如果判断id为空
       // if(){
@@ -979,7 +1045,7 @@ export default {
               question: res.data.data.userRecordEntity.testResults,
               from1: HeadImg,
             });
-            this.getQuestion(44);
+            this.getQuestion(44, true);
           } else if (this.interveneId == 4) {
             this.chatContents.push({
               from: 1,
@@ -988,7 +1054,7 @@ export default {
               question: res.data.data.userRecordEntity.testResults,
               from1: HeadImg,
             });
-            this.getQuestion(46);
+            this.getQuestion(46, true);
           }
         }
       });
@@ -1001,7 +1067,7 @@ export default {
         (res) => {
           if (res.code == 200) {
             if (res.data && res.data.nextQuestionNo) {
-              this.getQuestion(res.data.nextQuestionNo);
+              this.getQuestion(res.data.nextQuestionNo, true);
             }
           }
         }

+ 2 - 2
src/utils/http.js

@@ -13,8 +13,8 @@ axios.defaults.baseURL = global.dev;
 
 // 创建一个 Axios 实例并设置 baseURL 适应不同服务器的baseUrl
 const apiInstance = axios.create({
-  baseURL: 'http://localhost:8000/'
-  // baseURL: 'http://192.168.1.102:8000/'
+  // baseURL: 'http://localhost:8000/'
+  baseURL: 'http://192.168.1.100:8000/'
 });
 
 // axios.defaults.baseURL = "/api";

+ 13 - 0
static/balance/.idea/.idea.Tianping.dir/.idea/.gitignore

@@ -0,0 +1,13 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# Rider 忽略的文件
+/projectSettingsUpdater.xml
+/contentModel.xml
+/modules.xml
+/.idea.Tianping.iml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 8 - 0
static/balance/.idea/.idea.Tianping.dir/.idea/indexLayout.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="UserContentModel">
+    <attachedFolders />
+    <explicitIncludes />
+    <explicitExcludes />
+  </component>
+</project>

BIN
static/balance/Build/Tianping.data


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 9 - 0
static/balance/Build/Tianping.framework.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
static/balance/Build/Tianping.loader.js


BIN
static/balance/Build/Tianping.wasm


BIN
static/balance/TemplateData/MemoryProfiler.png


BIN
static/balance/TemplateData/favicon.ico


BIN
static/balance/TemplateData/fullscreen-button.png


BIN
static/balance/TemplateData/progress-bar-empty-dark.png


BIN
static/balance/TemplateData/progress-bar-empty-light.png


BIN
static/balance/TemplateData/progress-bar-full-dark.png


BIN
static/balance/TemplateData/progress-bar-full-light.png


+ 16 - 0
static/balance/TemplateData/style.css

@@ -0,0 +1,16 @@
+body { padding: 0; margin: 0 }
+#unity-container { position: absolute }
+#unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
+#unity-container.unity-mobile { position: fixed; width: 100%; height: 100% }
+#unity-canvas { background: #231F20 }
+.unity-mobile #unity-canvas { width: 100%; height: 100% }
+#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
+#unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
+#unity-progress-bar-empty { width: 141px; height: 18px; margin-top: 10px; margin-left: 6.5px; background: url('progress-bar-empty-dark.png') no-repeat center }
+#unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
+#unity-footer { position: relative }
+.unity-mobile #unity-footer { display: none }
+#unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
+#unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
+#unity-fullscreen-button { cursor:pointer; float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
+#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }

BIN
static/balance/TemplateData/unity-logo-dark.png


BIN
static/balance/TemplateData/unity-logo-light.png


BIN
static/balance/TemplateData/webgl-logo.png


BIN
static/balance/TemplateData/webmemd-icon.png


+ 132 - 0
static/balance/index.html

@@ -0,0 +1,132 @@
+<!DOCTYPE html>
+<html lang="en-us">
+  <head>
+    <meta charset="utf-8">
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <title>Unity WebGL Player | Balance</title>
+    <link rel="shortcut icon" href="TemplateData/favicon.ico">
+    <link rel="stylesheet" href="TemplateData/style.css">
+  </head>
+  <body>
+    <div id="unity-container" class="unity-desktop">
+      <canvas id="unity-canvas" width=960 height=600 tabindex="-1"></canvas>
+      <div id="unity-loading-bar">
+        <div id="unity-logo"></div>
+        <div id="unity-progress-bar-empty">
+          <div id="unity-progress-bar-full"></div>
+        </div>
+      </div>
+      <div id="unity-warning"> </div>
+      <div id="unity-footer">
+        <div id="unity-webgl-logo"></div>
+        <div id="unity-fullscreen-button"></div>
+        <div id="unity-build-title">Balance</div>
+      </div>
+      <div>
+        <button id = "btnStart">开始传输</button>
+      </div>
+    </div>
+    <script>
+
+      var container = document.querySelector("#unity-container");
+      var canvas = document.querySelector("#unity-canvas");
+      var loadingBar = document.querySelector("#unity-loading-bar");
+      var progressBarFull = document.querySelector("#unity-progress-bar-full");
+      var fullscreenButton = document.querySelector("#unity-fullscreen-button");
+      var warningBanner = document.querySelector("#unity-warning");
+
+      // Shows a temporary message banner/ribbon for a few seconds, or
+      // a permanent error message on top of the canvas if type=='error'.
+      // If type=='warning', a yellow highlight color is used.
+      // Modify or remove this function to customize the visually presented
+      // way that non-critical warnings and error messages are presented to the
+      // user.
+      function unityShowBanner(msg, type) {
+        function updateBannerVisibility() {
+          warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
+        }
+        var div = document.createElement('div');
+        div.innerHTML = msg;
+        warningBanner.appendChild(div);
+        if (type == 'error') div.style = 'background: red; padding: 10px;';
+        else {
+          if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
+          setTimeout(function() {
+            warningBanner.removeChild(div);
+            updateBannerVisibility();
+          }, 5000);
+        }
+        updateBannerVisibility();
+      }
+
+      var buildUrl = "Build";
+      var loaderUrl = buildUrl + "/Tianping.loader.js";
+      var config = {
+        dataUrl: buildUrl + "/Tianping.data",
+        frameworkUrl: buildUrl + "/Tianping.framework.js",
+        codeUrl: buildUrl + "/Tianping.wasm",
+        streamingAssetsUrl: "StreamingAssets",
+        companyName: "DefaultCompany",
+        productName: "Balance",
+        productVersion: "0.1",
+        showBanner: unityShowBanner,
+      };
+
+      // By default, Unity keeps WebGL canvas render target size matched with
+      // the DOM size of the canvas element (scaled by window.devicePixelRatio)
+      // Set this to false if you want to decouple this synchronization from
+      // happening inside the engine, and you would instead like to size up
+      // the canvas DOM size and WebGL render target sizes yourself.
+      // config.matchWebGLToCanvasSize = false;
+
+      if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
+        // Mobile device style: fill the whole browser client area with the game canvas:
+
+        var meta = document.createElement('meta');
+        meta.name = 'viewport';
+        meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
+        document.getElementsByTagName('head')[0].appendChild(meta);
+        container.className = "unity-mobile";
+        canvas.className = "unity-mobile";
+
+        // To lower canvas resolution on mobile devices to gain some
+        // performance, uncomment the following line:
+        // config.devicePixelRatio = 1;
+
+
+      } else {
+        // Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
+
+        canvas.style.width = "960px";
+        canvas.style.height = "600px";
+      }
+
+      loadingBar.style.display = "block";
+
+      var script = document.createElement("script");
+      script.src = loaderUrl;
+      script.onload = () => {
+        createUnityInstance(canvas, config, (progress) => {
+          progressBarFull.style.width = 100 * progress + "%";
+              }).then((unityInstance) => {
+                loadingBar.style.display = "none";
+                fullscreenButton.onclick = () => {
+                  unityInstance.SetFullscreen(1);
+                };
+          this.gameInstance = unityInstance;
+              }).catch((message) => {
+                alert(message);
+              });
+            };
+
+      document.body.appendChild(script);
+
+      var btnStart = document.getElementById("btnStart");
+      btnStart.onclick = function(){
+        gameInstance.SendMessage("Tianping","Balance","2.00,52.00");
+        console.log(gameInstance);
+      };
+
+    </script>
+  </body>
+</html>

+ 3 - 0
static/baobaotong/.vscode/settings.json

@@ -0,0 +1,3 @@
+{
+    "liveServer.settings.port": 5501
+}

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels