From e673f6b069a999ab51df95909b529ae6ea0fa962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=97=AB=E6=99=93=E8=8C=B9?= <1935832701@qq.com> Date: Sun, 23 Apr 2023 17:31:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Editor/index.vue | 56 ++++--- src/views/system/trainingItem/index.vue | 190 +++++++++++------------- 2 files changed, 120 insertions(+), 126 deletions(-) diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue index 32c29b4..a7e251d 100644 --- a/src/components/Editor/index.vue +++ b/src/components/Editor/index.vue @@ -9,6 +9,7 @@ :show-file-list="false" :headers="headers" style="display: none" + :data="filetype" ref="upload" v-if="this.type == 'url'" > @@ -29,39 +30,47 @@ export default { /* 编辑器的内容 */ value: { type: String, - default: "" + default: "", }, /* 高度 */ height: { type: Number, - default: null + default: null, }, /* 最小高度 */ minHeight: { type: Number, - default: null + default: null, }, /* 只读 */ readOnly: { type: Boolean, - default: false + default: false, }, // 上传文件大小限制(MB) fileSize: { type: Number, - default: 5 + default: 5, }, /* 类型(base64格式、url格式) */ type: { type: String, - default: "url" - } + default: "url", + }, + url: { + type: String, + default: "", + }, + filetypes: { + type: String, + default: "", + }, }, data() { return { - uploadUrl: process.env.VUE_APP_BASE_API + "/common/richTextPictureUrl", // 上传的图片服务器地址 + uploadUrl: process.env.VUE_APP_BASE_API, // 上传的图片服务器地址 headers: { - Authorization: "Bearer " + getToken() + Authorization: "Bearer " + getToken(), }, Quill: null, currentValue: "", @@ -81,14 +90,23 @@ export default { [{ color: [] }, { background: [] }], // 字体颜色、字体背景颜色 [{ align: [] }], // 对齐方式 ["clean"], // 清除文本格式 - ["link", "image"] // 链接、图片、视频 - ] + ["link", "image"], // 链接、图片、视频 + ], }, placeholder: "请输入内容", - readOnly: this.readOnly - } + readOnly: this.readOnly, + }, + filetype: { + type: "", + }, }; }, + created() { + this.uploadUrl = process.env.VUE_APP_BASE_API + this.url; + console.log(this.uploadUrl); + this.filetype.type = this.filetypes; + console.log(this.filetype); + }, computed: { styles() { let style = {}; @@ -99,7 +117,7 @@ export default { style.height = `${this.height}px`; } return style; - } + }, }, watch: { value: { @@ -111,8 +129,8 @@ export default { } } }, - immediate: true - } + immediate: true, + }, }, mounted() { this.init(); @@ -127,7 +145,7 @@ export default { // 如果设置了上传地址则自定义图片上传事件 if (this.type == "url") { let toolbar = this.Quill.getModule("toolbar"); - toolbar.addHandler("image", value => { + toolbar.addHandler("image", (value) => { this.uploadType = "image"; if (value) { this.$refs.upload.$children[0].$refs.input.click(); @@ -189,8 +207,8 @@ export default { }, handleUploadError() { this.$message.error("图片插入失败"); - } - } + }, + }, }; diff --git a/src/views/system/trainingItem/index.vue b/src/views/system/trainingItem/index.vue index 2811e5e..85208e5 100644 --- a/src/views/system/trainingItem/index.vue +++ b/src/views/system/trainingItem/index.vue @@ -364,90 +364,6 @@ >{{ form.trainingCategoryName }} - - - - - - - - - - - - - - - - - - - - - - @@ -534,6 +450,8 @@ > @@ -630,6 +548,74 @@ placeholder="请输入培训项目排序" /> + + + + + + + + + + + + + + + + + + + + + +