diff --git a/subpages/associationNew/pages/eventlist/eventlist.js b/subpages/associationNew/pages/eventlist/eventlist.js index ce639b3..3f89cac 100644 --- a/subpages/associationNew/pages/eventlist/eventlist.js +++ b/subpages/associationNew/pages/eventlist/eventlist.js @@ -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] // 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 + } + }, /** * 用户点击右上角分享 diff --git a/subpages/associationNew/pages/eventlist/eventlist.json b/subpages/associationNew/pages/eventlist/eventlist.json index 6d4cf1e..3250ef4 100644 --- a/subpages/associationNew/pages/eventlist/eventlist.json +++ b/subpages/associationNew/pages/eventlist/eventlist.json @@ -1,7 +1,8 @@ { "usingComponents": { "load-more": "../../../../components/loadMore/loadMore", - "no-data":"../../../../components/nodata/nodata" + "no-data":"../../../../components/nodata/nodata", + "completeInfo-dialog": "../../../../components/completeInfoDialog/completeInfoDialog" }, "navigationBarTitleText": "", "enablePullDownRefresh": true, diff --git a/subpages/associationNew/pages/eventlist/eventlist.wxml b/subpages/associationNew/pages/eventlist/eventlist.wxml index 7ab75c2..f1d4fb8 100644 --- a/subpages/associationNew/pages/eventlist/eventlist.wxml +++ b/subpages/associationNew/pages/eventlist/eventlist.wxml @@ -10,11 +10,13 @@ - + - + @@ -38,7 +40,8 @@ + cursor-spacing="15" auto-height="true" placeholder="请输入回复" value="{{commentContent}}" focus='{{focus}}' + bindblur="bindAddressInput" bindinput="bindIdentity"> @@ -49,4 +52,7 @@ - \ No newline at end of file + + + + \ No newline at end of file diff --git a/subpages/associationNew/utils/api.js b/subpages/associationNew/utils/api.js index f7b3817..36dddca 100644 --- a/subpages/associationNew/utils/api.js +++ b/subpages/associationNew/utils/api.js @@ -67,13 +67,14 @@ export function postUserBanned({groupUserId, bannedFlag}) { /** * 话题列表 */ -export function topiclist({pageIndex,pageSize,timestamp,topicType,partyGroupId}) { +export function topiclist({pageIndex,pageSize,timestamp,topicType,partyGroupId,partyTopicId}) { return request.get('partyGroup/topic/list',{ pageIndex, pageSize, timestamp, topicType, partyGroupId, + partyTopicId }) }