xhs_get_comments 增加 sort + max_count 控制,评论随详情一起返回

- Comment 新增 subCommentCount,新增 CommentsResult 接口
- GetFeedCommentsSchema 替换 load_all 为 sort (default/newest/most_liked) + max_count (1-100)
- getFeedDetail 不再清空评论,从 Vue store 异步提取首屏评论(轮询 firstRequestFinish)
- getFeedComments 重写:支持排序切换、按 maxCount 加载、返回 hasMore/totalCount
- 前端详情加载后直接显示评论,无需单独请求;底部显示"加载更多评论"按钮
- CommentTree 显示"还有 X 条回复"提示
- 修复 formatTime 对空字符串和无效日期的处理
This commit is contained in:
2026-03-02 17:30:11 +08:00
parent e252310f23
commit a0f3a3cbac
11 changed files with 417 additions and 79 deletions
+10 -2
View File
@@ -85,13 +85,13 @@ export const XHS_SELECTORS = {
/** Comment list container. */
commentListContainer: '.comments-container .list-container',
/** Individual top-level comment items. */
commentItem: '.comments-container .list-container .list-item',
commentItem: '.comments-container .list-container > .parent-comment > .comment-item',
/** Parent comment content text. */
commentContent: '.content',
/** Comment author name. */
commentAuthor: '.author .name',
/** Comment author avatar. */
commentAvatar: '.author .avatar img',
commentAvatar: '.avatar img.avatar-item',
/** Comment like count. */
commentLikeCount: '.like .count',
/** Comment publish time. */
@@ -104,6 +104,14 @@ export const XHS_SELECTORS = {
showMoreComments: '.comments-container .show-more',
/** "Load more replies" button within a comment thread. */
loadMoreReplies: '.sub-comment-list .show-more',
/** Comment sort tab — default (热度). */
commentSortDefault: '.comments-container .tab:first-child, .comments-container .sort-tab:first-child',
/** Comment sort tab — newest (最新). */
commentSortNewest: '.comments-container .tab:nth-child(2), .comments-container .sort-tab:nth-child(2)',
/** Comment sort tab — most liked (最热). */
commentSortHottest: '.comments-container .tab:nth-child(3), .comments-container .sort-tab:nth-child(3)',
/** Sub-comment count text element (e.g. "展开 X 条回复"). */
subCommentCountText: '.sub-comment-list .show-more, .reply-container .show-more',
},
userProfile: {