From be7c359f6cd06ff65c434b8942695c2edda247a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=86=E9=92=B1=E8=90=BD=E5=B0=BD=E6=A7=BF=E8=8A=B1?= =?UTF-8?q?=E7=A8=80?= <2675540038@qq.com> Date: Wed, 16 Apr 2025 10:38:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E5=86=85=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=EF=BC=9A=E6=8F=92=E5=85=A5=E8=A7=86=E9=A2=91=EF=BC=8C?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=A7=86=E9=A2=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/paper/article/index.vue | 22 +++++- src/views/paper/article/update.vue | 109 +++++++++++++++++------------ 2 files changed, 82 insertions(+), 49 deletions(-) diff --git a/src/views/paper/article/index.vue b/src/views/paper/article/index.vue index 8bfd8af..4168618 100644 --- a/src/views/paper/article/index.vue +++ b/src/views/paper/article/index.vue @@ -140,9 +140,6 @@ const toolbarConfig = { showLinkImg: false, uploadImgShowBase64: true, excludeKeys: [ - 'insertVideo', // 删除视频 - 'uploadVideo', - 'group-video', 'insertImage',// 删除网络图片上传 'insertLink',// 删除链接 'insertTable',// 删除表格 @@ -172,6 +169,25 @@ const editorConfig = { koiNoticeError('图片限制为1M,请调整好再上传!'); } }, + }, + uploadVideo: { + maxFileSize: 50 * 1024 * 1024, + server: import.meta.env.VITE_WEB_BASE_API + '/api/common/upload', + fieldName: 'file', + meta: { + association_id: 0, + }, + customInsert(res, insertFn) { // TS 语法 + // customInsert(res, insertFn) { // JS 语法 + // res 即服务端的返回结果 + console.log(res); + // 从 res 中找到 url alt href ,然后插入图片 + insertFn(res.data.fullurl, '', '') + }, onError: (file, err, res) => { + if (err.message.indexOf('exceeds maximum allowed size') !== -1) { + koiNoticeError('视频限制为50M,请调整好再上传!'); + } + }, } } } diff --git a/src/views/paper/article/update.vue b/src/views/paper/article/update.vue index 6affb44..ea571bc 100644 --- a/src/views/paper/article/update.vue +++ b/src/views/paper/article/update.vue @@ -4,16 +4,17 @@
请在图片边框内选定区域
- -
+ +
image + @click="handleClick" + style="cursor: crosshair; position: relative; user-select: none; width: 100%; height: auto;" + @load="onImageLoad" /> + style="position: absolute; top: 0; left: 0; pointer-events: none;">
@@ -21,29 +22,29 @@ - + - + - + - + 重新选择 - + - + - + + @onCreated="handleCreated" /> @@ -59,24 +60,24 @@