From 0f3c11387e97a1f1d66b99033ce15e16d76aba75 Mon Sep 17 00:00:00 2001 From: zhaoyongnian <541231643@qq.com> Date: Thu, 10 Sep 2020 15:49:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8B=86=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/topicDetail/topicDetail.js | 64 +++++++++++++++---- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/epdc-resident-mp-yushan/subpages/association/pages/topicDetail/topicDetail.js b/epdc-resident-mp-yushan/subpages/association/pages/topicDetail/topicDetail.js index 63b1acf..fb09b31 100644 --- a/epdc-resident-mp-yushan/subpages/association/pages/topicDetail/topicDetail.js +++ b/epdc-resident-mp-yushan/subpages/association/pages/topicDetail/topicDetail.js @@ -1,4 +1,4 @@ -import { getTopicDetail, getRemarkList, closeTopic, publishStatement, getCloseReason } from '../../utils/api' +import { getTopicDetail, getRemarkList, closeTopic, publishStatement, getCloseReason, topicComLike, topicComUnlike } from '../../utils/api' import { getTimestamp } from '../../utils/common' const app = getApp() @@ -292,10 +292,10 @@ Page({ } catch (err) { return false } - publishStatement(para).then(res => { + topicComLike(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, @@ -304,8 +304,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 }) } @@ -313,6 +313,27 @@ 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) { @@ -362,20 +383,20 @@ Page({ } catch (err) { return false } - publishStatement(para).then(res => { + topicComUnlike(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 }) } @@ -383,6 +404,27 @@ 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) {