Browse Source

点赞功能刷新修改

master
xuxu 5 years ago
parent
commit
aae429bcbc
  1. 16
      pages/topics/interactive/topicArticle/index.js

16
pages/topics/interactive/topicArticle/index.js

@ -153,7 +153,6 @@ Page({
fetchTopicUnCollect(){ fetchTopicUnCollect(){
let collectionId = this.data.collectionId let collectionId = this.data.collectionId
topicModel.topicUnCollect(collectionId, res => { topicModel.topicUnCollect(collectionId, res => {
//console.log('取消收藏')
if (res.code === 200) { if (res.code === 200) {
this.fetchDetail() this.fetchDetail()
wx.showToast({ wx.showToast({
@ -168,8 +167,19 @@ Page({
wx.showLoading() wx.showLoading()
topicModel.topicCommentPraise(commentId,res =>{ topicModel.topicCommentPraise(commentId,res =>{
if (res.code === 200) { if (res.code === 200) {
wx.hideLoading() wx.hideLoading();
this.fetchDetailComment() var list = this.data.commentList;
for(var index in list){
if(list[index]['id'] == res.result.id){
list[index]['praiseNum'] = res.result.supportNum;
list[index]['isSupport'] = res.result.isSupport;
break;
}
}
this.setData({
commentList:list
})
} }
}) })
}, },

Loading…
Cancel
Save