From f29d8c10e80bbcb9d7539597fc16e62adca0b59c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E8=82=96=E7=A3=8A?= <18851179580@163.com> Date: Fri, 19 Sep 2025 13:39:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=84=E8=AE=BA=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/video/components/comment-info.vue | 77 ++++++++++++ pages/plugins/video/components/loading.vue | 2 +- pages/plugins/video/detail/detail.vue | 119 ++++++------------ 3 files changed, 117 insertions(+), 81 deletions(-) create mode 100644 pages/plugins/video/components/comment-info.vue diff --git a/pages/plugins/video/components/comment-info.vue b/pages/plugins/video/components/comment-info.vue new file mode 100644 index 00000000..bf6ce463 --- /dev/null +++ b/pages/plugins/video/components/comment-info.vue @@ -0,0 +1,77 @@ + + + + + \ No newline at end of file diff --git a/pages/plugins/video/components/loading.vue b/pages/plugins/video/components/loading.vue index ebcd252e..539a9ff6 100644 --- a/pages/plugins/video/components/loading.vue +++ b/pages/plugins/video/components/loading.vue @@ -4,7 +4,7 @@ - {{ content }} + {{ propsContent }} diff --git a/pages/plugins/video/detail/detail.vue b/pages/plugins/video/detail/detail.vue index 50317418..1927f081 100644 --- a/pages/plugins/video/detail/detail.vue +++ b/pages/plugins/video/detail/detail.vue @@ -47,53 +47,27 @@ - - - - {{ comment_item.userNick }} - {{ comment_item.content }} - - - {{ comment_item.time }} - 回复 - - - - {{ comment_item.likeNum || 0 }} - - + + - + —— 展开{{ comment_item.subComments ? comment_item.subComments.length || 0 : 0 }}条回复 - + @@ -110,10 +84,12 @@ import videoList from '@/pages/plugins/video/detail/video_list.json'; import { get_math } from '@/common/js/common/common.js'; import loadingComponent from '@/pages/plugins/video/components/loading.vue'; + import commentInfoComponent from '@/pages/plugins/video/components/comment-info.vue'; export default { components: { // CommentModal, - loadingComponent + loadingComponent, + commentInfoComponent }, data() { return { @@ -317,7 +293,7 @@ show_sub_comment: false, show_sub_comment_loading: false, is_exactly: false, - subComments: item1, + subComments: [], })); this.setData({ active_comments: new_data, @@ -328,7 +304,6 @@ // 关闭评论区 close_comment_modal() { this.setData({ - active_comments: data, show_comment_modal: false, move_distance: 0, }) @@ -350,7 +325,6 @@ // 评论拖拽结束 handle_comment_touch_end(e) { const move_distance = this.comment_current_y - this.comment_start_y; - // 如果拖拽距离足够大,关闭评论弹窗 if (move_distance > 150) { this.close_comment_modal(); @@ -389,15 +363,22 @@ }, // 展开子评论 open_sub_comment(e) { - console.log(e); const id = e.currentTarget.dataset.id - console.log(id); - - // comment.show_sub_comment = true; - - // this.setData({ - // active_comments: this.active_comments - // }) + const comment = this.active_comments.find(item => item.id === id); + if (comment) { + comment.show_sub_comment = true; + comment.show_sub_comment_loading = true; + setTimeout(() => { + comment.subComments.push({ + id: `c${Date.now()}`, + userHead: 'http://8.146.211.120:8080/upload/avatar/d5537aa243ef6a74a50bf4ffd4ca6876.jpg', // Placeholder avatar + userNick: '我', + content: '子评论内容', + time: new Date().toLocaleString() + }); + comment.show_sub_comment_loading = false; + }, 500); + } }, // 收起子评论 close_sub_comment(comment) { @@ -447,8 +428,7 @@