From ea1c70e1aa26ef9eb3a1e929e2958816a0f79277 Mon Sep 17 00:00:00 2001 From: dd3s_206 Date: Thu, 17 Sep 2026 09:48:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=9A=E9=9B=85=E5=AD=A6=E8=8B=91=E5=93=81?= =?UTF-8?q?=E7=89=8C=E6=B4=BB=E5=8A=A8-=E5=9F=B9=E8=AE=AD=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8-=E6=96=B0=E5=BB=BA=E6=B4=BB=E5=8A=A8=EF=BC=9A?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8=E4=BB=8B=E7=BB=8D=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=8F=92=E5=85=A5=E5=9B=BE=E7=89=87=E6=97=B6=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E2=80=98=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87=E2=80=99tab(?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E4=BF=9D=E7=95=99=E7=BD=91=E7=BB=9C=E5=9B=BE?= =?UTF-8?q?=E7=89=87tab);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trainSingUp/manage/activity_add.html | 62 +++++++++++++------ 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/src/main/resources/views/platform/trainSingUp/manage/activity_add.html b/src/main/resources/views/platform/trainSingUp/manage/activity_add.html index 3ca06f2..8609307 100644 --- a/src/main/resources/views/platform/trainSingUp/manage/activity_add.html +++ b/src/main/resources/views/platform/trainSingUp/manage/activity_add.html @@ -120,6 +120,45 @@ layout("/layouts/platform.html"){ }, }, methods: { + initIntroduceEditor(content) { + $("#introduce").html("") + const editor = new E("#introduce") + editor.config.onchange = (html) => { + this.formData.introduce = html.replace(/<\/p>/g, '') + } + editor.config.customUploadImg = (resultFiles, insertImgFn) => { + Promise.all(this.uploadIntroduceImages(resultFiles)).then(res => { + res.forEach(v => { + if (v.code === 0) { + insertImgFn(APP_DOMAIN + CREATE_PREVIEW_URL(v.data.filepath)) + } else { + this.$message.warning(v.msg || '图片上传失败') + } + }) + }).catch(() => { + this.$message.warning('图片上传失败') + }) + } + editor.config.showLinkImg = true + editor.create() + if (content) { + editor.txt.html(content) + } + }, + uploadIntroduceImages(resultFiles) { + return resultFiles.map(file => { + const formData = new FormData() + formData.append('file', file, file.name) + formData.append('folderPath', '/wangEditorImg/') + return jQuery.ajax({ + url: '/file_server/uploadFile', + type: 'post', + data: formData, + processData: false, + contentType: false + }) + }) + }, openUserScope() { this.userScopeDialog = true }, @@ -491,23 +530,12 @@ layout("/layouts/platform.html"){ const type = this.trainTypeList.find(o => o.code === this.formData.trainType) this.trainType = type ? type.name : '培训班' this.$nextTick(() => { - $("#introduce").html("") - var editor = new E("#introduce") - editor.config.onchange = (html) => { - this.formData.introduce = html.replace(/<\/p>/g, '') - } - editor.create() - editor.txt.html(resp.data.introduce) + this.initIntroduceEditor(resp.data.introduce) }) } } else { this.$nextTick(() => { - $("#introduce").html("") - var editor = new E("#introduce") - editor.config.onchange = (html) => { - this.formData.introduce = html.replace(/<\/p>/g, '') - } - editor.create() + this.initIntroduceEditor() }) } }, @@ -684,13 +712,7 @@ layout("/layouts/platform.html"){ const type = this.trainTypeList.find(o => o.code === this.formData.trainType) this.trainType = type ? type.name : '培训班' this.$nextTick(() => { - $("#introduce").html("") - var editor = new E("#introduce") - editor.config.onchange = (html) => { - this.formData.introduce = html.replace(/<\/p>/g, '') - } - editor.create() - editor.txt.html(resp.data.introduce) + this.initIntroduceEditor(resp.data.introduce) }) this.formData.id = '' }