feat: format points to K unit when >= 1000
parent
e9e0b360ad
commit
257f6a3c3b
|
|
@ -51,7 +51,7 @@ const NAV_GROUPS: Array<{
|
|||
{
|
||||
label: '商城',
|
||||
items: [
|
||||
{ to: '/points-mall', icon: <CompassOutlined />, label: '积分商城' }
|
||||
{ to: '/points-mall', icon: <CompassOutlined />, label: 'Token商城' }
|
||||
]
|
||||
}
|
||||
];
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ export function usePointsMallPageLogic() {
|
|||
setCategoryId(cats[0].id);
|
||||
}
|
||||
if (meRes.status === 'rejected') {
|
||||
message.error('获取积分信息失败,请稍后重试');
|
||||
message.error('获取Token信息失败,请稍后重试');
|
||||
}
|
||||
} catch {
|
||||
message.error('获取积分信息失败,请稍后重试');
|
||||
message.error('获取Token信息失败,请稍后重试');
|
||||
setOverview({ ...MOCK_OVERVIEW, me: { points: 0, level: 'Lv.0' } });
|
||||
setCategories(MOCK_OVERVIEW.categories);
|
||||
} finally {
|
||||
|
|
@ -135,7 +135,7 @@ export function usePointsMallPageLogic() {
|
|||
return { ...prev, me: { ...prev.me, points: remainingPoints } };
|
||||
});
|
||||
}
|
||||
message.success('已冻结积分并预扣库存,请继续填写收件信息');
|
||||
message.success('已冻结Token并预扣库存,请继续填写收件信息');
|
||||
} catch (e: any) {
|
||||
const msg = e?.response?.data?.message || e?.response?.data?.error || e?.message || '兑换失败,请稍后重试';
|
||||
message.error(msg);
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ export default function PointsMallH5Products({ logic }: Props) {
|
|||
options={[
|
||||
{ value: 'popular', label: '热度优先' },
|
||||
{ value: 'newest', label: '最新上架' },
|
||||
{ value: 'price_asc', label: '积分从低到高' },
|
||||
{ value: 'price_desc', label: '积分从高到低' }
|
||||
{ value: 'price_asc', label: 'Token从低到高' },
|
||||
{ value: 'price_desc', label: 'Token从高到低' }
|
||||
]}
|
||||
/>
|
||||
<Select
|
||||
|
|
@ -95,8 +95,8 @@ export default function PointsMallH5Products({ logic }: Props) {
|
|||
</div>
|
||||
<div className="points-mall-product-price-row h5-points-mall-product-price-row">
|
||||
<div>
|
||||
<span className="points-mall-product-price">{Number(p.pointsPrice).toLocaleString()}</span>
|
||||
<span className="points-mall-product-price-label">积分</span>
|
||||
<span className="points-mall-product-price">{p.pointsPrice >= 1000 ? `${(p.pointsPrice / 1000).toFixed(1)}K` : Number(p.pointsPrice).toLocaleString()}</span>
|
||||
<span className="points-mall-product-price-label">Token</span>
|
||||
</div>
|
||||
<Button
|
||||
type="primary"
|
||||
|
|
@ -104,7 +104,7 @@ export default function PointsMallH5Products({ logic }: Props) {
|
|||
disabled={userPoints < p.pointsPrice || exchangeLoading}
|
||||
onClick={() => handleExchangeClick(p)}
|
||||
>
|
||||
{userPoints < p.pointsPrice ? '积分不足' : '兑换'}
|
||||
{userPoints < p.pointsPrice ? 'Token不足' : '兑换'}
|
||||
</Button>
|
||||
</div>
|
||||
<div className="points-mall-product-footer">
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ export default function PointsMallH5Top({ logic }: Props) {
|
|||
<div className="points-mall-hero h5-points-mall-hero">
|
||||
<div className="points-mall-header h5-points-mall-header">
|
||||
<div className="points-mall-title-section">
|
||||
<h1 className="page-title stats-page-title h5-page-title">积分商城</h1>
|
||||
<h1 className="page-title stats-page-title h5-page-title">Token商城</h1>
|
||||
<p className="page-subtitle stats-page-subtitle h5-page-subtitle">
|
||||
使用积分兑换权益、工具和活动礼包。<br />积分通过 API 调用消费自动累积,1 美元 = 1000 积分。
|
||||
使用token兑换权益、工具和活动礼包。token通过 API 调用消费自动累积。
|
||||
</p>
|
||||
</div>
|
||||
<div className="points-mall-balance-card h5-points-mall-balance-card">
|
||||
|
|
@ -35,8 +35,8 @@ export default function PointsMallH5Top({ logic }: Props) {
|
|||
) : (
|
||||
<div className="points-balance-row h5-points-balance-row">
|
||||
<div className="points-balance-main">
|
||||
<div className="points-balance-label">我的积分</div>
|
||||
<div className="points-balance-value">{userPoints.toLocaleString()}</div>
|
||||
<div className="points-balance-label">我的Token</div>
|
||||
<div className="points-balance-value">{userPoints >= 1000 ? `${(userPoints / 1000).toFixed(1)}K` : userPoints.toLocaleString()}</div>
|
||||
<div className="points-balance-subtext">
|
||||
累计消费 ${typeof totalSpentUSD === 'number' ? totalSpentUSD.toFixed(2) : '--'}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@ export default function PointsMallPageWeb({ logic }: Props) {
|
|||
<div className="points-mall-hero">
|
||||
<div className="points-mall-header">
|
||||
<div className="points-mall-title-section">
|
||||
<h1 className="page-title stats-page-title">积分商城</h1>
|
||||
<p className="page-subtitle stats-page-subtitle">使用积分兑换权益、工具和活动礼包。积分通过 API 调用消费自动累积,1 美元 = 1000 积分。</p>
|
||||
<h1 className="page-title stats-page-title">Token商城</h1>
|
||||
<p className="page-subtitle stats-page-subtitle">使用token兑换权益、工具和活动礼包。token通过 API 调用消费自动累积。</p>
|
||||
</div>
|
||||
<div className="points-mall-balance-card">
|
||||
{overviewLoading ? (
|
||||
|
|
@ -58,8 +58,8 @@ export default function PointsMallPageWeb({ logic }: Props) {
|
|||
) : (
|
||||
<div className="points-balance-row">
|
||||
<div>
|
||||
<div className="points-balance-label">我的积分</div>
|
||||
<div className="points-balance-value">{userPoints.toLocaleString()}</div>
|
||||
<div className="points-balance-label">我的Token</div>
|
||||
<div className="points-balance-value">{userPoints >= 1000 ? `${(userPoints / 1000).toFixed(1)}K` : userPoints.toLocaleString()}</div>
|
||||
<div className="points-balance-subtext">
|
||||
累计消费 ${typeof totalSpentUSD === 'number' ? totalSpentUSD.toFixed(2) : '--'}
|
||||
</div>
|
||||
|
|
@ -152,8 +152,8 @@ export default function PointsMallPageWeb({ logic }: Props) {
|
|||
options={[
|
||||
{ value: 'popular', label: '热度优先' },
|
||||
{ value: 'newest', label: '最新上架' },
|
||||
{ value: 'price_asc', label: '积分从低到高' },
|
||||
{ value: 'price_desc', label: '积分从高到低' },
|
||||
{ value: 'price_asc', label: 'Token从低到高' },
|
||||
{ value: 'price_desc', label: 'Token从高到低' },
|
||||
]}
|
||||
/>
|
||||
<Select
|
||||
|
|
@ -196,8 +196,8 @@ export default function PointsMallPageWeb({ logic }: Props) {
|
|||
</div>
|
||||
<div className="points-mall-product-price-row">
|
||||
<div>
|
||||
<span className="points-mall-product-price">{Number(p.pointsPrice).toLocaleString()}</span>
|
||||
<span className="points-mall-product-price-label">积分</span>
|
||||
<span className="points-mall-product-price">{p.pointsPrice >= 1000 ? `${(p.pointsPrice / 1000).toFixed(1)}K` : Number(p.pointsPrice).toLocaleString()}</span>
|
||||
<span className="points-mall-product-price-label">Token</span>
|
||||
</div>
|
||||
<Button
|
||||
type="primary"
|
||||
|
|
@ -205,7 +205,7 @@ export default function PointsMallPageWeb({ logic }: Props) {
|
|||
disabled={userPoints < p.pointsPrice || exchangeLoading}
|
||||
onClick={() => handleExchangeClick(p)}
|
||||
>
|
||||
{userPoints < p.pointsPrice ? '积分不足' : '兑换'}
|
||||
{userPoints < p.pointsPrice ? 'Token不足' : '兑换'}
|
||||
</Button>
|
||||
</div>
|
||||
<div className="points-mall-product-footer">
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export const MOCK_OVERVIEW: PointsMallOverview = {
|
|||
banners: [{ id: 'b1', title: '本期活动', subtitle: 'Up to 25% Off', imageUrl: '', linkUrl: '' }],
|
||||
promoEntries: [
|
||||
{ id: 'p1', title: '促销活动', subtitle: '本周精选', linkUrl: '' },
|
||||
{ id: 'p2', title: '积分任务', subtitle: '快速涨积分', linkUrl: '' }
|
||||
{ id: 'p2', title: 'Token任务', subtitle: '快速涨Token', linkUrl: '' }
|
||||
]
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ export default function StatsPageWeb({ logic }: { logic: StatsPageLogic }) {
|
|||
<h1 className="page-title stats-page-title">调用统计</h1>
|
||||
<p className="page-subtitle stats-page-subtitle">
|
||||
不只是查看调用数量,而是帮助你感知哪些智能体正在被频繁使用、最近的消息趋势如何,以及整体会话是否健康增长。
|
||||
每消费 1 美元可获得 1000 积分。
|
||||
</p>
|
||||
</div>
|
||||
<div className="stats-page-summary-card">
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ export default function StatsPointsCard({ logic }: { logic: StatsPageLogic }) {
|
|||
return (
|
||||
<div className="points-integration-section">
|
||||
<Card
|
||||
title="消费与积分"
|
||||
title="消费与Token"
|
||||
className="points-integration-card"
|
||||
extra={<Tag bordered={false} className="stats-soft-tag">1 USD = 1000 积分</Tag>}
|
||||
extra={<Tag bordered={false} className="stats-soft-tag">1 USD = 1000 Token</Tag>}
|
||||
>
|
||||
<div className="points-integration-row">
|
||||
<div className="points-integration-item">
|
||||
|
|
@ -22,7 +22,7 @@ export default function StatsPointsCard({ logic }: { logic: StatsPageLogic }) {
|
|||
<div className="points-integration-item">
|
||||
<div className="points-integration-label">
|
||||
<GiftOutlined className="stats-tone-brand-text" />
|
||||
累计积分
|
||||
累计Token
|
||||
</div>
|
||||
<div className="points-integration-value">{logic.formatPoints(logic.totalPoints)}</div>
|
||||
<div className="points-integration-desc">可用于兑换商城商品</div>
|
||||
|
|
@ -30,10 +30,10 @@ export default function StatsPointsCard({ logic }: { logic: StatsPageLogic }) {
|
|||
<div className="points-integration-item">
|
||||
<div className="points-integration-label">
|
||||
<BarChartOutlined className="stats-tone-success-text" />
|
||||
积分汇率
|
||||
Token兑换汇率
|
||||
</div>
|
||||
<div className="points-integration-value">1:1000</div>
|
||||
<div className="points-integration-desc">每消费 1 美元获得 1000 积分</div>
|
||||
{/* <div className="points-integration-value">100:1</div> */}
|
||||
{/* <div className="points-integration-desc">每消费 100 token 获得 1 Token</div> */}
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
|
|
|||
Loading…
Reference in New Issue