Bladeren bron

渠道客诉填写任务增加上传照片功能

zhujindu 11 maanden geleden
bovenliggende
commit
6e671c33d3
2 gewijzigde bestanden met toevoegingen van 38 en 28 verwijderingen
  1. 23 23
      src/components/complaintImg.vue
  2. 15 5
      src/views/clew/complaintDetail/radioGroup.vue

+ 23 - 23
src/components/complaintImg.vue

@@ -9,16 +9,12 @@
 <script>
 import { ImagePreview } from 'vant';
 import axios from 'axios';
-import { uploadImagev } from '@/api/index';
+import { addPhotoK } from '@/api/index';
 import { getPosition, getTicketFun } from '@/utils/TXApiFun';
 
 export default {
   name: 'uploadImg',
   props: {
-    imgArr: {
-      type: String,
-      default: '',
-    },
     itemData: {
       type: Object,
       default: {},
@@ -28,6 +24,14 @@ export default {
       type: Boolean,
       default: true,
     },
+    customerClueId: {
+      type: String | Number,
+      default: '',
+    },
+    customerClueItemId: {
+      type: String | Number,
+      default: '',
+    },
   },
   data() {
     return {};
@@ -64,29 +68,27 @@ export default {
               localId: localIds, // 需要上传的图片的本地ID,由chooseImage接口获得
               isShowProgressTips: 1, // 默认为1,显示进度提示
               success: (res) => {
-                this.uploadImagev(res.serverId);
+                this.addPhotoK(res.serverId);
               },
             });
           },
         });
       });
     },
-    uploadImagev(meidaId) {
+    addPhotoK(meidaId) {
       var form = {
         mediaId: meidaId,
+        customerClueId: this.customerClueId,
+        customerClueItemId: this.customerClueItemId,
       };
       this.toastLoading(0, '加载中...', true);
-      uploadImagev(form).then((res) => {
+      addPhotoK(form).then((res) => {
         this.toastLoading().clear();
         if (res.code == 200) {
-          let imgArr = [];
-          res.data.forEach((item) => {
-            imgArr.push(item.url);
-          });
           this.$toast('上传成功!');
           this.$emit('newimgarr', {
-            fileUrl: imgArr.join(','),
-            itemData: itemData,
+            fileUrl: res.data.url,
+            itemData: this.itemData,
           });
         } else {
           this.$toast('上传失败!');
@@ -99,17 +101,16 @@ export default {
 
 <style scoped>
 .cameraDiv1 {
-  position: relative;
-  height: 20px;
+  height: 100%;
   width: 100%;
 }
 
 .cameraDiv1 img {
-  position: absolute;
+  /* position: absolute;
   width: 100%;
   display: block;
   height: 20px;
-  top: 0;
+  top: 0; */
 }
 
 .imgPre {
@@ -138,12 +139,11 @@ export default {
 }
 
 .coverImg {
-  text-align: right;
-  position: absolute;
-  top: 0;
-  right: 0;
-  height: 20px;
+  height: 100%;
   width: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
   margin: 0;
 }
 

+ 15 - 5
src/views/clew/complaintDetail/radioGroup.vue

@@ -73,19 +73,20 @@
           </template>
           <template #right-icon>
             <span v-if="val.isMust == '0'" style="color: red">图片必填</span>
-            <div class="uploadImg" style="width: 30px">
+            <div class="uploadImg">
               <complaintImg
                 uploadid="uploadid2"
                 :itemData="val"
-                :imgArr="val.answerValue"
                 @newimgarr="newimgarr1"
+                :customerClueId="val.customerClueId"
+                :customerClueItemId="val.customerClueItemId"
                 :required="false">
               </complaintImg>
             </div>
             <!-- <van-icon color="#666" name="photograph" size="24" @click="imgClick(val)" /> -->
           </template>
         </van-cell>
-        <deleteImgView :imgs="val.answerValue"></deleteImgView>
+        <deleteImgView :imgs="val.fileInfoList"></deleteImgView>
       </template>
     </template>
   </div>
@@ -165,8 +166,14 @@ export default {
     },
     newimgarr1(val) {
       console.lg(val);
-      this.$set(val.itemData, 'answerValue', val.fileUrl);
-      // this.fromValue.carShopImgList.push(val.fileUrl);
+      if (val.itemData.fileInfoList == null || val.itemData.fileInfoList == undefined) {
+        val.itemData.fileInfoList == [];
+        val.itemData.fileIdList == [];
+      }
+      let fileInfoList = val.itemData.fileInfoList.push(val.id);
+      let fileIdList = val.itemData.fileIdList.push(val.id);
+      this.$set(val.itemData, 'fileInfoList', fileInfoList);
+      this.$set(val.itemData, 'fileIdList', fileIdList);
     },
   },
 };
@@ -219,5 +226,8 @@ export default {
     font-size: 12px;
     padding: 3px 0;
   }
+  .uploadImg {
+    width: 50px;
+  }
 }
 </style>