WXL
2024-11-01 b557dde5b61a6c38f22b07d3e7af00b3ae71fd44
src/views/repositoryai/templateku/configurat/measurement.vue
@@ -66,7 +66,7 @@
            :key="item.aaa"
          >
            <div class="dev-text">
              {{ index + 1 }}、<span>{{ item.questionText }}</span>
              {{ index + 1 }}、<span>{{ item.scriptContent }}</span>
            </div>
            <div class="dev-xx" v-if="item.valueType == 1">
@@ -105,13 +105,14 @@
    return {
      answer: "", //回答
      id: null,
      TemplateName: "随访模版名称", //模版名
      TemplateName: "随访模板名称", //模板名
      radio: "1",
      userid: "",
      input: "还不错",
      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:8089/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 (!this.answer) {
          this.sendFn(); // 后调用
        }
    },this.timeout*1000);
      // 优先加入通用库匹配文本
      if (dataJson.nowQuestion.submoduleText) {
        this.Answerline.push({
@@ -190,9 +198,9 @@
          value: dataJson.jsy,
          isEat: 1,
        });
      } else if (dataJson.nowQuestion.questionText) {
      } else if (dataJson.nowQuestion.scriptContent) {
        this.Answerline.push({
          value: dataJson.nowQuestion.questionText,
          value: dataJson.nowQuestion.scriptContent,
          isEat: 1,
        });
      }
@@ -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:8089/chat?userId=1",
        "ws://192.168.2.10:8095/chat?userId=1",
        obj,
        this.wsMessage,
        this.wsError