diff --git a/epdc-resident-mp-yushan/subpages/property/pages/topicDetail/topicDetail.js b/epdc-resident-mp-yushan/subpages/property/pages/topicDetail/topicDetail.js index 433411c..baa93f0 100644 --- a/epdc-resident-mp-yushan/subpages/property/pages/topicDetail/topicDetail.js +++ b/epdc-resident-mp-yushan/subpages/property/pages/topicDetail/topicDetail.js @@ -1,4 +1,4 @@ -import { getTopicDetail, getRemarkList, closeTopic, publishStatement, topicComLike, topicComUnlike } from '../../utils/api' +import { getTopicDetail, getRemarkList, closeTopic, publishStatement } from '../../utils/api' import { getTimestamp } from '../../utils/common' const app = getApp() @@ -291,10 +291,10 @@ Page({ } catch (err) { return false } - topicComLike(para).then(res => { + publishStatement(para).then(res => { this.getTopicAltitudeNum() - console.log("支持", res) - this.data.remarkList.forEach((item, index) => { + console.log('支持', res) + this.data.remarkList.forEach((item,index) => { if (item.commentId === e.detail.commentId) { this.setData({ [`remarkList[${index}].userLike`]: true, @@ -303,8 +303,8 @@ Page({ [`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) > 0 ? parseInt(this.data.remarkList[index].opposeNum) - 1 : 0 }) wx.showToast({ - title: "表态成功", - icon: "none", + title: '表态成功', + icon: 'none', duration: 2000 }) } @@ -312,27 +312,6 @@ Page({ }).catch(err => { console.log(err) }) - // publishStatement(para).then(res => { - // this.getTopicAltitudeNum() - // console.log('支持', res) - // this.data.remarkList.forEach((item,index) => { - // if (item.commentId === e.detail.commentId) { - // this.setData({ - // [`remarkList[${index}].userLike`]: true, - // [`remarkList[${index}].userDislike`]: false, - // [`remarkList[${index}].approveNum`]: parseInt(this.data.remarkList[index].approveNum) + 1, - // [`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) > 0 ? parseInt(this.data.remarkList[index].opposeNum) - 1 : 0 - // }) - // wx.showToast({ - // title: '表态成功', - // icon: 'none', - // duration: 2000 - // }) - // } - // }) - // }).catch(err => { - // console.log(err) - // }) }, // 反对某条评论 debounce 防抖 debiunceDispportReply (e) { @@ -382,20 +361,20 @@ Page({ } catch (err) { return false } - topicComUnlike(para).then(res => { + publishStatement(para).then(res => { this.getTopicAltitudeNum() - console.log("反对", res) + console.log('反对', res) this.data.remarkList.forEach((item, index) => { if (item.commentId === e.detail.commentId) { this.setData({ [`remarkList[${index}].userLike`]: false, [`remarkList[${index}].userDislike`]: true, - [`remarkList[${index}].approveNum`]: parseInt(this.data.remarkList[index].approveNum) > 0 ? parseInt(this.data.remarkList[index].approveNum) - 1 : 0, + [`remarkList[${index}].approveNum`]: parseInt(this.data.remarkList[index].approveNum) > 0 ? parseInt(this.data.remarkList[index].approveNum) - 1: 0, [`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) + 1 }) wx.showToast({ - title: "表态成功", - icon: "none", + title: '表态成功', + icon: 'none', duration: 2000 }) } @@ -403,27 +382,6 @@ Page({ }).catch(err => { console.log(err) }) - // publishStatement(para).then(res => { - // this.getTopicAltitudeNum() - // console.log('反对', res) - // this.data.remarkList.forEach((item, index) => { - // if (item.commentId === e.detail.commentId) { - // this.setData({ - // [`remarkList[${index}].userLike`]: false, - // [`remarkList[${index}].userDislike`]: true, - // [`remarkList[${index}].approveNum`]: parseInt(this.data.remarkList[index].approveNum) > 0 ? parseInt(this.data.remarkList[index].approveNum) - 1: 0, - // [`remarkList[${index}].opposeNum`]: parseInt(this.data.remarkList[index].opposeNum) + 1 - // }) - // wx.showToast({ - // title: '表态成功', - // icon: 'none', - // duration: 2000 - // }) - // } - // }) - // }).catch(err => { - // console.log(err) - // }) }, // 对评论进行回复 replyRemark (e) {