Commit 7da365d1 authored by Junling Bu's avatar Junling Bu
Browse files

fix[litemall-wx]: 评论列表不能正确显示

parent bdd497e1
...@@ -45,15 +45,15 @@ Page({ ...@@ -45,15 +45,15 @@ Page({
if (that.data.showType == 0) { if (that.data.showType == 0) {
that.setData({ that.setData({
allCommentList: that.data.allCommentList.concat(res.data.data), allCommentList: that.data.allCommentList.concat(res.data.list),
allPage: res.data.currentPage, allPage: res.data.page,
comments: that.data.allCommentList.concat(res.data.data) comments: that.data.allCommentList.concat(res.data.list)
}); });
} else { } else {
that.setData({ that.setData({
picCommentList: that.data.picCommentList.concat(res.data.data), picCommentList: that.data.picCommentList.concat(res.data.list),
picPage: res.data.currentPage, picPage: res.data.page,
comments: that.data.picCommentList.concat(res.data.data) comments: that.data.picCommentList.concat(res.data.list)
}); });
} }
} }
...@@ -84,21 +84,30 @@ Page({ ...@@ -84,21 +84,30 @@ Page({
// 页面关闭 // 页面关闭
}, },
switchTab: function() { switchTab: function () {
this.setData({ let that = this;
showType: this.data.showType == 1 ? 0 : 1 if (that.data.showType == 0) {
}); that.setData({
allCommentList: [],
allPage: 1,
comments: [],
showType: 1
});
} else {
that.setData({
picCommentList: [],
picPage: 1,
comments: [],
showType: 0
});
}
this.getCommentList(); this.getCommentList();
}, },
onReachBottom: function() { onReachBottom: function() {
console.log('onPullDownRefresh');
if (this.data.showType == 0) { if (this.data.showType == 0) {
if (this.data.allCount / this.data.limit < this.data.allPage) { if (this.data.allCount / this.data.limit < this.data.allPage) {
return false; return false;
} }
this.setData({ this.setData({
allPage: this.data.allPage + 1 allPage: this.data.allPage + 1
}); });
...@@ -106,14 +115,10 @@ Page({ ...@@ -106,14 +115,10 @@ Page({
if (this.data.hasPicCount / this.data.limit < this.data.picPage) { if (this.data.hasPicCount / this.data.limit < this.data.picPage) {
return false; return false;
} }
this.setData({ this.setData({
picPage: this.data.picPage + 1 picPage: this.data.picPage + 1
}); });
} }
this.getCommentList(); this.getCommentList();
} }
}) })
\ No newline at end of file
<view class="comments"> <view class="comments">
<view class="h">
<view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab">
<view class="txt">全部({{allCount}})</view>
</view>
<view class="item {{ showType == 0 ? '' : 'active'}}" bindtap="switchTab">
<view class="txt">有图({{hasPicCount}})</view>
</view>
</view>
<view class="b"> <view class="b">
<view class="item" wx:for="{{comments}}" wx:key="id"> <view class="item" wx:for="{{comments}}" wx:key="id">
<view class="info"> <view class="info">
...@@ -10,7 +18,7 @@ ...@@ -10,7 +18,7 @@
</view> </view>
<view class="comment">{{item.content}}</view> <view class="comment">{{item.content}}</view>
<view class="imgs" wx:if="{{item.picList.length > 0}}"> <view class="imgs" wx:if="{{item.picList.length > 0}}">
<image class="img" wx:for="{{item.picList}}" wx:key="id" wx:for-item="pitem" src="{{pitem.picUrl}}"></image> <image class="img" wx:for="{{item.picList}}" wx:key="*this" wx:for-item="pitem" src="{{pitem}}"></image>
</view> </view>
</view> </view>
......
...@@ -6,7 +6,44 @@ ...@@ -6,7 +6,44 @@
margin: 20rpx 0; margin: 20rpx 0;
} }
.comments .h {
position: fixed;
left: 0;
top: 0;
z-index: 1000;
width: 100%;
display: flex;
background: #fff;
height: 84rpx;
border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}
.comments .h .item {
display: inline-block;
height: 82rpx;
width: 50%;
padding: 0 15rpx;
text-align: center;
}
.comments .h .item .txt {
display: inline-block;
height: 82rpx;
padding: 0 20rpx;
line-height: 82rpx;
color: #333;
font-size: 30rpx;
width: 170rpx;
}
.comments .h .item.active .txt {
color: #ab2b2b;
border-bottom: 4rpx solid #ab2b2b;
}
.comments .b { .comments .b {
margin-top: 85rpx;
height: auto; height: auto;
width: 720rpx; width: 720rpx;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment