From c699c544034a0e57e9881fc99930eddfa75c9f8c Mon Sep 17 00:00:00 2001 From: wwl <xchao828@163.com> Date: 星期四, 13 二月 2025 16:43:18 +0800 Subject: [PATCH] 1 --- src/views/system/tijian/index.vue | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/views/system/tijian/index.vue b/src/views/system/tijian/index.vue index 1441feb..5faa56e 100644 --- a/src/views/system/tijian/index.vue +++ b/src/views/system/tijian/index.vue @@ -1820,6 +1820,7 @@ let configKey = "getInfoFromSqlData"; getconfigKey(configKey).then((res) => { if (res.code == 200) { + console.log(res.msg, 'res.msg'); if (res.msg == "N") { var websocket = null; var url = this.valueUrl; @@ -1859,10 +1860,11 @@ //鎺ユ敹鍒版秷鎭殑鍥炶皟鏂规硶 websocket.onmessage = (event) => { - var resultObj = eval("(" + event.data + ")"); + var resultObj = eval("(" + event.data + ")"); // 娉ㄦ剰锛歟val瀛樺湪瀹夊叏闅愭偅锛屽缓璁敤JSON.parse this.readCardWebSocket(resultObj); + websocket.close(); }; - websocket.onclose = function () { + websocket.onclose = () => { alert("璇诲崱鍣ㄨ繛鎺ュ叧闂�"); }; } else if (res.msg == "Y") { @@ -1883,8 +1885,8 @@ // 鏈�鏂颁娇鐢╳ebSocket閫氫俊 readCardWebSocket(resultObj) { let _this = this; - - if (resultObj.code === 200 && resultObj.data.name != null) { + console.log(resultObj, 'resultObj'); + if (resultObj.code === 200 && resultObj.data.name && resultObj.data.name != null) { //鍥炴樉鐩稿叧鏁版嵁 _this.form.cusName = resultObj.data.name; _this.form.cusSex = resultObj.data.sex == "0" ? "濂�" : "鐢�"; -- Gitblit v1.8.0