From a7c11f44644124cf16014f972363b6a3ba9ca29a Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期三, 30 十月 2024 15:36:25 +0800
Subject: [PATCH] 测试完成

---
 src/views/repositoryai/templateku/configurat/measurement.vue |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/views/repositoryai/templateku/configurat/measurement.vue b/src/views/repositoryai/templateku/configurat/measurement.vue
index 8c3ac2b..eef021a 100644
--- a/src/views/repositoryai/templateku/configurat/measurement.vue
+++ b/src/views/repositoryai/templateku/configurat/measurement.vue
@@ -112,6 +112,7 @@
       drawer: false,
       radio: "2",
       code: "",
+      timeout: "5",
       Answerline: [],
       questionList: [],
     };
@@ -147,6 +148,7 @@
     requstWs(message, next, file) {
       console.log("杩炴帴");
       this.id = this.$route.query.id;
+      this.timeout = this.$route.query.timeout;
       // 闃叉鐢ㄦ埛澶氭杩炵画鐐瑰嚮鍙戣捣璇锋眰锛屾墍浠ヨ鍏堝叧闂笂娆$殑ws璇锋眰銆�
       closeWebsocket();
       console.log(this.id);
@@ -158,7 +160,7 @@
       };
       // 鍙戣捣ws璇锋眰
       sendWebsocket(
-        "ws://localhost:8095/chat?userId=1",
+        "ws://192.168.2.10:8095/chat?userId=1",
         obj,
         this.wsMessage,
         this.wsError
@@ -167,6 +169,7 @@
     // 鎺ユ敹ws杩斿洖鐨勬暟鎹�
     wsMessage(data) {
       let dataJson = data;
+      let timerId = null;
       dataJson = JSON.parse(dataJson);
       dataJson = JSON.parse(dataJson);
       console.log(dataJson, "鏁版嵁");
@@ -177,6 +180,11 @@
           isEat: 1,
         });
       }
+      timerId = setTimeout(() => {
+        if (!answer) {
+          this.sendFn(); // 鍚庤皟鐢�
+        }
+    },this.timeout*1000);
       // 浼樺厛鍔犲叆閫氱敤搴撳尮閰嶆枃鏈�
       if (dataJson.nowQuestion.submoduleText) {
         this.Answerline.push({
@@ -205,6 +213,8 @@
         });
         return item;
       });
+      console.log(this.questionList);
+
 
       // IMUI.appendMessage(data);
     },
@@ -214,6 +224,8 @@
     },
 
     sendFn() {
+      console.log('鍙戦��');
+
       // 娑堟伅鍙戦��
       const obj = {
         type: "text",
@@ -224,7 +236,7 @@
       console.log(obj, "鍏ュ弬");
       // 鍙戣捣ws璇锋眰
       sendWebsocket(
-        "ws://localhost:8095/chat?userId=1",
+        "ws://192.168.2.10:8095/chat?userId=1",
         obj,
         this.wsMessage,
         this.wsError

--
Gitblit v1.9.3