This commit is contained in:
Gdpao
2020-08-07 19:56:47 +08:00
parent 71e984b2ed
commit 502e020000
17 changed files with 238 additions and 136 deletions

View File

@@ -22,14 +22,14 @@
</view>
</view>
<!-- 用户操作 -->
<userinfo class="userinfo" :list="list" :cart="cart_type" :comment="is_comment" @openCart="openPopup"></userinfo>
<userinfo class="userinfo" :list="list" :cart="cart_type" :comment="is_comment" :num="comment_num" @openCart="openPopup"></userinfo>
<!-- 评论 -->
<u-popup v-model="is_comment" class="pl" mode="bottom" border-radius="10" height="700rpx">
<view class="top">
<text>评论</text>
<u-icon name="arrow-down" color="#333" size="28" @click="is_comment=false"></u-icon>
</view>
<scroll-view class="scroll-box" scroll-y="true" @scrolltolower="scrollBottom">
<scroll-view class="scroll-box" scroll-y="true" lower-threshold="50" @scrolltolower="scrollBottom">
<block v-for="(item,index) in commentList" :key="index">
<view class="box">
<image :src="item.member_avatar" mode="aspectFill"></image>
@@ -55,7 +55,8 @@
<view class="more-reply" v-if="item.reply_count" @click="getReplyList(item.id)">展开更多回复<u-icon name="arrow-down"></u-icon></view>
</view>
</block>
<!-- <view class="no-data" v-else>111</view> -->
<view class="no-data" v-if="!commentList.length">还没有评论快来评论吧</view>
<u-loadmore v-else :status="status" icon-type="iconType" margin-top="50" margin-bottom="50" :load-text="loadText" />
</scroll-view>
<view class="editing" @click="openKeyInput">
<input type="text" value="" :placeholder="edit_text" disabled="disabled" />
@@ -258,9 +259,11 @@
}
}
.no-data {
margin-top: 100rpx;
margin-top: 200rpx;
text-align: center;
}
.editing {
z-index: 1000;
position: fixed;
bottom: 0;
display: flex;
@@ -411,10 +414,19 @@ export default {
cartList: [],
cart_len: 0,
photo_len: 0,
comment_num: 0,
edit_text: "有爱评论,说点好听的 ~",
edit_text_other: "有爱评论,说点好听的 ~",
commentList: [], // 评论
allList: [], // 全部子评论
status: 'loadmore',
iconType: 'circle',
loadText: {
loadmore: '轻轻上拉',
loading: '努力加载中',
nomore: '暂时没有更多了',
no: '评论'
}
}
},
onLoad(option){
@@ -455,7 +467,7 @@ export default {
this.is_comment = data.comment;
if (this.is_comment) {
this.page = 0;
this.getComment(this.article_id,0);
this.getComment();
}
},
// 获取评论
@@ -464,13 +476,20 @@ export default {
article_id: this.article_id,
page: this.page,
}).then(res => {
console.log(res);
if (res.errCode == 0 && this.page == 0) {
this.commentList = res.data;
} else if (res.errCode == 0 && this.page > 0) {
this.commentList = this.commentList.concat(res.data);
} else {
this.status = "loading";
// console.log(res);
if (res.errCode == 0) {
if (this.commentList.length < 8) {
this.status = "nomore";
}
if (this.page == 0) {
this.commentList = res.data;
} else if (res.data.length == 0 && this.page > 0) {
this.status = "nomore";
} else {
this.commentList = this.commentList.concat(res.data);
}
this.page++;
}
})
},
@@ -501,6 +520,8 @@ export default {
}).then(res => {
// console.log(res.data.data);
if (res.errCode == 0) {
this.comment_num = res.data.num;
// console.log(this.comment_num);
this.is_edit = false;
if (res.data.data.pid) {
this.commentList[this.comment_id].reply_count = true;
@@ -540,7 +561,6 @@ export default {
},
// 评论滚动到底部
scrollBottom(e) {
this.page++;
this.getComment();
},
// 跳转到商品