增加遗漏收藏功能(问答)

This commit is contained in:
weinan2087
2022-11-15 10:07:21 +08:00
parent 83eb91e2e4
commit b9911d5735

View File

@@ -106,7 +106,7 @@
</view> </view>
<view class="item-bottom"> <view class="item-bottom">
<text class="item-time">收藏时间{{ item.time }}</text> <text class="item-time">收藏时间{{ item.time }}</text>
<view style="margin-top: 10upx;" class="rowbtn rowbtn-primary"> <view style="margin-top: 10upx;" @click="delCollectItem(item)" class="rowbtn rowbtn-primary">
<image src="../../static/images/icon/favo.png" mode=""></image>取消收藏 <image src="../../static/images/icon/favo.png" mode=""></image>取消收藏
</view> </view>
</view> </view>
@@ -390,23 +390,34 @@ export default {
return obj; return obj;
}, },
delCollectItem(item) { delCollectItem(item) {
let that = this;
apiFavorites.del(item.id).then(res => { uni.showModal({
if (res.status == 200) { title: '提示',
uni.showToast({ content: '您确定要取消此收藏吗?',
title:"取消收藏成功" , success: function (res) {
duration: 1000 if (res.confirm) {
}); apiFavorites.del(item.id).then(res => {
setTimeout(()=>{ if (res.status == 200) {
this.findData(true) uni.showToast({
},1000) title:"取消收藏成功" ,
} else { duration: 1000
uni.showToast({ });
title: "操作失败", setTimeout(()=>{
icon:'none' that.findData(true)
}); },1000)
} else {
uni.showToast({
title: "操作失败",
icon:'none'
});
}
})
}
} }
}) });
} }
} }
}; };