相册删除

This commit is contained in:
liuye
2021-12-24 21:54:34 +08:00
parent a743dbd6df
commit 591dc206bc

View File

@@ -33,15 +33,15 @@
<div class="img-item" v-for="(e, indexs) in item.list" :key="indexs">
<p>{{e.createUserName}} 上传</p>
<img :src="e.url" alt="" @click.stop="previewImage(item.list, e.url)">
<span class="cir-icon" v-if="editText== '取消' && !i.isCheked" @click="checkImg(e, index, indexs)"></span>
<u-icon name="checkmark-circle-fill" color="#26f" size="40" class="del-icon" @click="delSelect(e, index, indexs)" v-if="editText== '取消' && i.isCheked"></u-icon>
<span class="cir-icon" v-if="editText== '取消' && !e.isCheked" @click="checkImg(e, index, indexs)"></span>
<u-icon name="checkmark-circle-fill" color="#26f" size="54" class="del-icon" @click="delSelect(e, index, indexs)" v-if="editText== '取消' && e.isCheked"></u-icon>
</div>
</div>
</div>
</div>
<div class="footer-btn" @click="uploadImg" v-if="editText == '编辑' ">上传图片</div>
<div class="footer-btn" @click="del" v-if="editText == '取消' ">确定</div>
<div class="footer-btn" @click="delConfirm" v-if="editText == '取消'">确定</div>
</div>
</template>
@@ -72,18 +72,20 @@ export default {
},
methods: {
del() {
if(!this.ids) {
delConfirm() {
if(!this.delIds.length) {
return this.$u.toast('请先选中需要删除的照片')
}
var id = this.ids.jion(',')
var id = this.delIds.join(',')
this.$confirm('确定删除这些相片?').then(() => {
this.$http.post(`/app/appvillagepicturealbum/deleteForWx?id=${id}`).then((res) => {
this.$http.post(`/app/appvillagepicturealbum/delete?ids=${id}`).then((res) => {
if (res.code == 0) {
this.$u.toast('删除成功!')
this.list = []
this.getList()
this.getStatistic()
this.editClick('取消')
uni.$emit('updateList')
}
})
})
@@ -91,7 +93,7 @@ export default {
editClick(text) {
this.editText = text == '编辑' ? '取消' : '编辑'
this.delIds = []
if(text == '取消') {
if(text == '取消' && this.delIds.length) {
this.list = []
this.getList()
}
@@ -99,6 +101,7 @@ export default {
checkImg(row, index, indexs) {
this.list[index].list[indexs].isCheked = true
this.delIds.push(row.id)
this.$forceUpdate()
},
delSelect(row, index, indexs) {
this.list[index].list[indexs].isCheked = false
@@ -107,6 +110,7 @@ export default {
this.delIds.splice(i, 1)
}
})
this.$forceUpdate()
},
previewImage(images, img) {
uni.previewImage({