From b557dde5b61a6c38f22b07d3e7af00b3ae71fd44 Mon Sep 17 00:00:00 2001 From: WXL <1785969728@qq.com> Date: 星期五, 01 十一月 2024 14:42:31 +0800 Subject: [PATCH] 测试完成 --- src/views/repositoryai/templateku/configurat/measurement.vue | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/views/repositoryai/templateku/configurat/measurement.vue b/src/views/repositoryai/templateku/configurat/measurement.vue index f5886d3..2c5031c 100644 --- a/src/views/repositoryai/templateku/configurat/measurement.vue +++ b/src/views/repositoryai/templateku/configurat/measurement.vue @@ -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: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 (!this.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