...
|
...
|
@@ -70,7 +70,7 @@ export default { |
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['fetchCommentList', 'fetchReplayList', 'postComment']),
|
|
|
async fetchComments(refresh) {
|
|
|
async fetchComments(lazy) {
|
|
|
const result = await this.fetchCommentList({
|
|
|
destId: this.destId,
|
|
|
columnType: this.columnType,
|
...
|
...
|
@@ -81,23 +81,24 @@ export default { |
|
|
if (result.code === 200) {
|
|
|
const comments = get(result, 'data.commentInfos', []);
|
|
|
|
|
|
if (refresh) {
|
|
|
setTimeout(() => {
|
|
|
setTimeout(() => {
|
|
|
if (this.page === 1) {
|
|
|
this.commentList = comments;
|
|
|
}, 200);
|
|
|
} else {
|
|
|
this.commentList = this.commentList.concat(comments);
|
|
|
}
|
|
|
|
|
|
if (comments.length) {
|
|
|
this.page++;
|
|
|
} else {
|
|
|
dirty = false;
|
|
|
}
|
|
|
this.$emit('on-page-change', {
|
|
|
page: this.page,
|
|
|
size: result.data.total
|
|
|
});
|
|
|
console.log('this.commentList')
|
|
|
} else {
|
|
|
this.commentList = this.commentList.concat(comments);
|
|
|
}
|
|
|
if (comments.length) {
|
|
|
this.page++;
|
|
|
} else {
|
|
|
dirty = false;
|
|
|
}
|
|
|
this.$emit('on-page-change', {
|
|
|
page: this.page,
|
|
|
size: result.data.total
|
|
|
});
|
|
|
this.$refs.scroll.forceUpdate(dirty);
|
|
|
}, lazy ? 200 : 0);
|
|
|
} else {
|
|
|
this.$createToast && this.$createToast({
|
|
|
txt: result.message || '服务器开小差了',
|
...
|
...
|
@@ -105,20 +106,20 @@ export default { |
|
|
time: 1000
|
|
|
}).show();
|
|
|
}
|
|
|
this.$refs.scroll.forceUpdate(dirty);
|
|
|
return result;
|
|
|
},
|
|
|
onPullingUp() {
|
|
|
this.fetchComments();
|
|
|
},
|
|
|
async onComment() {
|
|
|
this.init();
|
|
|
this.page = 1;
|
|
|
this.$refs.scroll.scrollTo(0, 0, 200);
|
|
|
this.fetchComments(false);
|
|
|
},
|
|
|
async init() {
|
|
|
this.page = 1;
|
|
|
this.commentList = [];
|
|
|
this.$refs.scroll.forceUpdate(true);
|
|
|
await this.fetchComments(true);
|
|
|
this.fetchComments(true);
|
|
|
},
|
|
|
async onReply({commentId}) {
|
|
|
const result = await this.fetchReplayList({
|
...
|
...
|
|