feat(ui): 个人中心按钮调整 + 支持跳转充值明细
- 在线充值 -> 积分充值 - 新增充值明细按钮,点击通过 localStorage 传递初始 tab 跳转 usage-detail - UsageDetail 支持从 localStorage 读取初始 tab(recharge/consume)
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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('');
|
||||
|
||||
Reference in New Issue
Block a user