Restore consistent RMB display and stable image-studio option state after save
Constraint: Fix the visible regressions without changing the broader pricing model or image-studio backend contract. Rejected: Ad hoc page-specific symbol patches | would leave model-pricing views inconsistent and fragile. Confidence: high Scope-risk: narrow Directive: Keep model-pricing summaries on shared currency formatting and keep dynamic image-studio model controls fully controlled after save. Tested: cd web && NODE_OPTIONS='--max-old-space-size=4096' npm run build Not-tested: Browser-click verification on the live model plaza and image-studio settings form.
This commit is contained in:
46
web/src/helpers/utils.jsx
vendored
46
web/src/helpers/utils.jsx
vendored
@@ -880,7 +880,7 @@ export const formatPriceInfo = (priceData, t, quotaDisplayType = 'USD') => {
|
||||
<>
|
||||
{items.map((item) => (
|
||||
<span key={item.key} style={{ color: 'var(--semi-color-text-1)' }}>
|
||||
{item.label} {item.value}
|
||||
{item.label} {formatPriceItemValue(item, quotaDisplayType)}
|
||||
{item.suffix}
|
||||
</span>
|
||||
))}
|
||||
@@ -888,6 +888,50 @@ export const formatPriceInfo = (priceData, t, quotaDisplayType = 'USD') => {
|
||||
);
|
||||
};
|
||||
|
||||
export const formatPriceItemValue = (item, quotaDisplayType = 'USD') => {
|
||||
if (!item) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
const rawValue = item.value;
|
||||
if (rawValue === null || rawValue === undefined || rawValue === '') {
|
||||
return '-';
|
||||
}
|
||||
|
||||
if (quotaDisplayType === 'TOKENS' || String(item.suffix || '').includes('x')) {
|
||||
return rawValue;
|
||||
}
|
||||
|
||||
const statusStr = localStorage.getItem('status');
|
||||
let symbol = '¥';
|
||||
let rate = 1;
|
||||
|
||||
if (quotaDisplayType === 'CNY' || quotaDisplayType === 'USD') {
|
||||
symbol = '¥';
|
||||
try {
|
||||
if (statusStr) {
|
||||
const status = JSON.parse(statusStr);
|
||||
rate = status?.usd_exchange_rate || 7;
|
||||
}
|
||||
} catch {}
|
||||
} else if (quotaDisplayType === 'CUSTOM') {
|
||||
try {
|
||||
if (statusStr) {
|
||||
const status = JSON.parse(statusStr);
|
||||
symbol = status?.custom_currency_symbol || '¤';
|
||||
rate = status?.custom_currency_exchange_rate || 1;
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
const numericValue = Number(rawValue);
|
||||
if (!Number.isFinite(numericValue)) {
|
||||
return `${symbol}${rawValue}`;
|
||||
}
|
||||
|
||||
return `${symbol}${Number((numericValue * rate).toFixed(6))}`;
|
||||
};
|
||||
|
||||
// -------------------------------
|
||||
// CardPro 分页配置函数
|
||||
// 用于创建 CardPro 的 paginationArea 配置
|
||||
|
||||
Reference in New Issue
Block a user