deleteUploadImgTaskPhoto.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <div class="deleteUploadImgTaskPhoto">
  3. <van-row gutter="10">
  4. <van-col span="6" style="" v-if="insert == '1'">
  5. <div class="addImg">
  6. <uploadVNormalTaskPhoto
  7. :shouws="true"
  8. :storeGroupId="storeGroupId"
  9. :taskList="taskIds.split(',')"
  10. :collectionItemId="collectionItemId"
  11. :visitModel="1 + ''"
  12. :visitsId="visitsId"
  13. :putInCode="putInCode"
  14. :photoIdentifyType="photoIdentifyType"
  15. :pictureSource="pictureSource"
  16. :continuousShoot="continuousShoot"
  17. :objectType="objectType"
  18. @newimgarr="newimgarr"
  19. ref="uploadVNormal" />
  20. </div>
  21. </van-col>
  22. <van-col span="6" v-for="(id, index) in imgArr" :key="index">
  23. <div class="imgview">
  24. <van-icon v-if="insert == '1'" name="close" size="16" v-on:click="deleteImg(index)" />
  25. <img :src="id" width="100px" height="100px" @click="previewsImg(index)" />
  26. <!-- <img
  27. v-else
  28. :src="urls.fileUrl"
  29. width="100px"
  30. height="100px"
  31. @click="previewsImg(index)" /> -->
  32. </div>
  33. </van-col>
  34. </van-row>
  35. </div>
  36. </template>
  37. <script>
  38. import { ImagePreview } from 'vant';
  39. import { removePhotoBatch } from '@/api/index';
  40. import uploadVNormalTaskPhoto from '@/components/uploadVNormalTaskPhoto';
  41. export default {
  42. name: 'deleteUploadImgTaskPhoto',
  43. components: { uploadVNormalTaskPhoto },
  44. props: {
  45. imgs: {
  46. type: Array,
  47. default() {
  48. return [];
  49. },
  50. },
  51. photoIdentifyType: {
  52. // 图匠识别目的(1:店招内容识别,2:门店代码识别,3:调色机识别,4:更换店招,6:sku陈列照)
  53. type: String,
  54. default: '',
  55. },
  56. storeGroupId: {
  57. type: String,
  58. },
  59. taskIds: {
  60. type: [Array, String],
  61. default() {
  62. return [];
  63. },
  64. },
  65. collectionItemId: {
  66. type: [String, Number],
  67. },
  68. visitsId: {
  69. type: String,
  70. default: '',
  71. },
  72. putInCode: {
  73. type: String,
  74. default: '',
  75. },
  76. pictureSource: {
  77. // 是否允许从相册选择图片 1:允许;0:不允许
  78. type: String,
  79. default: '0',
  80. },
  81. continuousShoot: {
  82. // 是否允许连拍/相册多选 1:允许;0:不允许
  83. type: String,
  84. default: '0',
  85. },
  86. objectType: {
  87. type: String,
  88. default: '',
  89. },
  90. insert: {
  91. type: String,
  92. default: '0',
  93. },
  94. },
  95. watch: {
  96. imgs: {
  97. handler(val) {
  98. this.imgArr = val;
  99. },
  100. deep: true,
  101. immediate: true,
  102. },
  103. },
  104. data() {
  105. return {
  106. url: process.env.VUE_APP_Target1 + process.env.VUE_APP_BASE_API,
  107. imgArr: [],
  108. };
  109. },
  110. methods: {
  111. deleteImg(index) {
  112. this.imgArr.splice(index, 1);
  113. },
  114. previewsImg(index) {
  115. ImagePreview({
  116. images: this.imgArr,
  117. startPosition: index,
  118. });
  119. },
  120. newimgarr(localIds) {
  121. console.log('localIds', localIds);
  122. this.imgArr = this.imgArr.concat(localIds);
  123. // this.$emit('upDataDetail');
  124. },
  125. },
  126. };
  127. </script>
  128. <style lang="scss" scoped>
  129. .deleteUploadImgTaskPhoto {
  130. margin-left: 20px;
  131. }
  132. .addImg {
  133. height: 88px;
  134. display: flex;
  135. align-items: center;
  136. justify-content: center;
  137. background: #f5f5f5;
  138. }
  139. .imgview {
  140. width: 100%;
  141. height: 88px;
  142. position: relative;
  143. display: inline-block;
  144. i {
  145. position: absolute;
  146. right: -2px;
  147. top: -3px;
  148. color: white;
  149. background: red;
  150. overflow: hidden;
  151. border-radius: 50%;
  152. }
  153. img {
  154. width: 100%;
  155. height: 100%;
  156. }
  157. }
  158. </style>