From 3705fe109c2e7bb79d496a9f4e713f6e25c569e2 Mon Sep 17 00:00:00 2001 From: mxd <838425805@qq.com> Date: Tue, 10 Sep 2019 13:41:04 +0800 Subject: [PATCH] =?UTF-8?q?html=E8=BD=AC=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/js/editor.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/spider-flow-web/src/main/resources/static/js/editor.js b/spider-flow-web/src/main/resources/static/js/editor.js index ad56d49..58839d8 100644 --- a/spider-flow-web/src/main/resources/static/js/editor.js +++ b/spider-flow-web/src/main/resources/static/js/editor.js @@ -561,6 +561,7 @@ function bindToolbarClickAction(editor){ }).on('click','.btn-test',function(){ var LogViewer; var tableMap = {}; + var socket; layui.layer.open({ id : 'test-window', content : '
', @@ -611,6 +612,9 @@ function bindToolbarClickAction(editor){ return false; }, end : function(){ + if(socket){ + socket.close(); + } if(LogViewer){ LogViewer.destory(); } @@ -632,7 +636,7 @@ function bindToolbarClickAction(editor){ onCanvasViewerClick(e,'日志'); } }); - var socket = createWebSocket({ + socket = createWebSocket({ onopen : function(){ socket.send(JSON.stringify({ eventType : 'test', @@ -751,6 +755,12 @@ function onCanvasViewerClick(e,source){ } }catch(e){ + } + if(!json){ + var temp = document.createElement("div"); + (temp.textContent != null) ? (temp.textContent = msg) : (temp.innerText = msg); + msg = temp.innerHTML; + temp = null; } layer.open({ type : 1, @@ -759,8 +769,8 @@ function onCanvasViewerClick(e,source){ shade : 0, area : json ? ['700px','500px'] : 'auto', maxmin : true, - maxWidth : json ? undefined : 700, - maxHeight : json ? undefined : 500, + maxWidth : (json ? undefined : 700), + maxHeight : (json ? undefined : 500), success : function(dom,index){ var $dom = $(dom).find(".message-content"); if(json){