gdpao
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
<!-- 评论 -->
|
||||
<view class="operat pinglun">
|
||||
<u-icon name="more-circle-fill" :color=" is_content ? '#FF7807' : '#ffffff' " :size="50" @click="editing()"></u-icon>
|
||||
<text>{{item.comment_num}}</text>
|
||||
<text>{{ comment_num }}</text>
|
||||
</view>
|
||||
<!-- 购物车 -->
|
||||
<view class="operat gouwu">
|
||||
@@ -74,7 +74,7 @@
|
||||
<script>
|
||||
export default {
|
||||
name:'userinfo',
|
||||
props:['list','cart','comment'],
|
||||
props:['list','cart','comment','num'],
|
||||
data(){
|
||||
return {
|
||||
is_follow: this.list.is_attention || false,
|
||||
@@ -82,6 +82,7 @@ export default {
|
||||
is_collect: this.list.is_collect || false,
|
||||
is_content: false,
|
||||
is_cart: false,
|
||||
comment_num: this.list.comment_num || 0,
|
||||
item: this.list || {}
|
||||
}
|
||||
},
|
||||
@@ -92,15 +93,21 @@ export default {
|
||||
this.is_follow = this.list.is_attention || false;
|
||||
this.is_like = this.list.is_like || false;
|
||||
this.is_collect = this.list.is_collect || false;
|
||||
this.comment_num = this.list.comment_num || 0;
|
||||
},
|
||||
cart(newValue,old) {
|
||||
// console.log(newValue,old);
|
||||
// console.log(newValue);
|
||||
this.is_cart = newValue;
|
||||
},
|
||||
comment(newValue,old) {
|
||||
// console.log(newValue,old);
|
||||
this.is_content = newValue;
|
||||
},
|
||||
num(newVal,old) {
|
||||
// console.log(newVal);
|
||||
this.comment_num = newVal;
|
||||
// this.item.comment_num = newVal;
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -102,7 +102,7 @@ export default {
|
||||
if (res.errCode == 0) {
|
||||
// console.log(res);
|
||||
this.listInfo = res.data.list;
|
||||
console.log(this.listInfo);
|
||||
// console.log(this.listInfo);
|
||||
} else {
|
||||
console.log(res.message);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
},
|
||||
// 跳转到商品
|
||||
|
||||
Reference in New Issue
Block a user