|
@ -175,7 +175,9 @@ Page({ |
|
|
if (this.verifyCompleteInfo()) { |
|
|
if (this.verifyCompleteInfo()) { |
|
|
return false |
|
|
return false |
|
|
} |
|
|
} |
|
|
let index = e.currentTarget.dataset.index |
|
|
this.setData({ |
|
|
|
|
|
index: e.currentTarget.dataset.index |
|
|
|
|
|
}) |
|
|
// <!-- 用户是否已点赞 0否;1是 -->
|
|
|
// <!-- 用户是否已点赞 0否;1是 -->
|
|
|
if (this.data.bannedFlag == '1') {//被禁言
|
|
|
if (this.data.bannedFlag == '1') {//被禁言
|
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
@ -198,13 +200,7 @@ Page({ |
|
|
} |
|
|
} |
|
|
statement(para).then(res => { |
|
|
statement(para).then(res => { |
|
|
// 点赞成功以后实现局部刷新功能
|
|
|
// 点赞成功以后实现局部刷新功能
|
|
|
var obj = that.data.topiclist[index] |
|
|
that.nowLikesList(e.currentTarget.dataset.id); |
|
|
// <!-- 用户是否已点赞 0否;1是 -->
|
|
|
|
|
|
obj.likeFlag = obj.likeFlag == '0' ? '1' : '0' |
|
|
|
|
|
obj.supportNum = obj.likeFlag == '1' ? obj.supportNum + 1 : obj.supportNum - 1 |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
["topiclist[" + index + "]"]: obj |
|
|
|
|
|
}) |
|
|
|
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
console.log(err) |
|
|
console.log(err) |
|
|
}) |
|
|
}) |
|
@ -314,5 +310,28 @@ Page({ |
|
|
*/ |
|
|
*/ |
|
|
onShareAppMessage: function () { |
|
|
onShareAppMessage: function () { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
nowLikesList (topicId) { |
|
|
|
|
|
let that = this; |
|
|
|
|
|
const para = { |
|
|
|
|
|
pageIndex: 1, |
|
|
|
|
|
pageSize: 10, |
|
|
|
|
|
timestamp: getTimestamp(), |
|
|
|
|
|
topicType: this.data.topicType, |
|
|
|
|
|
partyGroupId: this.data.partyGroupId, //党群id
|
|
|
|
|
|
partyTopicId: topicId |
|
|
|
|
|
} |
|
|
|
|
|
topiclist(para).then(res => { |
|
|
|
|
|
var obj = that.data.topiclist[that.data.index] |
|
|
|
|
|
obj = res.data.topicList[0] |
|
|
|
|
|
// <!-- 用户是否已点赞 0否;1是 -->
|
|
|
|
|
|
// obj.likeFlag = obj.likeFlag == '0' ? '1' : '0'
|
|
|
|
|
|
// obj.supportNum = obj.likeFlag == '1' ? obj.supportNum + 1 : obj.supportNum - 1
|
|
|
|
|
|
that.setData({ |
|
|
|
|
|
["topiclist[" + that.data.index + "]"]: obj |
|
|
|
|
|
}) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |