From 5fcfa81c63342d55e84675e95eda08573dea4333 Mon Sep 17 00:00:00 2001 From: zhaoyongnian <541231643@qq.com> Date: Mon, 8 Jun 2020 10:30:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../associationNew/pages/eventlist/eventlist.js | 15 +++++++++++++-- .../associationNew/pages/eventlist/eventlist.wxml | 8 ++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/subpages/associationNew/pages/eventlist/eventlist.js b/subpages/associationNew/pages/eventlist/eventlist.js index a4502fe..3db2020 100644 --- a/subpages/associationNew/pages/eventlist/eventlist.js +++ b/subpages/associationNew/pages/eventlist/eventlist.js @@ -150,6 +150,8 @@ Page({ //点赞 clicklike(e) { + console.log(JSON.stringify(e)) + let index = e.currentTarget.dataset.index // if (this.data.bannedFlag == '1') {//被禁言 wx.showToast({ @@ -171,10 +173,19 @@ Page({ attitude: attitude,//表态 0赞;1踩;2取消赞;3取消踩 } statement(para).then(res => { + // 点赞成功以后实现局部刷新功能 + console.log(JSON.stringify(that.data.topiclist[index])) + var obj= that.data.topiclist[index] + // + obj.likeFlag = obj.likeFlag == '0' ? '1' : '0' that.setData({ - topiclist: [], + ["topiclist["+index+"]"]:obj }) - this.topiclist() + console.log(JSON.stringify(that.data.topiclist[index])) + // that.setData({ + // topiclist: [], + // }) + // this.topiclist() }).catch(err => { console.log(err) }) diff --git a/subpages/associationNew/pages/eventlist/eventlist.wxml b/subpages/associationNew/pages/eventlist/eventlist.wxml index 06bfd7e..7ab75c2 100644 --- a/subpages/associationNew/pages/eventlist/eventlist.wxml +++ b/subpages/associationNew/pages/eventlist/eventlist.wxml @@ -14,17 +14,17 @@ wx:for="{{item.images}}" wx:key="{{index}}" wx:for-index="index" wx:for-item="_item" src="{{_item}}" /> - + - - + + {{item.supportNum}} {{item.commentNum}} - + 评论