|
|
|
@ -150,6 +150,8 @@ Page({ |
|
|
|
|
|
|
|
//点赞
|
|
|
|
clicklike(e) { |
|
|
|
console.log(JSON.stringify(e)) |
|
|
|
let index = e.currentTarget.dataset.index |
|
|
|
// <!-- 用户是否已点赞 0否;1是 -->
|
|
|
|
if (this.data.bannedFlag == '1') {//被禁言
|
|
|
|
wx.showToast({ |
|
|
|
@ -171,10 +173,19 @@ Page({ |
|
|
|
attitude: attitude,//表态 0赞;1踩;2取消赞;3取消踩
|
|
|
|
} |
|
|
|
statement(para).then(res => { |
|
|
|
// 点赞成功以后实现局部刷新功能
|
|
|
|
console.log(JSON.stringify(that.data.topiclist[index])) |
|
|
|
var obj= that.data.topiclist[index] |
|
|
|
// <!-- 用户是否已点赞 0否;1是 -->
|
|
|
|
obj.likeFlag = obj.likeFlag == '0' ? '1' : '0' |
|
|
|
that.setData({ |
|
|
|
topiclist: [], |
|
|
|
["topiclist["+index+"]"]:obj |
|
|
|
}) |
|
|
|
this.topiclist() |
|
|
|
console.log(JSON.stringify(that.data.topiclist[index])) |
|
|
|
// that.setData({
|
|
|
|
// topiclist: [],
|
|
|
|
// })
|
|
|
|
// this.topiclist()
|
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
|