From 7cd247bf5d08178bfcff5166d5afbdb176e0466b Mon Sep 17 00:00:00 2001 From: mxd <838425805@qq.com> Date: Sun, 31 Oct 2021 10:47:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=8A=B6=E6=80=81=E6=9D=A1?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- magic-editor/src/console/src/assets/index.css | 6 +++++ .../components/editor/magic-script-editor.vue | 23 ++++++++++++++----- .../src/components/layout/magic-event.vue | 2 +- .../components/layout/magic-status-bar.vue | 2 +- .../console/src/scripts/editor/dark-theme.js | 3 ++- .../src/console/src/scripts/editor/folding.js | 1 + 6 files changed, 28 insertions(+), 9 deletions(-) diff --git a/magic-editor/src/console/src/assets/index.css b/magic-editor/src/console/src/assets/index.css index 6b2151dc..4cef35fa 100644 --- a/magic-editor/src/console/src/assets/index.css +++ b/magic-editor/src/console/src/assets/index.css @@ -117,6 +117,7 @@ --text-key-color: #660e7a; --suggest-hover-background: #D6EBFF; --suggest-hover-color: #000; + --statusbar-em-color: #007f31; scrollbar-color: var(--scollbar-color) var(--scollbar-color); scrollbar-width: thin; outline: 0; @@ -317,6 +318,11 @@ .ma-container .monaco-list-row.focused .monaco-highlighted-label .highlight{ color: #0097fb !important } +.ma-container .ma-status-container em,.ma-event .ma-content em{ + color: var(--statusbar-em-color); + font-style: normal; + font-weight: bold; +} /** 旋转特效 **/ @keyframes rotate { diff --git a/magic-editor/src/console/src/components/editor/magic-script-editor.vue b/magic-editor/src/console/src/components/editor/magic-script-editor.vue index 0f3cb232..f45784aa 100644 --- a/magic-editor/src/console/src/components/editor/magic-script-editor.vue +++ b/magic-editor/src/console/src/components/editor/magic-script-editor.vue @@ -480,7 +480,8 @@ export default { } else { bus.$emit('report','script_add') } - bus.$emit('status',`接口「${thisInfo.groupName}/${thisInfo.name}(${thisInfo.groupPath}/${thisInfo.path})」已保存`.replace(/\/+/g, '/')) + let fullName = utils.replaceURL(`${thisInfo.groupName}/${thisInfo.name}(${thisInfo.groupPath}/${thisInfo.path})`) + bus.$emit('status',`接口「${fullName}」已保存`) thisInfo.id = id this.info.ext.tmpScript = saveObj.script }) @@ -502,7 +503,8 @@ export default { } else { bus.$emit('report','function_add') } - bus.$emit('status',`函数「${thisInfo.groupName}/${thisInfo.name}(${thisInfo.groupPath}/${thisInfo.path})」已保存`.replace(/\/+/g, '/')) + let fullName = utils.replaceURL(`${thisInfo.groupName}/${thisInfo.name}(${thisInfo.groupPath}/${thisInfo.path})`) + bus.$emit('status',`函数「${fullName}」已保存`) thisInfo.id = id this.info.ext.tmpScript = saveObj.script }) @@ -698,7 +700,10 @@ export default { .join(',') requestConfig.responseType = 'blob' requestConfig.validateStatus = () => true + let dataLen = 0 + let fullName = utils.replaceURL(`${target.groupName}/${target.name}(${target.groupPath}/${target.path})`) requestConfig.transformResponse = [function(data, headers){ + dataLen = data.size; if(headers['content-disposition']){ return new Promise(function(resolve){resolve(data)}); } @@ -714,13 +719,20 @@ export default { } }) }] - bus.$emit('status', '开始测试...') + bus.$emit('status', `开始测试「${fullName}」`) let start = new Date().getTime() request .execute(requestConfig) .then(res => { res.data.then(data =>{ - bus.$emit('status', `测试完毕,本次请求耗时:${new Date().getTime() - start}ms`) + let unit = ['B','KB','MB']; + let index = 0; + while(index < unit.length && dataLen >= 1024){ + dataLen = dataLen / 1024 + index++; + } + dataLen = dataLen.toFixed(2); + bus.$emit('status', `「${fullName}」测试完毕,状态:${res.status} 大小:${dataLen}${unit[index]} 耗时:${new Date().getTime() - start}ms`) const contentType = res.headers['content-type'] target.ext.debugDecorations && this.editor.deltaDecorations(target.ext.debugDecorations, []) target.ext.debugDecorations = target.ext.debugDecoration = null @@ -731,7 +743,6 @@ export default { bus.$emit('update-response-body-definition', target.responseBodyDefinition); bus.$emit('update-response-body', target.responseBody) } else { - bus.$emit('status', '脚本执行完毕') // 执行完毕 target.running = false bus.$emit('switch-tab', 'result') @@ -740,7 +751,7 @@ export default { }) }) .catch(error => { - bus.$emit('status', '请求出错...') + bus.$emit('status', `请求出错:「${fullName}」`) target.ext.debuging = target.running = false request.processError(error) }) diff --git a/magic-editor/src/console/src/components/layout/magic-event.vue b/magic-editor/src/console/src/components/layout/magic-event.vue index 30c6a537..8c337a8f 100644 --- a/magic-editor/src/console/src/components/layout/magic-event.vue +++ b/magic-editor/src/console/src/components/layout/magic-event.vue @@ -12,7 +12,7 @@