Merge pull request 'gdpao' (#282) from gyh into master

Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/282
This commit is contained in:
gyh 2020-08-21 16:05:52 +08:00
commit 8518677f05
3 changed files with 44 additions and 22 deletions

View File

@ -29,7 +29,7 @@
<text>评论</text>
<u-icon name="close" color="#333" size="28" @click="is_comment=false"></u-icon>
</view>
<scroll-view class="scroll-box" scroll-y="true" lower-threshold="50" @scroll="changeComment" @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>
@ -52,7 +52,10 @@
</view>
<view class="child_content">{{ child.content }}</view>
</view>
<view class="more-reply" v-if="item.reply_count" @click="getReplyList(item.id)">展开更多回复<u-icon name="arrow-down"></u-icon></view>
<view class="more-reply" v-if="item.reply_count" @click="getReplyList(item.id)">
{{ child_end[item.id] ? "暂无更多回复" : "展开更多回复" }}
<u-icon name="arrow-down" v-if="!child_end[item.id]"></u-icon>
</view>
</view>
</block>
<view class="no-data" v-if="!commentList.length">还没有评论快来评论吧</view>
@ -442,6 +445,7 @@ export default {
edit_text_other: "有爱评论,说点好听的 ~",
commentList: [], //
allList: {}, //
child_end: {},
status: 'loadmore',
iconType: 'circle',
loadText: {
@ -519,6 +523,8 @@ export default {
// console.log(item);
item.page = 0;
item.commentList = [];
this.page_[item.id] = 0;
this.child_end[item.id] = false;
})
this.commentList = list;
}
@ -572,14 +578,14 @@ export default {
// console.log(p_id);
if (res.data.data.pid) {
this.commentList[this.comment_id].reply_count = true;
console.log(this.allList[p_id]);
// console.log(this.allList[p_id]);
if (this.allList[p_id]) {
this.allList[p_id].push(res.data.data);
} else {
this.allList[p_id] = [];
this.allList[p_id].push(res.data.data);
}
console.log(this.allList);
// console.log(this.allList);
} else {
this.commentList.unshift(res.data.data);
}
@ -593,18 +599,20 @@ export default {
uni.showLoading({
title: "loading..."
})
if (!this.page_[id] === 0) {
}
this.$u.post("article/articleReplyList", {id: id, page: this.page_[id]}).then(res => {
uni.hideLoading();
if (res.errCode == 0) {
// if (res.data.length < 10) {
// this.is_more = false;
// }
if (this.page_[id] == 0) {
this.allList[id] = res.data;
} else {
this.allList[id] = this.allList[id].concat(res.data);
}
this.page_[id]++;
this.allList[id] = res.data;
this.$forceUpdate();
console.log(this.allList);
// console.log(this.allList);
} else if (res.errCode == 1) {
this.child_end[id] = true;
this.$forceUpdate();
}
})
},
@ -623,9 +631,6 @@ export default {
scrollBottom(e) {
console.log(1);
this.getComment();
},
changeComment(e) {
console.log(e);
},
//
gotoInfo(id) {

View File

@ -72,7 +72,9 @@
<text class="child_content">{{ child.content }}</text>
</view>
<view>
<text class="more-comment" @click="getReplyList(item.id)" v-if="item.reply_count">展开更多回复</text>
<text class="more-comment" @click="getReplyList(item.id)" v-if="item.reply_count">
{{ child_end[item.id] ? "暂无更多回复" : "展开更多回复" }}
</text>
<text></text>
</view>
</view>
@ -167,6 +169,7 @@
time_count: 0,
linear: null,
loadinging: false,
child_end: {},
};
},
onLoad(option) {
@ -246,6 +249,16 @@
// console.log(res.data);
this.commentList = res.data.data;
}
let list = this.commentList;
list.forEach((item,index) => {
console.log(item);
item.page = 0;
item.commentList = [];
this.page_[item.id] = 0;
this.child_end[item.id] = false;
})
console.log(list);
this.commentList = list;
}
})
},
@ -317,7 +330,6 @@
uni.showLoading({
title: "loading..."
})
if (!this.page_[id] === 0) {}
uni.request({
url: temp_url + "article/articleReplyList",
method: "POST",
@ -332,14 +344,18 @@
uni.hideLoading();
console.log(this.page_);
if (res.data.errCode == 0) {
if (res.data.data.length < 10) {
this.is_more = false;
if (this.page_[id] == 0) {
this.allList[id] = res.data.data;
} else {
this.allList[id] = this.allList[id].concat(res.data.data);
}
this.page_[id]++;
console.log(this.page_);
this.allList[id] = res.data.data;
this.$forceUpdate();
} else if (res.data.errCode == 1) {
this.child_end[id] = true;
this.$forceUpdate();
}
console.log(this.allList);
}
})
},

View File

@ -177,9 +177,10 @@ export default {
uni.navigateTo({
url: "../../pageA/login/login"
})
}
} else {
this.getOrderNumber();
}
this.getUserInfo();
this.getOrderNumber();
},
onNavigationBarButtonTap(e) {
// console.log(e);