From 7421e9dd7c7be8e324dc3c575076a80bb0352f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=B1=BC=E5=BC=80=E5=8F=91?= Date: Sat, 16 May 2026 09:43:06 +0800 Subject: [PATCH] =?UTF-8?q?feat(ui):=20=E4=B8=AA=E4=BA=BA=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E7=A7=AF=E5=88=86=E7=BB=9F=E8=AE=A1=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 当前积分 -> 剩余积分 - 新增今日消耗统计(基于最近10条交易记录计算) --- tauri-app/src/pages/Profile/Profile.tsx | 29 ++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/tauri-app/src/pages/Profile/Profile.tsx b/tauri-app/src/pages/Profile/Profile.tsx index b9f7e62..77e4828 100644 --- a/tauri-app/src/pages/Profile/Profile.tsx +++ b/tauri-app/src/pages/Profile/Profile.tsx @@ -207,12 +207,31 @@ export default function Profile() { {/* 积分区 */}
-
-
- 当前积分 +
+
+
+ 剩余积分 +
+
+ {balance?.balance ?? 0} +
-
- {balance?.balance ?? 0} +
+
+ 今日消耗 +
+
+ {(() => { + const todayStr = new Date().toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '-'); + return recentTx + .filter(tx => { + if (tx.type !== 'consume') return false; + const txDate = new Date(tx.createdAt).toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit' }).replace(/\//g, '-'); + return txDate === todayStr; + }) + .reduce((sum, tx) => sum + tx.amount, 0); + })()} +