From bf6643a35299f19ae9147864e6f3b6b4670da98a Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期六, 09 十一月 2024 11:42:59 +0800
Subject: [PATCH] 测试完成

---
 src/views/repositoryai/templateku/configurat/measurement.vue |   57 ++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 34 insertions(+), 23 deletions(-)

diff --git a/src/views/repositoryai/templateku/configurat/measurement.vue b/src/views/repositoryai/templateku/configurat/measurement.vue
index 2c5031c..b48369b 100644
--- a/src/views/repositoryai/templateku/configurat/measurement.vue
+++ b/src/views/repositoryai/templateku/configurat/measurement.vue
@@ -100,6 +100,7 @@
   websocketSend,
   closeWebsocket,
 } from "@/websocket/websocket.js";
+import store from "@/store";
 export default {
   data() {
     return {
@@ -120,6 +121,9 @@
 
   created() {
     this.TemplateName = this.$route.query.name;
+    this.userid = store.getters.Id;
+    console.log(store.getters.Id,'11');
+
     this.requstWs(); //杩涘叆椤甸潰鍒涘缓杩炴帴
   },
   mounted() {
@@ -154,13 +158,13 @@
       console.log(this.id);
       const obj = {
         type: "text",
-        userId: "1",
+        userId: this.userid,
         templateId: this.id,
         content: null,
       };
       // 鍙戣捣ws璇锋眰
       sendWebsocket(
-        "ws://192.168.2.10:8095/chat?userId=1",
+        "ws://192.168.2.10:8095/chat?userId="+this.userid,
         obj,
         this.wsMessage,
         this.wsError
@@ -174,17 +178,15 @@
       dataJson = JSON.parse(dataJson);
       console.log(dataJson, "鏁版嵁");
       // 棣栨鎺ユ敹鏁版嵁
-      if (!this.Answerline[0]) {
-        this.Answerline.push({
-          value: dataJson.kcb,
-          isEat: 1,
-        });
-      }
-      timerId = setTimeout(() => {
-        if (!this.answer) {
-          this.sendFn(); // 鍚庤皟鐢�
-        }
-    },this.timeout*1000);
+      // if (!this.Answerline[0]) {
+      //   this.Answerline.push({
+      //     value: dataJson.kcb,
+      //     isEat: 1,
+      //   });
+      // }
+
+
+
       // 浼樺厛鍔犲叆閫氱敤搴撳尮閰嶆枃鏈�
       if (dataJson.nowQuestion.submoduleText) {
         this.Answerline.push({
@@ -213,8 +215,16 @@
         });
         return item;
       });
+      if (!dataJson.jsy) {
+        timerId = setTimeout(() => {
+          if (!this.answer) {
+            this.sendFn(); // 鍚庤皟鐢�
+          }
+        }, this.timeout * 1000);
+      }else{
+        clearTimeout(timerId)
+      }
       console.log(this.questionList);
-
 
       // IMUI.appendMessage(data);
     },
@@ -224,19 +234,19 @@
     },
 
     sendFn() {
-      console.log('鍙戦��');
+      console.log("鍙戦��");
 
       // 娑堟伅鍙戦��
       const obj = {
         type: "text",
-        userId: "1",
+        userId: this.userid,
         templateId: "",
         questionMessage: { content: this.answer },
       };
       console.log(obj, "鍏ュ弬");
       // 鍙戣捣ws璇锋眰
       sendWebsocket(
-        "ws://192.168.2.10:8095/chat?userId=1",
+        "ws://192.168.2.10:8095/chat?userId="+this.userid,
         obj,
         this.wsMessage,
         this.wsError
@@ -283,13 +293,14 @@
   overflow: auto;
   .leftside {
     margin-bottom: 30px;
+    max-width: 566px;
+    margin-left: 20px;
+    padding: 10px;
+    color: #fff;
+    background: rgb(110, 196, 247);
+    border-radius: 10px;
     span {
-      width: 400px;
-      margin-left: 20px;
-      padding: 10px;
-      color: #fff;
-      background: rgb(110, 196, 247);
-      border-radius: 10px;
+      word-wrap: break-word;
     }
   }
   .offside {

--
Gitblit v1.9.3