Selaa lähdekoodia

修改图片上传缓存

long 3 vuotta sitten
vanhempi
commit
aeb288feb2

+ 7 - 6
operationSupport/src/views/propertyManagement/common/upImage.vue

@@ -42,7 +42,7 @@
 // import { getToken } from 'api/qiniu'
 
 export default {
-    name: 'EditorSlideUpload',
+    name: 'upImage',
     props: {
         color: {
             type: String,
@@ -69,10 +69,11 @@ export default {
     methods: {
         clearImageList(value) {
             console.log('clearImageList');
-            this.imageFileList = value;
-            this.fileList = value;
-            this.imagefileListAll = value;
-            this.$emit('clearImageList', value);
+            this.imageFileList = '';
+            this.fileList = '';
+            this.imagefileListAll = [];
+            this.$emit('successImageList', this.imagefileListAll);
+            // this.$emit('clearImageList', value);
         },
         onExceed(files, fileList) {
             this.$message.warning(`最多可选 ${this.limit}  张图片`);
@@ -129,7 +130,7 @@ export default {
             console.log('点击上传图片返回的回调 this.imageFileList', this.imageFileList);
             console.log('=============upImage=======================');
             this.$emit('successCBK', this.imageFileList);
-            console.log('this.$emitsuccessCBK', this.imageFileList);
+            console.log('this.$successImageList', this.imagefileListAll);
         },
 
         beforeUpload(file) {

+ 35 - 27
operationSupport/src/views/propertyManagement/inform.vue

@@ -196,7 +196,6 @@
                                                     @successCBK="imageSuccessCBK"
                                                     @deleteImage="deleteImage"
                                                     @successImageList="successImageList"
-                                                    @clearImageList="clearImageList"
                                                     ref="upImages"
                                                 ></up-image>
                                             </div>
@@ -338,6 +337,8 @@ export default {
     data() {
         let _this = this;
         return {
+            // 上传的图片
+            upLoadImageList: [],
             disabledHouse: true,
             disabledPeople: true,
             popCommunityName: '',
@@ -488,14 +489,13 @@ export default {
         this.mixins_query = {};
         this.mixins_search();
         this.getOrgTreeList();
-        // 显示弹框
         // this.getPeople();
-        if (this.$route.query.showDialog && this.$route.query.id && !this.$route.query.closeDialog) {
-            let row = {
-                id: this.$route.query.id
-            };
-            this.clickDatail(row);
-        }
+        // if (this.$route.query.showDialog && this.$route.query.id && !this.$route.query.closeDialog) {
+        //     let row = {
+        //         id: this.$route.query.id
+        //     };
+        //     this.clickDatail(row);
+        // }
     },
     mounted() {},
     watch: {
@@ -532,7 +532,9 @@ export default {
         // 弹框关闭事件
         handleDialogClose(e) {
             // console.log('handleDialogClose=========', e);
-            this.$refs.previeInform.closeDialog();
+            if (!!this.$refs.previeInform) {
+                this.$refs.previeInform.closeDialog();
+            }
         },
         // 人员树
         // dataPeople(data) {
@@ -571,8 +573,11 @@ export default {
 
         /**上传图片*/
         successImageList(arr) {
-            this.successImageLists = arr;
+            this.upLoadImageList = [];
+            this.upLoadImageList = arr;
+            console.log('上传图片inform', this.upLoadImageList);
         },
+        // 插入富文本
         imageSuccessCBK(arr) {
             this.$refs.endit.imageSuccessCBK(arr);
         },
@@ -692,9 +697,10 @@ export default {
                 this.ruleForm.exigencyText = true;
             }
         },
-        // 发布活动类型
+        // 选择发布活动类型
         changeInformType(val) {
             this.successImageLists = '';
+            this.upLoadImageList = [];
             if (val) {
                 this.showUploadImage = true;
             } else {
@@ -702,8 +708,10 @@ export default {
             }
             this.rowDetail = '';
             this.showDetail = true;
-            this.centerDialogVisible = true;
-            this.$refs.upImages.clearImageList('');
+            // if (this.showUploadImage == true) {
+            //     this.$refs.upImages.clearImageList('');
+            // }
+            // this.centerDialogVisible = true;
             if (!!this.$refs.endit) {
                 this.$refs.endit.setContent('');
             }
@@ -745,8 +753,12 @@ export default {
             this.filePath = '';
             this.uploadFileUrl = [];
             this.fileList = [];
-            this.$refs.endit.setContent('');
-            this.$refs['ruleForm'].resetFields();
+            if (!!this.$refs.endit) {
+                this.$refs.endit.setContent('');
+            }
+            if (!!this.$refs['ruleForm']) {
+                this.$refs['ruleForm'].resetFields();
+            }
             if (this.showUploadImage) {
                 this.$refs.upImages.clearImageList('');
             }
@@ -832,7 +844,7 @@ export default {
                             pubDate: this.$moment(new Date()).format(`YYYY-MM-DDTHH:mm:ss`),
                             //   pubPeople:ruleForm.informType,
                             //   pubStatus: "",
-                            themePictrue: JSON.stringify(this.successImageLists),
+                            themePictrue: JSON.stringify(this.upLoadImageList),
                             treeData: JSON.stringify(treeData),
                             // userId: this.ruleForm.issueRoom.checkAll
                             // ? this.selectDataHouseTreeData.userList
@@ -856,7 +868,7 @@ export default {
                                 this.mixins_search();
                                 this.$message.success(res.msg);
                                 this.$refs.endit.setContent('');
-                                this.successImageList = [];
+                                // this.successImageList = [];
                                 this.clear();
                                 this.$refs['ruleForm'].resetFields();
                                 if (this.showUploadImage) {
@@ -869,6 +881,7 @@ export default {
                                 // this.contentHtml = '';
                                 // this.clear();
                             }
+                            this.showUploadImage = false;
                             console.log('点击发布', res);
                         });
                     } else {
@@ -876,24 +889,19 @@ export default {
                     }
                 });
             } else if (type == 'clear') {
-                if (this.$route.query.showDialog) {
-                    this.$router.replace('/workbench/index');
-                }
+                // if (this.$route.query.showDialog) {
+                //     this.$router.replace('/workbench/index');
+                // }
                 this.centerDialogVisible = false;
                 this.clear();
                 if (!!this.$refs['ruleForm']) {
                     this.$refs['ruleForm'].resetFields();
                 }
-
-                if (this.showUploadImage) {
-                    this.$refs.upImages.clearImageList('');
-                }
             } else {
                 this.centerDialogVisible = false;
                 this.clear();
-                this.$refs['ruleForm'].resetFields();
-                if (this.showUploadImage) {
-                    this.$refs.upImages.clearImageList('');
+                if (!!this.$refs['ruleForm']) {
+                    this.$refs['ruleForm'].resetFields();
                 }
             }
         },