Browse Source

update topic 添加取消点赞图片

master
fanp 6 years ago
parent
commit
87ed4686a0
  1. BIN
      images/topic/un_zan.png
  2. BIN
      images/topic/zan.png
  3. 4
      pages/topics/goodIdea/cell/index.js
  4. 6
      pages/topics/goodIdea/cell/index.wxml
  5. 9
      pages/topics/goodIdea/cell/index.wxss
  6. 8
      pages/topics/index.js
  7. 10
      pages/topics/interactive/topicArticle/index.js
  8. 2
      pages/topics/interactive/topicArticle/index.wxml
  9. 7
      pages/user/myIdea/index.js

BIN
images/topic/un_zan.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
images/topic/zan.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

4
pages/topics/goodIdea/cell/index.js

@ -18,8 +18,8 @@ Component({
* 组件的初始数据 * 组件的初始数据
*/ */
data: { data: {
unPraise: '/images/common/zan.png', unPraise: '/images/topic/un_zan.png',
praise: '/images/common/star_light.png', praise: '/images/topic/zan.png',
isTouchMove:false, isTouchMove:false,
startX: 0, //开始坐标 startX: 0, //开始坐标
startY: 0 startY: 0

6
pages/topics/goodIdea/cell/index.wxml

@ -3,7 +3,7 @@
<view class="touch-item {{isTouchMove ? 'touch-move-active' : ''}}" data-index="{{itemIndex}}" data-name="{{itemData.commentName}}" bindtouchstart="touchstart" bindtouchmove="touchmove" > <view class="touch-item {{isTouchMove ? 'touch-move-active' : ''}}" data-index="{{itemIndex}}" data-name="{{itemData.commentName}}" bindtouchstart="touchstart" bindtouchmove="touchmove" >
<view class="content"> <view class="content">
<view class="content-left"> <view class="content-left">
<image src="{{itemData.commentIcon}}" style="width:20px;height:20px;"></image> <image src="{{itemData.commentIcon}}" style="width:30px;height:30px;"></image>
</view> </view>
<view class="content-right"> <view class="content-right">
<view class="userInfo"> <view class="userInfo">
@ -13,9 +13,7 @@
</view> </view>
<view class="userInfo-right" bindtap="onClickPraise" data-item="{{itemData}}" data-index='{{itemIndex}}'> <view class="userInfo-right" bindtap="onClickPraise" data-item="{{itemData}}" data-index='{{itemIndex}}'>
<view class="praiseNum">{{itemData.praiseNum}}</view> <view class="praiseNum">{{itemData.praiseNum}}</view>
<view class="praise-icon"> <image class="praise-icon" src="{{itemData.isSupport ==='0' ? unPraise : praise}}"></image>
<image src="{{item.isPraise ? praise : unPraise}}" style="width:100%;"></image>
</view>
</view> </view>
</view> </view>
<view style="color:#3B3B3B;font-size:14px;padding: 0 0 5px 0;">{{itemData.comment}}</view> <view style="color:#3B3B3B;font-size:14px;padding: 0 0 5px 0;">{{itemData.comment}}</view>

9
pages/topics/goodIdea/cell/index.wxss

@ -5,10 +5,8 @@
padding: 10px; */ padding: 10px; */
} }
.content-left{ .content-left{
width: 20px; width: 30px;
height: 20px; height: 30px;
border-radius: 50%;
background-color: #EEEEEE;
} }
.content-right{ .content-right{
width: 100%; width: 100%;
@ -40,10 +38,9 @@ image{
height: 100%; height: 100%;
} }
.praise-icon{ .praise-icon{
margin-left: 5px;
width: 15px; width: 15px;
height: 15px; height: 15px;
line-height: 10px;
margin-left: 5px;
} }
.userName{ .userName{
color: #66708B; color: #66708B;

8
pages/topics/index.js

@ -136,6 +136,7 @@ Page({
commentTime: item.createTime, commentTime: item.createTime,
comment: item.comment, comment: item.comment,
praiseNum: item.supportNum, praiseNum: item.supportNum,
isSupport: item.isSupport,
// 议题数据 // 议题数据
topicTtitle: item.title, topicTtitle: item.title,
topicGroupAvator: item.groupAvator, topicGroupAvator: item.groupAvator,
@ -288,13 +289,10 @@ Page({
this.fetchGoodIdeaPraise(e.detail.commentId) this.fetchGoodIdeaPraise(e.detail.commentId)
}, },
fetchGoodIdeaPraise(id) { fetchGoodIdeaPraise(id) {
wx.showLoading()
topicModel.topicCommentPraise(id, res => { topicModel.topicCommentPraise(id, res => {
console.log(res)
if (res.code === 200) { if (res.code === 200) {
wx.showToast({ wx.hideLoading()
title: res.message,
icon: 'none'
})
this.onPullDownRefresh() this.onPullDownRefresh()
} }
}) })

10
pages/topics/interactive/topicArticle/index.js

@ -29,7 +29,8 @@ Page({
isCollect:Number, isCollect:Number,
currPage: 1, currPage: 1,
commentList: [], commentList: [],
praise: '/images/common/zan.png', unPraise: '/images/topic/un_zan.png',
praise: '/images/topic/zan.png',
hiddenmodalput:true, hiddenmodalput:true,
currentComment:'', currentComment:'',
@ -95,6 +96,7 @@ Page({
detail: item.comment, detail: item.comment,
time: item.createTime, time: item.createTime,
praiseNum: item.supportNum, praiseNum: item.supportNum,
isSupport: item.isSupport,
isTouchMove:false, isTouchMove:false,
}) })
}) })
@ -152,12 +154,10 @@ Page({
}, },
fetchTopicCommentPraise(commentId){ fetchTopicCommentPraise(commentId){
wx.showLoading()
topicModel.topicCommentPraise(commentId,res =>{ topicModel.topicCommentPraise(commentId,res =>{
if (res.code === 200) { if (res.code === 200) {
wx.showToast({ wx.hideLoading()
title: res.message,
icon: 'none'
})
this.fetchDetailComment() this.fetchDetailComment()
} }
}) })

2
pages/topics/interactive/topicArticle/index.wxml

@ -62,7 +62,7 @@
<view class="comment_info_time_left">{{item.time}}</view> <view class="comment_info_time_left">{{item.time}}</view>
<view class="comment_info_time_right" bindtap="onClickPraise" data-item="{{item}}" data-index='{{index}}'> <view class="comment_info_time_right" bindtap="onClickPraise" data-item="{{item}}" data-index='{{index}}'>
<view class="praiseNum">{{item.praiseNum}}</view> <view class="praiseNum">{{item.praiseNum}}</view>
<image class="praiseIcon" src="{{praise}}"></image> <image class="praiseIcon" src="{{item.isSupport ==='0' ? unPraise : praise}}"></image>
</view> </view>
</view> </view>
</view> </view>

7
pages/user/myIdea/index.js

@ -47,6 +47,7 @@ Page({
commentTime: item.createTime, commentTime: item.createTime,
comment: item.comment, comment: item.comment,
praiseNum: item.supportNum, praiseNum: item.supportNum,
isSupport: item.isSupport,
// 议题数据 // 议题数据
topicTtitle: item.title, topicTtitle: item.title,
topicGroupAvator: item.groupAvator, topicGroupAvator: item.groupAvator,
@ -116,13 +117,11 @@ Page({
this.fetchGoodIdeaPraise(itemData.commentId) this.fetchGoodIdeaPraise(itemData.commentId)
}, },
fetchGoodIdeaPraise(id) { fetchGoodIdeaPraise(id) {
wx.showLoading()
topicModel.topicCommentPraise(id, res => { topicModel.topicCommentPraise(id, res => {
console.log(res) console.log(res)
if (res.code === 200) { if (res.code === 200) {
wx.showToast({ wx.hideLoading()
title: res.message,
icon: 'none'
})
this.onPullDownRefresh() this.onPullDownRefresh()
} }
}) })

Loading…
Cancel
Save