feat: 添加通知功能,集成模拟数据并更新通知视图
This commit is contained in:
1
src/mocks/data/index.ts
Normal file
1
src/mocks/data/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
import "./notify";
|
||||
80
src/mocks/data/notify.ts
Normal file
80
src/mocks/data/notify.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import { useMocks } from "..";
|
||||
|
||||
const mocks = useMocks();
|
||||
|
||||
mocks.register("notify.list", () => {
|
||||
const now = new Date();
|
||||
|
||||
return [
|
||||
{
|
||||
id: 1,
|
||||
title: "系统通知",
|
||||
content: "您的账户安全等级已提升至 LV2,现在可以享受更高的交易限额。",
|
||||
date: new Date(now.getTime() - 1000 * 60 * 30).toISOString(), // 30分钟前
|
||||
read: false,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: "交易通知",
|
||||
content: "您的买入订单已成功成交,交易对: BTC/USDT,数量: 0.005 BTC",
|
||||
date: new Date(now.getTime() - 1000 * 60 * 60 * 2).toISOString(), // 2小时前
|
||||
read: false,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: "活动通知",
|
||||
content: "新春特惠活动火热进行中!邀请好友注册交易即可获得最高 100 USDT 奖励,活动截止时间:2025-02-28",
|
||||
date: new Date(now.getTime() - 1000 * 60 * 60 * 5).toISOString(), // 5小时前
|
||||
read: true,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: "安全提醒",
|
||||
content: "检测到您的账户在新设备登录,登录地点:北京,如非本人操作,请立即修改密码并联系客服。",
|
||||
date: new Date(now.getTime() - 1000 * 60 * 60 * 24).toISOString(), // 1天前
|
||||
read: false,
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
title: "交易通知",
|
||||
content: "您的卖出订单已成功成交,交易对: ETH/USDT,数量: 0.1 ETH,成交价格: 2850 USDT",
|
||||
date: new Date(now.getTime() - 1000 * 60 * 60 * 24 * 2).toISOString(), // 2天前
|
||||
read: true,
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
title: "系统通知",
|
||||
content: "平台将于北京时间 2025-01-05 02:00 至 04:00 进行系统升级维护,期间部分功能可能暂时无法使用。",
|
||||
date: new Date(now.getTime() - 1000 * 60 * 60 * 24 * 3).toISOString(), // 3天前
|
||||
read: true,
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
title: "活动通知",
|
||||
content: "恭喜您获得新手礼包!包含 10 USDT 体验金和 7 天 VIP 会员权益,请及时领取。",
|
||||
date: new Date(now.getTime() - 1000 * 60 * 60 * 24 * 5).toISOString(), // 5天前
|
||||
read: true,
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
title: "安全提醒",
|
||||
content: "您的提现申请已通过审核,预计将在 24 小时内到账,请注意查收。",
|
||||
date: new Date(now.getTime() - 1000 * 60 * 60 * 24 * 7).toISOString(), // 7天前
|
||||
read: true,
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
title: "交易通知",
|
||||
content: "市场波动较大,您持仓的 BTC 当前盈利已达 15%,是否考虑止盈?",
|
||||
date: new Date(now.getTime() - 1000 * 60 * 60 * 24 * 10).toISOString(), // 10天前
|
||||
read: true,
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
title: "系统通知",
|
||||
content: "为了更好地保护您的资产安全,建议您开启双重验证(2FA)功能。",
|
||||
date: new Date(now.getTime() - 1000 * 60 * 60 * 24 * 15).toISOString(), // 15天前
|
||||
read: true,
|
||||
},
|
||||
];
|
||||
});
|
||||
Reference in New Issue
Block a user