修改回复评论显示

master
于肖磊 2026-02-28 11:31:20 +08:00
parent be7c42bc79
commit 91b2eb40bb
1 changed files with 20 additions and 36 deletions

View File

@ -1464,52 +1464,36 @@
if (this.active_comments && Array.isArray(this.active_comments)) {
//
const filteredComments = [];
for (let i = 0; i < this.active_comments.length; i++) {
const comment = this.active_comments[i];
//
if (comment.id == this.comments_reply_data.id) {
this.comments_reply_data = {};
}
//
if (comment.sub_comments && Array.isArray(comment.sub_comments)) {
// id
const comment_index = comment.sub_comments.findIndex(subComment => subComment.id == this.comments_reply_data.id);
if (comment_index != -1) {
this.comments_reply_data = {};
}
}
}
//
for (let i = 0; i < this.active_comments.length; i++) {
const comment = this.active_comments[i];
// id
if (comment.id == comment_id) {
//
if (comment.id === this.comments_reply_data.id || (comment.sub_comments && Array.isArray(comment.sub_comments) && comment.sub_comments.some(subComment => subComment.id === this.comments_reply_data.id))) {
this.comments_reply_data = {};
}
// id
if (comment.id === comment_id) {
continue;
}
//
//
if (comment.sub_comments && Array.isArray(comment.sub_comments)) {
const index = comment.sub_comments.findIndex(subComment => subComment.id == comment_id);
if (index != -1) {
//
const filteredSubComments = comment.sub_comments.filter(subComment => subComment.id != comment_id);
//
if (filteredSubComments.length <= 0) {
//
const targetSubCommentIndex = comment.sub_comments.findIndex(subComment => subComment.id === comment_id);
if (targetSubCommentIndex !== -1) {
//
comment.sub_comments.splice(targetSubCommentIndex, 1);
//
if (comment.sub_comments.length === 0) {
comment.show_sub_comment = false;
}
comment.sub_comments = filteredSubComments;
//
comment.comments_count = comment.comments_count - 1;
comment.comments_count -= 1;
}
filteredComments.push(comment);
} else {
//
filteredComments.push(comment);
}
//
filteredComments.push(comment);
}
//
this.video_data_list.forEach(item => {