|
|
@ -24,7 +24,9 @@ Page({ |
|
|
|
focus: false, |
|
|
|
topicId: '',//被评论的话题ID
|
|
|
|
commentContent: '', |
|
|
|
index:0,//点击的第几条数据,用于评论的局部刷新用
|
|
|
|
index: 0,//点击的第几条数据,用于评论的局部刷新用
|
|
|
|
infoCompleted: 0, |
|
|
|
completeInfoDialogVisible: false, |
|
|
|
}, |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
@ -33,6 +35,7 @@ Page({ |
|
|
|
this.setData({ |
|
|
|
partyGroupId: options.partyGroupId, |
|
|
|
topicType: options.topicType,//0:事好儿鼓个掌 1:话对捧个场
|
|
|
|
infoCompleted: app.globalData.infoCompleted |
|
|
|
}) |
|
|
|
if (options.topicType == 0) { |
|
|
|
wx.setNavigationBarTitle({ |
|
|
@ -85,14 +88,9 @@ Page({ |
|
|
|
}, |
|
|
|
// 跳转 发布话题
|
|
|
|
navigateToAddTopic() { |
|
|
|
// if (this.data.groupState === '15') {
|
|
|
|
// wx.showToast({
|
|
|
|
// title: '该群已禁言,暂不可发布话题',
|
|
|
|
// icon: 'none',
|
|
|
|
// duration: 2000
|
|
|
|
// })
|
|
|
|
// return false
|
|
|
|
// }
|
|
|
|
if (this.verifyCompleteInfo()) { |
|
|
|
return false |
|
|
|
} |
|
|
|
wx.navigateTo({ |
|
|
|
url: `/subpages/associationNew/pages/addTopic/addTopic?partyGroupId=${this.data.partyGroupId}&topicType=${this.data.topicType}` |
|
|
|
}) |
|
|
@ -189,12 +187,12 @@ Page({ |
|
|
|
} |
|
|
|
statement(para).then(res => { |
|
|
|
// 点赞成功以后实现局部刷新功能
|
|
|
|
var obj= that.data.topiclist[index] |
|
|
|
var obj = that.data.topiclist[index] |
|
|
|
// <!-- 用户是否已点赞 0否;1是 -->
|
|
|
|
obj.likeFlag = obj.likeFlag == '0' ? '1' : '0' |
|
|
|
obj.supportNum = obj.likeFlag == '1' ? obj.supportNum+1 : obj.supportNum-1 |
|
|
|
obj.supportNum = obj.likeFlag == '1' ? obj.supportNum + 1 : obj.supportNum - 1 |
|
|
|
that.setData({ |
|
|
|
["topiclist["+index+"]"]:obj |
|
|
|
["topiclist[" + index + "]"]: obj |
|
|
|
}) |
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
@ -215,7 +213,7 @@ Page({ |
|
|
|
ifcomment: true, |
|
|
|
focus: true, |
|
|
|
topicId: e.currentTarget.dataset.id, |
|
|
|
index:index |
|
|
|
index: index |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
@ -223,7 +221,7 @@ Page({ |
|
|
|
bindAddressInput(e) { |
|
|
|
this.setData({ //失去焦点以后view隐藏
|
|
|
|
ifcomment: false, |
|
|
|
commentContent:'' |
|
|
|
commentContent: '' |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 双向绑定
|
|
|
@ -234,7 +232,6 @@ Page({ |
|
|
|
}, |
|
|
|
// 评论按钮点击事件
|
|
|
|
commentSubmit() { |
|
|
|
|
|
|
|
let that = this; |
|
|
|
const para = { |
|
|
|
topicId: that.data.topicId,//被评论的话题ID
|
|
|
@ -242,13 +239,34 @@ Page({ |
|
|
|
content: that.data.commentContent,//评论内容
|
|
|
|
} |
|
|
|
commentSubmit(para).then(res => { |
|
|
|
// 评论成功以后,调用接口比对出当前评论列表的数据,对已有列表数据进行替换
|
|
|
|
that.NowTopiclist() |
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 列表内当前操作的数据
|
|
|
|
NowTopiclist() { |
|
|
|
let that = this; |
|
|
|
const para = { |
|
|
|
pageIndex: 1, |
|
|
|
pageSize: 1, |
|
|
|
timestamp: getTimestamp(), |
|
|
|
topicType: that.data.topicType, |
|
|
|
partyGroupId: that.data.partyGroupId, //党群id
|
|
|
|
partyTopicId: that.data.topicId |
|
|
|
} |
|
|
|
topiclist(para).then(res => { |
|
|
|
console.log(JSON.stringify(res)) |
|
|
|
// 评论成功以后实现局部刷新功能
|
|
|
|
var obj= that.data.topiclist[that.data.index] |
|
|
|
var obj = that.data.topiclist[that.data.index] |
|
|
|
// 评论成功以后评论数量加1
|
|
|
|
obj.commentNum = obj.commentNum + 1 |
|
|
|
obj.comments.splice(0, 0, {username:obj.nickname,content:para.content}); |
|
|
|
// obj.commentNum = obj.commentNum + 1
|
|
|
|
// obj.comments.splice(0, 0, {username:obj.nickname,content:para.content});
|
|
|
|
obj = res.data.topicList[0] |
|
|
|
that.setData({ |
|
|
|
["topiclist["+that.data.index+"]"]:obj |
|
|
|
["topiclist[" + that.data.index + "]"]: obj |
|
|
|
}) |
|
|
|
}).catch(err => { |
|
|
|
console.log(err) |
|
|
@ -262,6 +280,17 @@ Page({ |
|
|
|
current: e.currentTarget.dataset.src |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 检查 是否完善信息
|
|
|
|
verifyCompleteInfo() { |
|
|
|
if (this.data.infoCompleted == 0) { |
|
|
|
this.setData({ |
|
|
|
completeInfoDialogVisible: !this.data.completeInfoDialogVisible |
|
|
|
}) |
|
|
|
return true |
|
|
|
} else { |
|
|
|
return false |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 用户点击右上角分享 |
|
|
|