feat(记录页面): 重构朋友圈同步记录页面功能
- 修改API端点从点赞记录变更为发表记录 - 更新日期格式化函数处理时间戳 - 移除记录卡片中不必要的操作者信息 - 调整样式移除最大宽度限制 - 更新页面标题和空状态提示文本
This commit is contained in:
@@ -59,5 +59,5 @@ export function fetchLikeRecords(
|
||||
if (keyword) {
|
||||
params.keyword = keyword;
|
||||
}
|
||||
return request("/v1/workbench/like-records", params, "GET");
|
||||
return request("/v1/workbench/moments-records", params, "GET");
|
||||
}
|
||||
|
||||
@@ -24,9 +24,10 @@ import { fetchLikeRecords } from "./api";
|
||||
import Layout from "@/components/Layout/Layout";
|
||||
|
||||
// 格式化日期
|
||||
const formatDate = (dateString: string) => {
|
||||
const formatDate = (timestamp: number) => {
|
||||
timestamp = timestamp * 1000;
|
||||
try {
|
||||
const date = new Date(dateString);
|
||||
const date = new Date(timestamp);
|
||||
return date.toLocaleString("zh-CN", {
|
||||
year: "numeric",
|
||||
month: "2-digit",
|
||||
@@ -35,7 +36,7 @@ const formatDate = (dateString: string) => {
|
||||
minute: "2-digit",
|
||||
});
|
||||
} catch (error) {
|
||||
return dateString;
|
||||
return timestamp;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -58,7 +59,7 @@ export default function AutoLikeRecord() {
|
||||
setCurrentPage(1);
|
||||
})
|
||||
.catch(() => {
|
||||
message.error("获取点赞记录失败,请稍后重试");
|
||||
message.error("获取发表记录失败,请稍后重试");
|
||||
})
|
||||
.finally(() => setRecordsLoading(false));
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
@@ -73,7 +74,7 @@ export default function AutoLikeRecord() {
|
||||
setCurrentPage(1);
|
||||
})
|
||||
.catch(() => {
|
||||
message.error("获取点赞记录失败,请稍后重试");
|
||||
message.error("获取发表记录失败,请稍后重试");
|
||||
});
|
||||
};
|
||||
|
||||
@@ -84,7 +85,7 @@ export default function AutoLikeRecord() {
|
||||
setTotal(response.total || 0);
|
||||
})
|
||||
.catch(() => {
|
||||
message.error("获取点赞记录失败,请稍后重试");
|
||||
message.error("获取发表记录失败,请稍后重试");
|
||||
});
|
||||
};
|
||||
|
||||
@@ -96,7 +97,7 @@ export default function AutoLikeRecord() {
|
||||
setCurrentPage(newPage);
|
||||
})
|
||||
.catch(() => {
|
||||
message.error("获取点赞记录失败,请稍后重试");
|
||||
message.error("获取发表记录失败,请稍后重试");
|
||||
});
|
||||
};
|
||||
|
||||
@@ -104,7 +105,7 @@ export default function AutoLikeRecord() {
|
||||
<Layout
|
||||
header={
|
||||
<>
|
||||
<NavCommon title="点赞记录" />
|
||||
<NavCommon title="发表记录" />
|
||||
<div className={styles.headerSearchBar}>
|
||||
<div className={styles.headerSearchInputWrap}>
|
||||
<Input
|
||||
@@ -204,7 +205,7 @@ export default function AutoLikeRecord() {
|
||||
) : records.length === 0 ? (
|
||||
<div className={styles.emptyWrap}>
|
||||
<LikeOutlined className={styles.emptyIcon} />
|
||||
<p className={styles.emptyText}>暂无点赞记录</p>
|
||||
<p className={styles.emptyText}>暂无发表记录</p>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
@@ -213,7 +214,7 @@ export default function AutoLikeRecord() {
|
||||
<div className={styles.recordCardHeader}>
|
||||
<div className={styles.recordCardHeaderLeft}>
|
||||
<Avatar
|
||||
src={record.friendAvatar || undefined}
|
||||
src={record.operatorAvatar || undefined}
|
||||
icon={<UserOutlined />}
|
||||
size={40}
|
||||
className={styles.avatarImg}
|
||||
@@ -223,20 +224,13 @@ export default function AutoLikeRecord() {
|
||||
className={styles.friendName}
|
||||
title={record.friendName}
|
||||
>
|
||||
{record.friendName}
|
||||
{record.operatorName}
|
||||
</div>
|
||||
<div className={styles.friendSub}>
|
||||
{formatDate(record.publishTime)}
|
||||
</div>
|
||||
<div className={styles.friendSub}>内容发布者</div>
|
||||
</div>
|
||||
</div>
|
||||
<Badge
|
||||
className={styles.timeBadge}
|
||||
count={formatDate(record.momentTime || record.likeTime)}
|
||||
style={{
|
||||
background: "#e8f0fe",
|
||||
color: "#333",
|
||||
fontWeight: 400,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Divider className={styles.cardSep} />
|
||||
<div className={styles.cardContent}>
|
||||
@@ -273,28 +267,6 @@ export default function AutoLikeRecord() {
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.operatorWrap}>
|
||||
<Avatar
|
||||
src={record.operatorAvatar || undefined}
|
||||
icon={<UserOutlined />}
|
||||
size={32}
|
||||
className={styles.operatorAvatar}
|
||||
/>
|
||||
<div className={styles.operatorInfo}>
|
||||
<span
|
||||
className={styles.operatorName}
|
||||
title={record.operatorName}
|
||||
>
|
||||
{record.operatorName}
|
||||
</span>
|
||||
<span className={styles.operatorAction}>
|
||||
<LikeOutlined
|
||||
style={{ color: "red", marginRight: 4 }}
|
||||
/>
|
||||
已赞
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
|
||||
@@ -160,7 +160,6 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
max-width: 65%;
|
||||
}
|
||||
.avatarImg {
|
||||
width: 40px;
|
||||
|
||||
Reference in New Issue
Block a user