WXL
2024-11-01 7611c86d2b45b64112dd4a21cfc283543a46f29d
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,7 @@
  created() {
    this.TemplateName = this.$route.query.name;
    this.userid = store.getters.Id;
    this.requstWs(); //进入页面创建连接
  },
  mounted() {
@@ -154,13 +156,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,12 +176,12 @@
      dataJson = JSON.parse(dataJson);
      console.log(dataJson, "数据");
      // 首次接收数据
      if (!this.Answerline[0]) {
        this.Answerline.push({
          value: dataJson.kcb,
          isEat: 1,
        });
      }
      // if (!this.Answerline[0]) {
      //   this.Answerline.push({
      //     value: dataJson.kcb,
      //     isEat: 1,
      //   });
      // }
      timerId = setTimeout(() => {
        if (!this.answer) {
          this.sendFn(); // 后调用
@@ -215,7 +217,6 @@
      });
      console.log(this.questionList);
      // IMUI.appendMessage(data);
    },
    //ws错误回调
@@ -224,19 +225,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 +284,14 @@
  overflow: auto;
  .leftside {
    margin-bottom: 30px;
    span {
      width: 400px;
    width: 600px;
      margin-left: 20px;
      padding: 10px;
      color: #fff;
      background: rgb(110, 196, 247);
      border-radius: 10px;
    span {
      word-wrap: break-word;
    }
  }
  .offside {