From 48805484d492c8326dfe05fe8417e5012b19873b Mon Sep 17 00:00:00 2001 From: JEECG <445654970@qq.com> Date: Tue, 24 Sep 2024 22:47:44 +0800 Subject: [PATCH] =?UTF-8?q?MK=E7=BC=96=E8=BE=91=E5=99=A8=EF=BC=8C=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=B8=8A=E4=BC=A0=E5=A4=9A=E4=B8=AA=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Markdown/src/Markdown.vue | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/jeecgboot-vue3/src/components/Markdown/src/Markdown.vue b/jeecgboot-vue3/src/components/Markdown/src/Markdown.vue index 9cb94bee64..750236071b 100644 --- a/jeecgboot-vue3/src/components/Markdown/src/Markdown.vue +++ b/jeecgboot-vue3/src/components/Markdown/src/Markdown.vue @@ -12,6 +12,7 @@ import { onMountedOrActivated } from '/@/hooks/core/onMountedOrActivated'; import { getTenantId, getToken } from '/@/utils/auth'; import { getFileAccessHttpUrl } from '/@/utils/common/compUtils'; + import { uploadFile } from '@/api/common/api'; type Lang = 'zh_CN' | 'en_US' | 'ja_JP' | 'ko_KR' | undefined; @@ -161,7 +162,7 @@ //update-begin-author:taoyan date:2022-5-24 for: VUEN-1090 markdown 无法上传 upload: { accept: 'image/*', - url: uploadUrl, + //url: uploadUrl, fieldName: 'file', extraData: { biz: 'markdown' }, setHeaders() { @@ -173,6 +174,23 @@ format(files, response) { return formatResult(files, response); }, + // 遍历文件上传并展示 + async handler(files) { + const uploadSuccess = (res) => { + // {"success":true,"message":"markdown/aa_1653391146501.png","code":0,"result":null,"timestamp":1653391146501}' + if (res.success) { + vditorRef.value?.insertValue(`![${res.message}](${getFileAccessHttpUrl(res.message)})`); + } + }; + for (const file of files) { + let params = { + file: file, + filename: file.name, + data: { biz: 'markdown' }, + }; + await uploadFile(params, uploadSuccess); + } + }, }, //update-end-author:taoyan date:2022-5-24 for: VUEN-1090 markdown 无法上传 input: (v) => {