diff --git a/pages/plugins/video/components/comment-info.vue b/pages/plugins/video/components/comment-info.vue index f10adb2c..1bdfbe9e 100644 --- a/pages/plugins/video/components/comment-info.vue +++ b/pages/plugins/video/components/comment-info.vue @@ -304,5 +304,6 @@ .comment-images { width: 80rpx; height: 80rpx; + border-radius: 8rpx; } \ No newline at end of file diff --git a/pages/plugins/video/detail/detail-nvue.css b/pages/plugins/video/detail/detail-nvue.css index 5469282c..52029a82 100644 --- a/pages/plugins/video/detail/detail-nvue.css +++ b/pages/plugins/video/detail/detail-nvue.css @@ -245,6 +245,12 @@ font-size: 28rpx; } +.product-image { + width: 100rpx; + height: 100rpx; + border-radius: 8rpx; +} + .comment-send-button { color: #fff; font-size: 26rpx; diff --git a/pages/plugins/video/detail/detail.css b/pages/plugins/video/detail/detail.css index 0f6c746f..3d1acf9f 100644 --- a/pages/plugins/video/detail/detail.css +++ b/pages/plugins/video/detail/detail.css @@ -101,6 +101,7 @@ .product-card .product-image { width: 100rpx; height: 100rpx; + border-radius: 8rpx; } .product-card .product-name { font-weight: 500; diff --git a/pages/plugins/video/detail/detail.nvue b/pages/plugins/video/detail/detail.nvue index b0ace7e5..90cdcf73 100644 --- a/pages/plugins/video/detail/detail.nvue +++ b/pages/plugins/video/detail/detail.nvue @@ -40,8 +40,8 @@ - - + + {{ video_item.goods.title }} @@ -54,7 +54,7 @@ - {{$t('common.buy')}} {{$t('common.goods')}} + {{$t('common.buy')}}{{$t('common.goods')}} @@ -1126,8 +1126,9 @@ try { this.active_dropdown_id = null; let comment_text = this.comment_input_value; - if (!comment_text.trim()) return; - + if (!comment_text.trim()) { + app.globalData.showToast('请填写评论内容'); + }; // video_id 视频id video_comments_id 父级评论id id 当前评论id let new_video_comments_id = 0; let reply_comments_id = 0 @@ -1150,6 +1151,8 @@ success: res => { const data = res.data; if (data.code == 0) { + // 关闭输入框 + this.is_add_comment = false; const new_data = data.data; // 没有回复时的评论 if (new_video_comments_id == 0) { @@ -1160,13 +1163,6 @@ page: 0, sub_comments: [], }) - this.video_data_list.forEach(item => { - if (item.id == this.current_video_id) { - item.comments_count++; - } - }) - // this.video_data_list = this.video_data_list; - this.$set(this, 'video_data_list', this.video_data_list) this.comment_scroll_top = 0 + Math.random(); // 添加主评论时滚动到最顶部 } else { this.active_comments.forEach(item => { @@ -1183,6 +1179,15 @@ } }) } + // 更新视频数据 + const videoItem = this.video_data_list.find(item => item.id == this.current_video_id); + if (videoItem) { + videoItem.comments_list = this.active_comments; + if (new_video_comments_id == 0) { + videoItem.comments_count++; + } + } + this.$set(this, 'video_data_list', this.video_data_list); // 清空输入框,更新数据内容 this.active_comments = this.active_comments; this.form_images_list = []; @@ -1649,12 +1654,12 @@ // 保留当前评论 filteredComments.push(comment); } - // 删除之后更新评论数据 - this.video_data_list.forEach(item => { - if (item.id == this.current_video_id) { - item.comments_count = filteredComments.length; - } - }) + // 更新视频数据 + const videoItem = this.video_data_list.find(item => item.id == this.current_video_id); + if (videoItem) { + videoItem.comments_list = filteredComments; + videoItem.comments_count = filteredComments.length; + } // 更新数据 this.active_comments = filteredComments; // this.video_data_list = this.video_data_list; diff --git a/pages/plugins/video/detail/detail.vue b/pages/plugins/video/detail/detail.vue index 7cd1e3ab..cb46fce7 100644 --- a/pages/plugins/video/detail/detail.vue +++ b/pages/plugins/video/detail/detail.vue @@ -64,7 +64,7 @@ - {{$t('common.buy')}} {{$t('common.goods')}} + {{$t('common.buy')}}{{$t('common.goods')}} @@ -864,12 +864,20 @@ if (move_distance > 0) { // 向下滑动,切换到上一个 if (this.current_video_index <= 0) { - app.globalData.showToast('已经是第一个视频了'); + setTimeout(() => { + if (!this.show_comment_modal) { + app.globalData.showToast('已经是第一个视频了'); + } + }, 0); } } else { // 向上滑动,切换到下一个 if (this.current_video_index >= this.video_data_list.length - 1) { - app.globalData.showToast('已经是最后一个视频了'); + setTimeout(() => { + if (!this.show_comment_modal) { + app.globalData.showToast('已经是最后一个视频了'); + } + }, 0); } } @@ -1185,7 +1193,9 @@ // 评论 send_comment() { let comment_text = this.comment_input_value; - if (!comment_text.trim()) return; + if (!comment_text.trim()) { + app.globalData.showToast('请填写评论内容'); + }; // video_id 视频id video_comments_id 父级评论id id 当前评论id let new_video_comments_id = 0; @@ -1209,6 +1219,8 @@ success: res => { const data = res.data; if (data.code == 0) { + // 关闭输入框 + this.is_add_comment = false; const new_data = data.data; // 没有回复时的评论 if (new_video_comments_id == 0) { @@ -1219,14 +1231,9 @@ page: 0, sub_comments: [], }) - this.video_data_list.forEach(item => { - if (item.id == this.current_video_id) { - item.comments_count++; - } - }) + this.setData({ - video_data_list: this.video_data_list, - comment_scroll_top: 0 + Math.random() // 添加主评论时滚动到最顶部 + comment_scroll_top: Date.now(), // 添加主评论时滚动到最顶部 }) } else { this.active_comments.forEach(item => { @@ -1243,9 +1250,18 @@ } }) } + // 更新视频数据 + const videoItem = this.video_data_list.find(item => item.id == this.current_video_id); + if (videoItem) { + videoItem.comments_list = this.active_comments; + if (new_video_comments_id == 0) { + videoItem.comments_count++; + } + } // 清空输入框, 更新数据内容 this.setData({ active_comments: this.active_comments, + video_data_list: this.video_data_list, form_images_list: [], comment_input_value: '', comments_reply_data: {}, @@ -1630,12 +1646,12 @@ // 保留当前评论 filteredComments.push(comment); } - // 删除之后更新评论数据 - this.video_data_list.forEach(item => { - if (item.id == this.current_video_id) { - item.comments_count = filteredComments.length; - } - }) + // 更新视频数据 + const videoItem = this.video_data_list.find(item => item.id == this.current_video_id); + if (videoItem) { + videoItem.comments_list = filteredComments; + videoItem.comments_count = filteredComments.length; + } // 更新数据 this.setData({ active_comments: filteredComments,