feat(ui): 个人中心按钮调整 + 支持跳转充值明细

- 在线充值 -> 积分充值
- 新增充值明细按钮,点击通过 localStorage 传递初始 tab 跳转 usage-detail
- UsageDetail 支持从 localStorage 读取初始 tab(recharge/consume)
This commit is contained in:
小鱼开发
2026-05-16 09:58:17 +08:00
parent 7491c13d25
commit 99a89fc2a5
2 changed files with 28 additions and 9 deletions
+20 -8
View File
@@ -252,14 +252,26 @@ export default function Profile() {
</div>
</div>
{/* 充值按钮 */}
<button
className="btn btn-primary btn-sm"
style={{ padding: '10px 24px', fontSize: 'var(--font-sm)', whiteSpace: 'nowrap' }}
onClick={() => setShowRechargeModal(true)}
>
线
</button>
{/* 操作按钮 */}
<div style={{ display: 'flex', flexDirection: 'column', gap: '10px' }}>
<button
className="btn btn-primary btn-sm"
style={{ padding: '10px 24px', fontSize: 'var(--font-sm)', whiteSpace: 'nowrap' }}
onClick={() => setShowRechargeModal(true)}
>
</button>
<button
className="btn btn-ghost btn-sm"
style={{ padding: '10px 24px', fontSize: 'var(--font-sm)', whiteSpace: 'nowrap' }}
onClick={() => {
localStorage.setItem('usage-detail-initial-tab', 'recharge');
navigate('usage-detail');
}}
>
</button>
</div>
</div>
</div>
+8 -1
View File
@@ -224,7 +224,14 @@ const SOURCE_TYPE_OPTIONS = [
];
export default function UsageDetail() {
const [activeTab, setActiveTab] = useState<TabType>('consume');
const [activeTab, setActiveTab] = useState<TabType>(() => {
const saved = typeof window !== 'undefined' ? localStorage.getItem('usage-detail-initial-tab') : null;
if (saved === 'recharge' || saved === 'consume') {
localStorage.removeItem('usage-detail-initial-tab');
return saved;
}
return 'consume';
});
const [transactions, setTransactions] = useState<PointTransaction[]>([]);
const [loading, setLoading] = useState(false);
const [sourceType, setSourceType] = useState('');