瀏覽代碼

富文本添加图片

lizhenhao 2 年之前
父節點
當前提交
c5da4f3fab

+ 6 - 3
src/components/editor/WangEditor.vue

@@ -50,11 +50,12 @@ export default {
     seteditor () {
       this.editor = new E(this.$refs.toolbar, this.$refs.editor)
       this.editor.customConfig.uploadImgShowBase64 = true // base 64 存储图片
-      this.editor.customConfig.uploadImgServer = ''// 配置服务器端地址
+      // eslint-disable-next-line no-template-curly-in-string
+      this.editor.customConfig.uploadImgServer = `${this.$http.BASE_URL}/oss/file/webUpload/upload`// 配置服务器端地址
       this.editor.customConfig.uploadImgHeaders = { }// 自定义 header
-      this.editor.customConfig.uploadFileName = '' // 后端接受上传文件的参数名
+      this.editor.customConfig.uploadFileName = 'file' // 后端接受上传文件的参数名
       this.editor.customConfig.uploadImgMaxSize = 2 * 1024 * 1024 // 将图片大小限制为 2M
-      this.editor.customConfig.uploadImgMaxLength = 6 // 限制一次最多上传 3 张图片
+      this.editor.customConfig.uploadImgMaxLength = 1 // 限制一次最多上传 3 张图片
       this.editor.customConfig.uploadImgTimeout = 3 * 60 * 1000 // 设置超时时间
       this.editor.customConfig.menus = [
         'head', // 标题
@@ -84,6 +85,8 @@ export default {
         },
         success: (xhr, editor, result) => {
           // 图片上传成功回调
+          // editor.txt.append('<img style="max-width: 650px" src=' + result.lsUrl + '></img>')
+          editor.uploadImg.insertLinkImg(result.lsUrl)
         },
         timeout: (xhr, editor) => {
           // 网络超时的回调

+ 0 - 1
src/views/common/UpLoadComponent.vue

@@ -161,7 +161,6 @@
           } else {
             this.uploadFlag = uploadFlag
           }
-          console.log(this.uploadFlag)
         }
         if (this.commonJS.isEmpty(delFlag)) {
           this.delFlag = false

+ 1 - 1
src/views/modules/program/registered/ProjectThreeAuditForm.vue

@@ -269,7 +269,7 @@
               this.$refs.contents1Editor.init(this.inputForm.detailOpinion)
             }
             if (this.commonJS.isNotEmpty(this.inputForm.reportOpinion)) {
-              this.$refs.contents2Editor.init(this.inputForm.reportOpinion, false)
+              this.$refs.contents2Editor.init(this.inputForm.reportOpinion)
             }
             if (this.commonJS.isNotEmpty(this.inputForm.remarksOpinion)) {
               this.$refs.contents3Editor.init(this.inputForm.remarksOpinion)