添加粉丝关注页面
This commit is contained in:
@@ -2,13 +2,13 @@ import { useState, useEffect } from "react";
|
||||
import { View, Text, ScrollView, Image } from "@tarojs/components";
|
||||
import { Avatar } from "@nutui/nutui-react-taro";
|
||||
import { withAuth, EmptyState } from "@/components";
|
||||
import noticeService from "@/services/noticeService";
|
||||
import commentService, { CommentActivity } from "@/services/commentService";
|
||||
import Taro from "@tarojs/taro";
|
||||
import "./index.scss";
|
||||
|
||||
// 评论/回复类型定义
|
||||
interface CommentReplyItem {
|
||||
id: string;
|
||||
id: number;
|
||||
user_avatar: string;
|
||||
user_nickname: string;
|
||||
action_type: "comment" | "reply"; // 评论了你的球局 / 回复了你的评论
|
||||
@@ -16,8 +16,8 @@ interface CommentReplyItem {
|
||||
content: string;
|
||||
original_comment?: string; // 被回复的评论内容
|
||||
activity_image: string;
|
||||
activity_id?: string;
|
||||
is_read: number;
|
||||
activity_id: number;
|
||||
activity_title: string;
|
||||
}
|
||||
|
||||
const CommentReply = () => {
|
||||
@@ -34,23 +34,24 @@ const CommentReply = () => {
|
||||
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await noticeService.getNotificationList({
|
||||
notification_type: "comment", // 筛选评论类型
|
||||
const res = await commentService.getMyActivities({
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
});
|
||||
|
||||
if (res.code === 0) {
|
||||
if (res.code === 0 && res.data) {
|
||||
// 映射数据
|
||||
const mappedList = res.data.list.map((item: any) => ({
|
||||
const mappedList = res.data.rows.map((item: CommentActivity) => ({
|
||||
id: item.id,
|
||||
user_avatar: item.related_user_avatar || "",
|
||||
user_nickname: item.related_user_nickname || "匿名用户",
|
||||
action_type: (item.notification_type === "reply" ? "reply" : "comment") as "comment" | "reply",
|
||||
time: item.created_at,
|
||||
user_avatar: item.user?.avatar_url || "",
|
||||
user_nickname: item.user?.nickname || "匿名用户",
|
||||
action_type: item.type === "reply" ? "reply" as const : "comment" as const,
|
||||
time: item.create_time,
|
||||
content: item.content || "",
|
||||
original_comment: item.original_content || "",
|
||||
activity_image: item.activity_image || "",
|
||||
activity_id: item.related_activity_id || "",
|
||||
is_read: item.is_read,
|
||||
original_comment: item.parent_comment?.content || "",
|
||||
activity_image: item.game?.image_list?.[0] || "",
|
||||
activity_id: item.game_id,
|
||||
activity_title: item.game?.title || "",
|
||||
}));
|
||||
|
||||
setCommentList(mappedList);
|
||||
@@ -98,6 +99,13 @@ const CommentReply = () => {
|
||||
// TODO: 跳转到回复页面或弹出回复框
|
||||
};
|
||||
|
||||
// 处理点击球局
|
||||
const handleGameClick = (gameId: number) => {
|
||||
Taro.navigateTo({
|
||||
url: `/game_pages/detail/index?id=${gameId}`,
|
||||
});
|
||||
};
|
||||
|
||||
// 处理返回
|
||||
const handleBack = () => {
|
||||
Taro.navigateBack();
|
||||
@@ -136,14 +144,22 @@ const CommentReply = () => {
|
||||
|
||||
{/* 回复按钮 */}
|
||||
<View className="reply-button" onClick={() => handleReply(item)}>
|
||||
<View className="reply-icon"></View>
|
||||
<Image
|
||||
className="reply-icon"
|
||||
src={require('@/static/message/reply-icon.svg')}
|
||||
/>
|
||||
<Text className="reply-text">回复</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* 右侧球局图片 */}
|
||||
<Image className="activity-image" src={item.activity_image} mode="aspectFill" />
|
||||
<Image
|
||||
className="activity-image"
|
||||
src={item.activity_image}
|
||||
mode="aspectFill"
|
||||
onClick={() => handleGameClick(item.activity_id)}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user