Commit 8eea874b58fe6deb80900a07c1c8d6ee358bdcc9

Authored by luoye

Merge branch 'master' of https://git.healthbaby.com.cn/luoye/littleapp_child

* 'master' of https://git.healthbaby.com.cn/luoye/littleapp_child:
  no message

# Conflicts:
#	littleApp_child/pages/childcare_knowledge/childcare_knowledge.wxml

Showing 2 changed files

littleApp_child/pages/childcare_knowledge/childcare_knowledge.js View file @ 8eea874
... ... @@ -138,5 +138,32 @@
138 138 isRefresh = false
139 139 })
140 140 },
  141 + // 文章点赞
  142 + articleLike(e) {
  143 + console.log(e)
  144 + var self = this
  145 + // 已经点赞
  146 + if (self.data.articleDetail.isLike == 1) {
  147 + networkUtil.showErrorToast('您已经点过赞啦')
  148 + return;
  149 + }
  150 + networkUtil._post(api.articleLike, { id: articleId }, function (res) {
  151 + console.log(res)
  152 + var art = self.data.articleDetail
  153 + art.likeCount++
  154 + art.isLike = 1
  155 + self.setData({
  156 + articleDetail: art
  157 + })
  158 + if (categoryIndex) {
  159 + // 更新首页数据
  160 + event.emit('likeChanged', { categoryIndex: categoryIndex, articleIdIndex: articleIdIndex });
  161 + } else {
  162 + event.emit('listLikeChanged', { categoryIndex: categoryIndex, articleIdIndex: articleIdIndex });
  163 + }
  164 + }, function (res) {
  165 + console.log(res)
  166 + })
  167 + },
141 168 })
littleApp_child/pages/childcare_knowledge/childcare_knowledge.wxml View file @ 8eea874
... ... @@ -27,8 +27,13 @@
27 27 <view style="margin-left:15px;margin-right:75px;">
28 28 <view class="content_title">{{item.title}}</view>
29 29 <view class="content_content">{{item.introduction}}</view>
  30 +<<<<<<< HEAD
30 31 <view class="zar_box">
31 32 <image class="zar_img" src="../../source/like.png"></image>
  33 +=======
  34 + <view class="zar_box" bindtap="articleLike" data-categaryIndex="{{sectionIndex}}" data-artIndex="{{index}}">
  35 + <image class="zar_img" src="../../source/{{item.isLike == 1 ? 'zanguo.png' : 'like.png'}}"></image>
  36 +>>>>>>> c0652f9e89ff8c2538249d6ec04fdfcb0b5777f2
32 37 <view class="content_zar">{{item.likeCount}}</view>
33 38 </view>
34 39