From cba6469833f459c272e80595374d70859d789fd8 Mon Sep 17 00:00:00 2001 From: wujiasheng03 Date: Thu, 28 Mar 2024 20:17:55 +0800 Subject: [PATCH 1/4] fix pic bug and optimize desc content --- frontend/package.json | 1 + .../src/components/event/EventInspector.vue | 10 +++++++--- .../src/components/form/AttachmentModal.vue | 2 +- .../src/components/form/AttachmentsList.vue | 20 +++++++++++++++++++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 1031be0..578f2cc 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,6 +9,7 @@ "dependencies": { "@toast-ui/vue-image-editor": "^1.0.2", "axios": "^0.27.2", + "compressorjs": "^1.2.1", "crypto": "^1.0.1", "monaco-editor": "^0.26.1", "socket.io-client": "^3.1.3", diff --git a/frontend/src/components/event/EventInspector.vue b/frontend/src/components/event/EventInspector.vue index 9338aaa..2b65075 100644 --- a/frontend/src/components/event/EventInspector.vue +++ b/frontend/src/components/event/EventInspector.vue @@ -240,12 +240,16 @@ export default { } let url = eventObj.flow.request.url let method = eventObj.flow.request.method - let requestData = JSON.stringify(eventObj.flow.request.data) + let requestData = JSON.stringify(eventObj.flow.request.data, null, '\t') if (requestData === undefined) { requestData = JSON.stringify({}) } - let response = JSON.stringify(eventObj.flow.response) - let message = `URL: ${url}\nMethod: ${method}\nRequestData: ${requestData}\nResponse: ${response}` + let stringifyResponse = '{\n' + for (let key in eventObj.flow.response) { + stringifyResponse += `\t"${key}": ${JSON.stringify(eventObj.flow.response[key])},\n` + } + stringifyResponse = stringifyResponse.slice(0, -2) + '\n}' + let message = `URL: ${url}\nMethod: ${method}\nRequestData: ${requestData}\nResponse: ${stringifyResponse}` return message }, getAttachmentObj (eventObj) { diff --git a/frontend/src/components/form/AttachmentModal.vue b/frontend/src/components/form/AttachmentModal.vue index 804a96b..a1af6ab 100644 --- a/frontend/src/components/form/AttachmentModal.vue +++ b/frontend/src/components/form/AttachmentModal.vue @@ -61,7 +61,7 @@ export default { const imageFileSuffix = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'wbmp', 'webp', 'tif', 'psd'] let nameSplit = this.attachmentName.split('.') - let nameSuffix = nameSplit[nameSplit.length - 1] + let nameSuffix = nameSplit[nameSplit.length - 1].toLowerCase() return imageFileSuffix.indexOf(nameSuffix) > -1 }, diff --git a/frontend/src/components/form/AttachmentsList.vue b/frontend/src/components/form/AttachmentsList.vue index 6696553..db612d5 100644 --- a/frontend/src/components/form/AttachmentsList.vue +++ b/frontend/src/components/form/AttachmentsList.vue @@ -16,6 +16,7 @@ :format="['jpg','jpeg','png','gif','bmp','wbmp','webp','tif','psd']" accept=".jpg,.jpeg,.png,.gif,.bmp,.wbmp,.webp,.tif,.psd" :show-upload-list="false" + :before-upload="handleBeforeUpload" > import AttachmentItem from '@/components/form/AttachmentItem.vue' import ExportAttachmentItem from '@/components/form/ExportAttachmentItem.vue' +import Compressor from "compressorjs" export default { components: { @@ -56,6 +58,24 @@ export default { }, addExportAttachment (exportAttachment) { this.$store.dispatch('addExportAttachment', exportAttachment) + }, + handleBeforeUpload (file) { + return new Promise((resolve, reject) => { + let isLt1M = file.size / 1024 / 1024 < 2; + if (isLt1M) { + resolve(file); + } else { + new Compressor(file, { + quality: 0.8, + success: res =>{ + resolve(new File([res], res.name, {type: res.type, lastModified: res.lastModified})); + }, + error(err) { + reject(err) + } + }); + } + }); } } } From ddad63b1a703ab6e916d7ce37e1f7c873d721246 Mon Sep 17 00:00:00 2001 From: wujiasheng03 Date: Thu, 28 Mar 2024 20:19:42 +0800 Subject: [PATCH 2/4] version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f672197..85ff271 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name='lyrebird-bugit', - version='1.16.0', + version='1.16.1', packages=['lyrebird_bugit'], url='https://github.com/Meituan-Dianping/lyrebird-bugit', author='HBQA', From af538c112d097e363791719136fb72b9c181e7a2 Mon Sep 17 00:00:00 2001 From: wujiasheng03 Date: Thu, 28 Mar 2024 20:30:03 +0800 Subject: [PATCH 3/4] delete useless code --- frontend/src/components/event/EventInspector.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/event/EventInspector.vue b/frontend/src/components/event/EventInspector.vue index 2b65075..6cc6c59 100644 --- a/frontend/src/components/event/EventInspector.vue +++ b/frontend/src/components/event/EventInspector.vue @@ -240,13 +240,13 @@ export default { } let url = eventObj.flow.request.url let method = eventObj.flow.request.method - let requestData = JSON.stringify(eventObj.flow.request.data, null, '\t') + let requestData = JSON.stringify(eventObj.flow.request.data) if (requestData === undefined) { requestData = JSON.stringify({}) } let stringifyResponse = '{\n' for (let key in eventObj.flow.response) { - stringifyResponse += `\t"${key}": ${JSON.stringify(eventObj.flow.response[key])},\n` + stringifyResponse += `"${key}": ${JSON.stringify(eventObj.flow.response[key])},\n` } stringifyResponse = stringifyResponse.slice(0, -2) + '\n}' let message = `URL: ${url}\nMethod: ${method}\nRequestData: ${requestData}\nResponse: ${stringifyResponse}` From 756a8219a719ed893fc49ef40a1f76f48efe72f8 Mon Sep 17 00:00:00 2001 From: wujiasheng03 Date: Fri, 29 Mar 2024 10:07:34 +0800 Subject: [PATCH 4/4] del compressor --- frontend/package.json | 1 - .../src/components/form/AttachmentsList.vue | 20 ------------------- 2 files changed, 21 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 578f2cc..1031be0 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -9,7 +9,6 @@ "dependencies": { "@toast-ui/vue-image-editor": "^1.0.2", "axios": "^0.27.2", - "compressorjs": "^1.2.1", "crypto": "^1.0.1", "monaco-editor": "^0.26.1", "socket.io-client": "^3.1.3", diff --git a/frontend/src/components/form/AttachmentsList.vue b/frontend/src/components/form/AttachmentsList.vue index db612d5..6696553 100644 --- a/frontend/src/components/form/AttachmentsList.vue +++ b/frontend/src/components/form/AttachmentsList.vue @@ -16,7 +16,6 @@ :format="['jpg','jpeg','png','gif','bmp','wbmp','webp','tif','psd']" accept=".jpg,.jpeg,.png,.gif,.bmp,.wbmp,.webp,.tif,.psd" :show-upload-list="false" - :before-upload="handleBeforeUpload" > import AttachmentItem from '@/components/form/AttachmentItem.vue' import ExportAttachmentItem from '@/components/form/ExportAttachmentItem.vue' -import Compressor from "compressorjs" export default { components: { @@ -58,24 +56,6 @@ export default { }, addExportAttachment (exportAttachment) { this.$store.dispatch('addExportAttachment', exportAttachment) - }, - handleBeforeUpload (file) { - return new Promise((resolve, reject) => { - let isLt1M = file.size / 1024 / 1024 < 2; - if (isLt1M) { - resolve(file); - } else { - new Compressor(file, { - quality: 0.8, - success: res =>{ - resolve(new File([res], res.name, {type: res.type, lastModified: res.lastModified})); - }, - error(err) { - reject(err) - } - }); - } - }); } } }