添加红点
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user