Browse Source

修改富文本复制图片内容

DESKTOP-4G80JF4\long 3 years ago
parent
commit
464d2ca94b

+ 1 - 5
operationSupport/src/components/Tinymce/index.vue

@@ -64,9 +64,7 @@ export default {
                 zh: 'zh_CN',
                 es: 'es_MX',
                 ja: 'ja'
-            },
-            // 图片上传
-            imgList: []
+            }
         };
     },
     computed: {
@@ -223,12 +221,10 @@ export default {
             if (arr) {
                 // 获取内容,允许上传图片的线上大小,个数
                 let content = window.tinymce.get(this.tinymceId).getContent();
-                this.imgList = [];
                 let img = [];
                 content.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/g, function (match, capture) {
                     img.push(capture);
                 });
-                this.imgList = img;
                 if (img.length >= 3) {
                     return this.$message.warning('最多插入三张图片');
                 }

+ 18 - 16
operationSupport/src/views/propertyManagement/common/upImage.vue

@@ -61,9 +61,8 @@ export default {
             // 大图
             imageUrl: '',
             //图片地址
-            imageFileList: [],
-            listObj: {},
-            imagefileListAll: [],
+            imageFileList: [], //插入富文本
+            imagefileListAll: [], //上传的所有图片
             fileList: []
         };
     },
@@ -81,21 +80,24 @@ export default {
         handleRemove(file) {
             if (file.response.msg === '成功') {
                 this.$message.success('移除成功');
+                console.log('file', file);
+                let removeName = this.imageFileList.filter((item) => {
+                    item.name !== file.name;
+                });
+                let removeNameList = this.imagefileListAll.filter((item) => {
+                    console.log('item.url', item.url);
+                    console.log('file.response.data', file.response.data);
+                    return item.url != file.response.data;
+                });
+                console.log('this.imageFil', this.imageFileList);
+                console.log('removeNameList', removeNameList);
+                this.imagefileListAll = removeNameList;
+                this.imageFileList = removeName;
+                this.$emit('successImageList', removeNameList);
+                this.$emit('deleteImage', file);
             } else {
                 return this.$message.success('移除失败');
             }
-            console.log('handleRemove', file);
-            let removeName = this.imageFileList.filter((item) => {
-                item.name !== file.name;
-            });
-            let removeNameList = this.imagefileListAll.filter((item) => {
-                item.name !== file.name;
-            });
-            this.imagefileListAll = removeNameList;
-            this.imageFileList = removeName;
-            this.$emit('successImageList', this.imagefileListAll);
-            this.$emit('deleteImage', file);
-            console.log('handleRemove', this.imageFileList);
         },
         handlePictureCardPreview(file) {
             this.dialogImageUrl = file.url;
@@ -111,7 +113,7 @@ export default {
         handleSuccess(response, file) {
             this.message(file.response.status, '图片上传');
             this.imageFileList = [];
-            if (this.imageFileList.length >= 3) {
+            if (this.imagefileListAll.length >= 3) {
                 return this.$message.warning(`最多可上传${this.limit}图片`);
             }
             let obj = {};

+ 8 - 2
operationSupport/src/views/propertyManagement/inform.vue

@@ -732,8 +732,14 @@ export default {
             if (type === 'prev') {
                 this.$refs['ruleForm'].validate((valid) => {
                     if (valid) {
-                        console.log('this.selectDataPeopleTreeData.userList', this.selectDataPeopleTreeData.userList);
-                        console.log('this.selectDataHouseTreeData.userList', this.selectDataHouseTreeData.userList);
+                        let content = this.ruleForm.editorContents;
+                        let img = [];
+                        content.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/g, function (match, capture) {
+                            img.push(capture);
+                        });
+                        if (img.length >= 3) {
+                            return this.$message.warning('最多插入三张图片');
+                        }
                         if (
                             this.selectDataHouseTreeData.userList.length === 0 &&
                             this.selectDataPeopleTreeData &&