feat: 部分估值展示内容去除年份
This commit is contained in:
@@ -41,10 +41,10 @@ export default function CloudConfigModal({ onConfirm, onCancel, type = 'empty' }
|
||||
: '是否将本地配置同步到云端?'}
|
||||
</p>
|
||||
<div className="row" style={{ flexDirection: 'column', gap: 12 }}>
|
||||
<button className="button" onClick={onConfirm}>
|
||||
<button className="button secondary" onClick={onConfirm}>
|
||||
{isConflict ? '保留本地 (覆盖云端)' : '同步本地到云端'}
|
||||
</button>
|
||||
<button className="button secondary" onClick={onCancel}>
|
||||
<button className="button" onClick={onCancel}>
|
||||
{isConflict ? '使用云端 (覆盖本地)' : '暂不同步'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -34,6 +34,17 @@ const getBrowserTimeZone = () => {
|
||||
const TZ = getBrowserTimeZone();
|
||||
const toTz = (input) => (input ? dayjs.tz(input, TZ) : dayjs().tz(TZ));
|
||||
|
||||
const formatDisplayDate = (value) => {
|
||||
if (!value) return '-';
|
||||
|
||||
const d = toTz(value);
|
||||
if (!d.isValid()) return value;
|
||||
|
||||
const hasTime = /[T\s]\d{2}:\d{2}/.test(String(value));
|
||||
|
||||
return hasTime ? d.format('MM-DD HH:mm') : d.format('MM-DD');
|
||||
};
|
||||
|
||||
export default function FundCard({
|
||||
fund: f,
|
||||
todayStr,
|
||||
@@ -126,7 +137,11 @@ export default function FundCard({
|
||||
<div className="actions">
|
||||
<div className="badge-v">
|
||||
<span>{f.noValuation ? '净值日期' : '估值时间'}</span>
|
||||
<strong>{f.noValuation ? (f.jzrq || '-') : (f.gztime || f.time || '-')}</strong>
|
||||
<strong>
|
||||
{f.noValuation
|
||||
? formatDisplayDate(f.jzrq)
|
||||
: formatDisplayDate(f.gztime || f.time)}
|
||||
</strong>
|
||||
</div>
|
||||
<div className="row" style={{ gap: 4 }}>
|
||||
<button
|
||||
|
||||
@@ -680,15 +680,19 @@ export default function MobileFundTable({
|
||||
const original = info.row.original || {};
|
||||
const date = original.estimateNavDate ?? '-';
|
||||
const displayDate = typeof date === 'string' && date.length > 5 ? date.slice(5) : date;
|
||||
const estimateNav = info.getValue();
|
||||
const hasEstimateNav = estimateNav != null && estimateNav !== '—';
|
||||
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 0 }}>
|
||||
<span style={{ display: 'block', width: '100%', fontWeight: 700 }}>
|
||||
<FitText maxFontSize={14} minFontSize={10}>
|
||||
{info.getValue() ?? '—'}
|
||||
{estimateNav ?? '—'}
|
||||
</FitText>
|
||||
</span>
|
||||
<span className="muted" style={{ fontSize: '10px' }}>{displayDate}</span>
|
||||
{hasEstimateNav && displayDate && displayDate !== '-' ? (
|
||||
<span className="muted" style={{ fontSize: '10px' }}>{displayDate}</span>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
@@ -723,12 +727,16 @@ export default function MobileFundTable({
|
||||
const time = original.estimateTime ?? '-';
|
||||
const displayTime = typeof time === 'string' && time.length > 5 ? time.slice(5) : time;
|
||||
const cls = isMuted ? 'muted' : value > 0 ? 'up' : value < 0 ? 'down' : '';
|
||||
const text = info.getValue();
|
||||
const hasText = text != null && text !== '—';
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 0 }}>
|
||||
<span className={cls} style={{ fontWeight: 700 }}>
|
||||
{info.getValue() ?? '—'}
|
||||
{text ?? '—'}
|
||||
</span>
|
||||
<span className="muted" style={{ fontSize: '10px' }}>{displayTime}</span>
|
||||
{hasText && displayTime && displayTime !== '-' ? (
|
||||
<span className="muted" style={{ fontSize: '10px' }}>{displayTime}</span>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -570,7 +570,8 @@ export default function PcFundTable({
|
||||
minSize: 80,
|
||||
cell: (info) => {
|
||||
const original = info.row.original || {};
|
||||
const date = original.latestNavDate ?? '-';
|
||||
const rawDate = original.latestNavDate ?? '-';
|
||||
const date = typeof rawDate === 'string' && rawDate.length > 5 ? rawDate.slice(5) : rawDate;
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 0 }}>
|
||||
<FitText style={{ fontWeight: 700 }} maxFontSize={14} minFontSize={10} as="div">
|
||||
@@ -594,15 +595,20 @@ export default function PcFundTable({
|
||||
minSize: 80,
|
||||
cell: (info) => {
|
||||
const original = info.row.original || {};
|
||||
const date = original.estimateNavDate ?? '-';
|
||||
const rawDate = original.estimateNavDate ?? '-';
|
||||
const date = typeof rawDate === 'string' && rawDate.length > 5 ? rawDate.slice(5) : rawDate;
|
||||
const estimateNav = info.getValue();
|
||||
const hasEstimateNav = estimateNav != null && estimateNav !== '—';
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 0 }}>
|
||||
<FitText style={{ fontWeight: 700 }} maxFontSize={14} minFontSize={10} as="div">
|
||||
{info.getValue() ?? '—'}
|
||||
{estimateNav ?? '—'}
|
||||
</FitText>
|
||||
<span className="muted" style={{ fontSize: '11px' }}>
|
||||
{date}
|
||||
</span>
|
||||
{hasEstimateNav && date && date !== '-' ? (
|
||||
<span className="muted" style={{ fontSize: '11px' }}>
|
||||
{date}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
@@ -619,7 +625,8 @@ export default function PcFundTable({
|
||||
cell: (info) => {
|
||||
const original = info.row.original || {};
|
||||
const value = original.yesterdayChangeValue;
|
||||
const date = original.yesterdayDate ?? '-';
|
||||
const rawDate = original.yesterdayDate ?? '-';
|
||||
const date = typeof rawDate === 'string' && rawDate.length > 5 ? rawDate.slice(5) : rawDate;
|
||||
const cls = value > 0 ? 'up' : value < 0 ? 'down' : '';
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 0 }}>
|
||||
@@ -646,16 +653,21 @@ export default function PcFundTable({
|
||||
const original = info.row.original || {};
|
||||
const value = original.estimateChangeValue;
|
||||
const isMuted = original.estimateChangeMuted;
|
||||
const time = original.estimateTime ?? '-';
|
||||
const rawTime = original.estimateTime ?? '-';
|
||||
const time = typeof rawTime === 'string' && rawTime.length > 5 ? rawTime.slice(5) : rawTime;
|
||||
const cls = isMuted ? 'muted' : value > 0 ? 'up' : value < 0 ? 'down' : '';
|
||||
const text = info.getValue();
|
||||
const hasText = text != null && text !== '—';
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-end', gap: 0 }}>
|
||||
<FitText className={cls} style={{ fontWeight: 700 }} maxFontSize={14} minFontSize={10} as="div">
|
||||
{info.getValue() ?? '—'}
|
||||
{text ?? '—'}
|
||||
</FitText>
|
||||
<span className="muted" style={{ fontSize: '11px' }}>
|
||||
{time}
|
||||
</span>
|
||||
{hasText && time && time !== '-' ? (
|
||||
<span className="muted" style={{ fontSize: '11px' }}>
|
||||
{time}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user