From 0c26cb58f143c56f3753f4745519502222cde4ff Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期五, 01 十一月 2024 18:42:35 +0800
Subject: [PATCH] 测试完成

---
 src/views/repositoryai/templateku/configurat/measurement.vue |  105 ++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 85 insertions(+), 20 deletions(-)

diff --git a/src/views/repositoryai/templateku/configurat/measurement.vue b/src/views/repositoryai/templateku/configurat/measurement.vue
index 491059f..7af839f 100644
--- a/src/views/repositoryai/templateku/configurat/measurement.vue
+++ b/src/views/repositoryai/templateku/configurat/measurement.vue
@@ -66,9 +66,10 @@
             :key="item.aaa"
           >
             <div class="dev-text">
-              {{ index + 1 }}銆�<span>{{ item.questionText }}</span>
+              {{ index + 1 }}銆�<span>{{ item.scriptContent }}</span>
             </div>
-            <div class="dev-xx">
+
+            <div class="dev-xx" v-if="item.valueType == 1">
               <el-radio-group v-model="item.radio">
                 <el-radio
                   v-for="(items, index) in item.ivrLibaScriptTargetoptionList"
@@ -77,6 +78,14 @@
                   >{{ items.targetvalue }}</el-radio
                 >
               </el-radio-group>
+            </div>
+            <div v-else>
+              <el-input
+                type="textarea"
+                placeholder="鏈幏鍙栧埌淇℃伅"
+                v-model.sync="item.questionResult"
+                :rows="2"
+              />
             </div>
           </div>
         </div>
@@ -91,18 +100,20 @@
   websocketSend,
   closeWebsocket,
 } from "@/websocket/websocket.js";
+import store from "@/store";
 export default {
   data() {
     return {
       answer: "", //鍥炵瓟
       id: null,
-      TemplateName: "闅忚妯$増鍚嶇О", //妯$増鍚�
+      TemplateName: "闅忚妯℃澘鍚嶇О", //妯℃澘鍚�
       radio: "1",
       userid: "",
       input: "杩樹笉閿�",
       drawer: false,
       radio: "2",
       code: "",
+      timeout: "5",
       Answerline: [],
       questionList: [],
     };
@@ -110,7 +121,30 @@
 
   created() {
     this.TemplateName = this.$route.query.name;
+    this.userid = store.getters.Id;
+    console.log(store.getters.Id,'11');
+
     this.requstWs(); //杩涘叆椤甸潰鍒涘缓杩炴帴
+  },
+  mounted() {
+    // 鑾峰彇class涓篵orderdiv鐨勫厓绱�
+    const borderdiv = document.querySelector(".borderdiv");
+
+    // 鍒涘缓涓�涓狹utationObserver瀹炰緥锛岀敤浜庣洃鍚厓绱犵殑鍙樺寲
+    const observer = new MutationObserver(() => {
+      // 褰撳厓绱犻珮搴﹀彉鍖栨椂锛屽皢婊氬姩鏉℃粴鍔ㄥ埌鏈�涓嬫柟
+      borderdiv.scrollTop = borderdiv.scrollHeight;
+    });
+
+    // 閰嶇疆MutationObserver瀹炰緥鐨勮瀵熺洰鏍囧拰瑙傚療閫夐」
+    observer.observe(borderdiv, {
+      attributes: true,
+      childList: true,
+      subtree: true,
+    });
+
+    // 褰撲笉鍐嶉渶瑕佺洃鍚椂锛屽彲浠ヤ娇鐢╠isconnect鏂规硶鍋滄瑙傚療
+    // observer.disconnect();
   },
 
   methods: {
@@ -118,18 +152,19 @@
     requstWs(message, next, file) {
       console.log("杩炴帴");
       this.id = this.$route.query.id;
+      this.timeout = this.$route.query.timeout;
       // 闃叉鐢ㄦ埛澶氭杩炵画鐐瑰嚮鍙戣捣璇锋眰锛屾墍浠ヨ鍏堝叧闂笂娆$殑ws璇锋眰銆�
       closeWebsocket();
       console.log(this.id);
       const obj = {
         type: "text",
-        userId: "1",
+        userId: this.userid,
         templateId: this.id,
         content: null,
       };
       // 鍙戣捣ws璇锋眰
       sendWebsocket(
-        "ws://localhost:8089/chat?userId=1",
+        "ws://192.168.2.13:8095/chat?userId="+this.userid,
         obj,
         this.wsMessage,
         this.wsError
@@ -138,19 +173,45 @@
     // 鎺ユ敹ws杩斿洖鐨勬暟鎹�
     wsMessage(data) {
       let dataJson = data;
+      let timerId = null;
       dataJson = JSON.parse(dataJson);
       dataJson = JSON.parse(dataJson);
       console.log(dataJson, "鏁版嵁");
-      if (!this.Answerline[0]) {
+      // 棣栨鎺ユ敹鏁版嵁
+      // if (!this.Answerline[0]) {
+      //   this.Answerline.push({
+      //     value: dataJson.kcb,
+      //     isEat: 1,
+      //   });
+      // }
+      timerId = setTimeout(() => {
+        if (!this.answer) {
+          this.sendFn(); // 鍚庤皟鐢�
+        }
+      }, this.timeout * 1000);
+      if (condition) {
+
+      }
+      // clearTimeout(timerId)
+      // 浼樺厛鍔犲叆閫氱敤搴撳尮閰嶆枃鏈�
+      if (dataJson.nowQuestion.submoduleText) {
         this.Answerline.push({
-          value: dataJson.kcb,
+          value: dataJson.nowQuestion.submoduleText,
           isEat: 1,
         });
       }
-      this.Answerline.push({
-        value: dataJson.nowQuestion.questionText,
-        isEat: 1,
-      });
+      // 鏄惁缁撴潫
+      if (dataJson.jsy) {
+        this.Answerline.push({
+          value: dataJson.jsy,
+          isEat: 1,
+        });
+      } else if (dataJson.nowQuestion.scriptContent) {
+        this.Answerline.push({
+          value: dataJson.nowQuestion.scriptContent,
+          isEat: 1,
+        });
+      }
       this.questionList = dataJson.questionList;
       this.questionList = this.questionList.map((item) => {
         item.ivrLibaScriptTargetoptionList.forEach((row) => {
@@ -160,6 +221,7 @@
         });
         return item;
       });
+      console.log(this.questionList);
 
       // IMUI.appendMessage(data);
     },
@@ -169,17 +231,19 @@
     },
 
     sendFn() {
+      console.log("鍙戦��");
+
       // 娑堟伅鍙戦��
       const obj = {
         type: "text",
-        userId: "1",
+        userId: this.userid,
         templateId: "",
         questionMessage: { content: this.answer },
       };
       console.log(obj, "鍏ュ弬");
       // 鍙戣捣ws璇锋眰
       sendWebsocket(
-        "ws://localhost:8089/chat?userId=1",
+        "ws://192.168.2.13:8095/chat?userId="+this.userid,
         obj,
         this.wsMessage,
         this.wsError
@@ -219,20 +283,21 @@
   }
 }
 .borderdiv {
-  min-height: 60vh;
+  height: 100vh;
   font-size: 20px;
   padding: 30px;
   max-height: 700px;
   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