deleteUploadImgTaskPhoto.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <div class="deleteUploadImgTaskPhoto">
  3. <van-row gutter="10">
  4. <van-col
  5. span="6"
  6. style=""
  7. v-if="formData.processStatus != 1 || formData.displayRewardTaskEditable">
  8. <div class="addImg">
  9. <uploadVNormalTaskPhoto
  10. :imgArr="imgs"
  11. :formData="formData"
  12. :shouws="true"
  13. :storeGroupId="storeGroupId"
  14. :taskList="taskIds.split(',')"
  15. :collectionItemId="collectionItemId"
  16. :visitModel="1 + ''"
  17. :visitsId="visitsId"
  18. :putInCode="putInCode"
  19. :photoIdentifyType="photoIdentifyType"
  20. :pictureSource="pictureSource"
  21. :continuousShoot="continuousShoot"
  22. :objectType="objectType"
  23. @newimgarr="newimgarr"
  24. ref="uploadVNormal" />
  25. </div>
  26. </van-col>
  27. <van-col span="6" v-for="(urls, index) in imgs" :key="index">
  28. <div class="imgview">
  29. <van-icon
  30. v-if="formData.processStatus != 1 || formData.displayRewardTaskEditable"
  31. name="close"
  32. size="20"
  33. v-on:click="deleteImg(index, urls.fileIdSplicing)" />
  34. <img :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)" />
  35. <!-- <img
  36. v-else
  37. :src="urls.fileUrl"
  38. width="100px"
  39. height="100px"
  40. @click="previewsImg(index)" /> -->
  41. </div>
  42. </van-col>
  43. </van-row>
  44. </div>
  45. </template>
  46. <script>
  47. import { ImagePreview } from 'vant';
  48. import { removePhotoBatch } from '@/api/index';
  49. import uploadVNormalTaskPhoto from '@/components/uploadVNormalTaskPhoto';
  50. import { mapState } from 'vuex';
  51. import { getTicketFun } from '@/utils/TXApiFun';
  52. export default {
  53. name: 'deleteUploadImgTaskPhoto',
  54. components: { uploadVNormalTaskPhoto },
  55. computed: {
  56. ...mapState({
  57. userInfo: (state) => state.user.userInfo,
  58. }),
  59. },
  60. props: {
  61. formData: {
  62. type: Object,
  63. default() {
  64. return {};
  65. },
  66. },
  67. photoIdentifyType: {
  68. // 图匠识别目的(1:店招内容识别,2:门店代码识别,3:调色机识别,4:更换店招,6:sku陈列照)
  69. type: String,
  70. default: '',
  71. },
  72. storeGroupId: {
  73. type: String,
  74. },
  75. taskIds: {
  76. type: [Array, String],
  77. default() {
  78. return [];
  79. },
  80. },
  81. collectionItemId: {
  82. type: [String, Number],
  83. },
  84. visitsId: {
  85. type: String,
  86. default: '',
  87. },
  88. putInCode: {
  89. type: String,
  90. default: '',
  91. },
  92. pictureSource: {
  93. // 是否允许从相册选择图片 1:允许;0:不允许
  94. type: String,
  95. default: '0',
  96. },
  97. continuousShoot: {
  98. // 是否允许连拍/相册多选 1:允许;0:不允许
  99. type: String,
  100. default: '0',
  101. },
  102. objectType: {
  103. type: String,
  104. default: '',
  105. },
  106. insert: {
  107. type: String,
  108. default: 'false',
  109. },
  110. fileInfoList: {
  111. type: Array,
  112. default() {
  113. return [];
  114. },
  115. },
  116. imgs: {
  117. type: Array,
  118. default() {
  119. return [];
  120. },
  121. },
  122. },
  123. watch: {
  124. imgs: {
  125. handler(val) {},
  126. deep: true,
  127. immediate: true,
  128. },
  129. },
  130. data() {
  131. return {
  132. url: process.env.VUE_APP_Target1 + process.env.VUE_APP_BASE_API,
  133. };
  134. },
  135. methods: {
  136. deleteImg(index, fileIdList) {
  137. this.toastLoading(0, '请稍候...', true);
  138. removePhotoBatch({ fileIdList: fileIdList.split(',') }).then((res) => {
  139. if (res.code == 200) {
  140. this.$emit('upDataDetail');
  141. } else {
  142. this.$toast('删除失败!');
  143. }
  144. });
  145. },
  146. previewsImg(index) {
  147. var arrimg = [];
  148. for (var imgi = 0; imgi < this.imgs.length; imgi++) {
  149. arrimg.push(this.imgs[imgi].fileUrl);
  150. }
  151. ImagePreview({
  152. images: arrimg,
  153. startPosition: index,
  154. onClose() {
  155. // do something
  156. },
  157. });
  158. },
  159. newimgarr() {
  160. this.$emit('upDataDetail');
  161. },
  162. },
  163. };
  164. </script>
  165. <style lang="scss" scoped>
  166. .deleteUploadImgTaskPhoto {
  167. max-height: 180px;
  168. overflow-y: auto;
  169. margin-left: 20px;
  170. padding: 5px;
  171. }
  172. .addImg {
  173. height: 88px;
  174. display: flex;
  175. align-items: center;
  176. justify-content: center;
  177. background: #f5f5f5;
  178. }
  179. .imgview {
  180. width: 100%;
  181. height: 88px;
  182. position: relative;
  183. display: inline-block;
  184. i {
  185. position: absolute;
  186. right: -7px;
  187. top: -7px;
  188. color: white;
  189. background: red;
  190. overflow: hidden;
  191. border-radius: 50%;
  192. }
  193. img {
  194. width: 100%;
  195. height: 100%;
  196. }
  197. }
  198. </style>