添加红点

This commit is contained in:
张成
2025-11-21 08:42:58 +08:00
parent 35b9d07a91
commit fe523ac2bc
10 changed files with 814 additions and 25 deletions

View File

@@ -3,6 +3,7 @@ import { View, Text, ScrollView, Image, Input } from "@tarojs/components";
import { withAuth, EmptyState, GeneralNavbar } from "@/components";
import { useGlobalState } from "@/store/global";
import commentService, { CommentActivity } from "@/services/commentService";
import messageService from "@/services/messageService";
import { formatShortRelativeTime } from "@/utils/timeUtils";
import Taro from "@tarojs/taro";
import "./index.scss";
@@ -69,6 +70,18 @@ const CommentReply = () => {
}));
setCommentList(mappedList);
// 获取未读评论ID并标记已读
const unreadIds = res.data.rows
.filter((item: any) => item.is_read === 0 && item.activity_type === 'received_reply')
.map((item: any) => item.id);
if (unreadIds.length > 0) {
// 使用统一接口标记已读
messageService.markAsRead('comment', unreadIds).catch(e => {
console.error("标记评论已读失败:", e);
});
}
}
} catch (e) {
Taro.showToast({