From 715b4bc2962b8286d16ed0f31a802c57efddfcfb Mon Sep 17 00:00:00 2001 From: fofolee Date: Thu, 28 Apr 2022 13:12:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=A0=91=E7=8A=B6=E5=9B=BE=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin/preload.js | 5 +- src/components/CommandRunResult.vue | 21 +++--- src/components/ResultArea.vue | 13 +++- src/components/popup/ObjectTree.vue | 99 +++++++++++++++++++++++++---- 4 files changed, 105 insertions(+), 33 deletions(-) diff --git a/plugin/preload.js b/plugin/preload.js index 7ebba0f..3600f6a 100644 --- a/plugin/preload.js +++ b/plugin/preload.js @@ -8,7 +8,6 @@ const axios = require('axios'); const http = require('http'); const url = require('url') const kill = require('tree-kill') -const beautifyLog = require('./lib/beautifyLog') require('ses') window._ = require("lodash") @@ -414,8 +413,6 @@ window.convertFilePathToUtoolsPayload = files => files.map(file => { } }) -let parseStdout = stdout => stdout.map(x => beautifyLog(x)).join("\n") - let getSandboxFuns = () => { var sandbox = { fetch: fetch.bind(window), @@ -466,7 +463,7 @@ window.runCodeInSandbox = (code, callback, addVars = {}) => { callback(stdout, null) }, error: (...stderr) => { - callback(null, parseStdout(stderr)) + callback(null, stderr) } } let sandboxWithAD = Object.assign(addVars, sandbox) diff --git a/src/components/CommandRunResult.vue b/src/components/CommandRunResult.vue index 610220a..7223e26 100644 --- a/src/components/CommandRunResult.vue +++ b/src/components/CommandRunResult.vue @@ -128,7 +128,9 @@ export default { ? alert(stderr) : this.showRunResult(stderr, false, action); } - !outPlugin && this.showRunResult(stdout, true, action); + outPlugin + ? action(stdout.toString()) + : this.showRunResult(stdout, true); }, { enterData: this.$root.enterData } ); @@ -151,7 +153,9 @@ export default { ? alert(stderr) : this.showRunResult(stderr, false, action); } - !outPlugin && this.showRunResult(stdout, true, action); + outPlugin + ? action(stdout.toString()) + : this.showRunResult(stdout, true); } ); } @@ -228,20 +232,11 @@ export default { }; }, // 显示运行结果 - showRunResult(content, isSuccess, action) { + showRunResult(content, isSuccess) { this.isResultShow = true; this.timeStamp = new Date().getTime(); this.runResultStatus = isSuccess; - // let contlength = content?.length || 0; - // if (contlength > this.resultMaxLength) - // content = - // content.slice(0, this.resultMaxLength - 100) + - // `\n\n...\n${ - // contlength - this.resultMaxLength - 100 - // } 字省略\n...\n\n` + - // content.slice(contlength - 100); - // let pretreatment = action(content); - // pretreatment && (this.runResult += pretreatment); + if (!_.isArray(content)) content = [content]; this.runResult = this.runResult.concat(content); this.outputAutoHeight(this.fromUtools); }, diff --git a/src/components/ResultArea.vue b/src/components/ResultArea.vue index 7bf0b1c..fe5821c 100644 --- a/src/components/ResultArea.vue +++ b/src/components/ResultArea.vue @@ -9,14 +9,19 @@ @load="frameLoad" v-if="showFrame" > -
+
-

+        

       
@@ -103,12 +108,14 @@ export default {