|
|
@@ -2,9 +2,14 @@
|
|
|
<div>
|
|
|
<van-col span="6" v-for="(urls, index) in imgs" :key="index">
|
|
|
<div class="imgview2">
|
|
|
- <van-icon name="close" size="16" v-on:click="deleteImg(index,urls.id)"/>
|
|
|
- <img v-if="urls.type=='2'" :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)"/>
|
|
|
- <img v-else :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)"/>
|
|
|
+ <van-icon name="close" size="16" v-on:click="deleteImg(index, urls.id)" />
|
|
|
+ <img
|
|
|
+ v-if="urls.type == '2'"
|
|
|
+ :src="urls.fileUrl"
|
|
|
+ width="100px"
|
|
|
+ height="100px"
|
|
|
+ @click="previewsImg(index)" />
|
|
|
+ <img v-else :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)" />
|
|
|
</div>
|
|
|
</van-col>
|
|
|
</div>
|
|
|
@@ -18,8 +23,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {ImagePreview} from "vant";
|
|
|
-import {removeSummaryPhoto, removePhoto} from "@/api/index";
|
|
|
+import { ImagePreview } from 'vant';
|
|
|
+import { removeSummaryPhoto, removePhoto } from '@/api/index';
|
|
|
|
|
|
export default {
|
|
|
name: 'deleteUploadImg',
|
|
|
@@ -27,44 +32,44 @@ export default {
|
|
|
imgs: {
|
|
|
type: Array,
|
|
|
default() {
|
|
|
- return []
|
|
|
- }
|
|
|
+ return [];
|
|
|
+ },
|
|
|
},
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- url: process.env.VUE_APP_Target1 + process.env.VUE_APP_BASE_API
|
|
|
- }
|
|
|
+ url: process.env.VUE_APP_Target1 + process.env.VUE_APP_BASE_API,
|
|
|
+ };
|
|
|
},
|
|
|
methods: {
|
|
|
deleteImg(index, collectionItemId) {
|
|
|
- var fileName={
|
|
|
- fileId:collectionItemId
|
|
|
- }
|
|
|
- removeSummaryPhoto(fileName).then(res => {
|
|
|
+ var fileName = {
|
|
|
+ fileId: collectionItemId,
|
|
|
+ };
|
|
|
+ removeSummaryPhoto(fileName).then((res) => {
|
|
|
if (res.code == 200) {
|
|
|
- this.$toast("删除成功!")
|
|
|
+ this.$toast('删除成功!');
|
|
|
this.imgs.splice(index, 1);
|
|
|
} else {
|
|
|
- this.$toast("删除失败!")
|
|
|
+ this.$toast('删除失败!');
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
previewsImg(index) {
|
|
|
- var arrimg = []
|
|
|
+ var arrimg = [];
|
|
|
for (var imgi = 0; imgi < this.imgs.length; imgi++) {
|
|
|
- arrimg.push(this.imgs[imgi].fileUrl)
|
|
|
+ arrimg.push(this.imgs[imgi].fileUrl);
|
|
|
}
|
|
|
ImagePreview({
|
|
|
images: arrimg,
|
|
|
startPosition: index,
|
|
|
onClose() {
|
|
|
// do something
|
|
|
- }
|
|
|
+ },
|
|
|
});
|
|
|
},
|
|
|
},
|
|
|
-}
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|