Fix(我的/收藏):[#1622]未选择任何项目点击“删除”,仍会弹出是否确认删除对话框
This commit is contained in:
@@ -248,8 +248,29 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
async remove() {
|
||||
let that = this
|
||||
remove() {
|
||||
const _this = this
|
||||
const ids = []
|
||||
switch (that.tabsIndex) {
|
||||
case 0:
|
||||
_this.productList.forEach(item => {
|
||||
if (item['state']) ids.push(item.id)
|
||||
})
|
||||
break
|
||||
case 1:
|
||||
_this.storeList.forEach(item => {
|
||||
if (item['state']) ids.push(item.id)
|
||||
})
|
||||
break
|
||||
case 2:
|
||||
_this.videoList.forEach(item => {
|
||||
if (item['state']) ids.push(item.id)
|
||||
})
|
||||
break
|
||||
}
|
||||
if (ids.length < 1) {
|
||||
return
|
||||
}
|
||||
uni.showModal({
|
||||
title: '确认删除已选项目?',
|
||||
content: '',
|
||||
@@ -258,30 +279,11 @@ export default {
|
||||
confirmText: '确认',
|
||||
success: async (r) => {
|
||||
if (r.confirm) {
|
||||
let ids = []
|
||||
switch (that.tabsIndex) {
|
||||
case 0:
|
||||
that.productList.forEach(item => {
|
||||
if (item['state']) ids.push(item.id)
|
||||
})
|
||||
break
|
||||
case 1:
|
||||
that.storeList.forEach(item => {
|
||||
if (item['state']) ids.push(item.id)
|
||||
})
|
||||
break
|
||||
case 2:
|
||||
that.videoList.forEach(item => {
|
||||
if (item['state']) ids.push(item.id)
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
const res = await removeFavorite(ids)
|
||||
if (res.success) {
|
||||
that.isAll = false
|
||||
that.fetchData()
|
||||
that.removeAfter()
|
||||
_this.isAll = false
|
||||
_this.fetchData()
|
||||
_this.removeAfter()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user