From 2cf6711fa97528ef05cd0cd67b44a62f804f49c9 Mon Sep 17 00:00:00 2001 From: luoye <397379429@qq.com> Date: Mon, 14 Aug 2017 15:36:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E7=82=B9=E8=B5=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- littleApp_child/pages/home/home.js | 20 ++++++-------------- littleApp_child/pages/home/home.wxml | 4 ++-- littleApp_child/pages/home/home.wxss | 1 + 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/littleApp_child/pages/home/home.js b/littleApp_child/pages/home/home.js index 4f84f72..0291723 100644 --- a/littleApp_child/pages/home/home.js +++ b/littleApp_child/pages/home/home.js @@ -172,24 +172,16 @@ Page({ console.log(e) var self = this // 已经点赞 - if (self.data.articleDetail.isLike == 1) { + if (e.currentTarget.dataset.islike == 1) { networkUtil.showErrorToast('您已经点过赞啦') return; } - networkUtil._post(api.articleLike, { id: articleId }, function (res) { - console.log(res) - var art = self.data.articleDetail - art.likeCount++ - art.isLike = 1 + networkUtil._post(api.articleLike, { id: e.currentTarget.dataset.artid }, function (res) { + var artList = self.data.list + artList[e.currentTarget.dataset.categaryindex].article[e.currentTarget.dataset.artindex].likeCount++ self.setData({ - articleDetail: art - }) - if (categoryIndex) { - // 更新首页数据 - event.emit('likeChanged', { categoryIndex: categoryIndex, articleIdIndex: articleIdIndex }); - } else { - event.emit('listLikeChanged', { categoryIndex: categoryIndex, articleIdIndex: articleIdIndex }); - } + list: artList + }); }, function (res) { console.log(res) }) diff --git a/littleApp_child/pages/home/home.wxml b/littleApp_child/pages/home/home.wxml index 1873b97..d0937fb 100644 --- a/littleApp_child/pages/home/home.wxml +++ b/littleApp_child/pages/home/home.wxml @@ -71,8 +71,8 @@ - - + + diff --git a/littleApp_child/pages/home/home.wxss b/littleApp_child/pages/home/home.wxss index e23644d..b8f6bb7 100644 --- a/littleApp_child/pages/home/home.wxss +++ b/littleApp_child/pages/home/home.wxss @@ -107,6 +107,7 @@ font: medium; text-align: center; line-height: 30px; + margin-bottom: 1px; } /*---------foundation---------*/ -- 1.8.3.1