feat: 新增综合涨幅
This commit is contained in:
@@ -67,11 +67,12 @@ export default function Announcement() {
|
||||
<div style={{ color: 'var(--text)', lineHeight: '1.6', fontSize: '15px', overflowY: 'auto', minHeight: 0, flex: 1, paddingRight: '4px' }}>
|
||||
<p>v0.2.1 版本更新内容如下:</p>
|
||||
<p>1. 改进拍照识别基金准确度。</p>
|
||||
<p>2. 拍照导入支持识别持仓金额、持仓收益。</p>
|
||||
<p>2. 拍照导入支持选择分组,识别持仓金额、持仓收益。</p>
|
||||
<p>3. 个性化设置新增展示完整基金名称。</p>
|
||||
<p>4. 表格列新增综合涨幅(估值涨幅+持有收益涨幅)。</p>
|
||||
以下功能将会在下一个版本上线:
|
||||
<p>1. 列表页查看基金详情。</p>
|
||||
<p>2. 大盘走势数据。</p>
|
||||
<p>3. 关联板块。</p>
|
||||
<p>1. 大盘走势数据。</p>
|
||||
<p>2. 关联板块。</p>
|
||||
</div>
|
||||
|
||||
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '8px' }}>
|
||||
|
||||
@@ -29,6 +29,7 @@ import { ExitIcon, SettingsIcon, StarIcon } from './Icons';
|
||||
const MOBILE_NON_FROZEN_COLUMN_IDS = [
|
||||
'yesterdayChangePercent',
|
||||
'estimateChangePercent',
|
||||
'totalChangePercent',
|
||||
'todayProfit',
|
||||
'holdingProfit',
|
||||
'latestNav',
|
||||
@@ -39,6 +40,7 @@ const MOBILE_COLUMN_HEADERS = {
|
||||
estimateNav: '估算净值',
|
||||
yesterdayChangePercent: '昨日涨幅',
|
||||
estimateChangePercent: '估值涨幅',
|
||||
totalChangePercent: '综合涨幅',
|
||||
todayProfit: '当日收益',
|
||||
holdingProfit: '持有收益',
|
||||
};
|
||||
@@ -294,6 +296,7 @@ export default function MobileFundTable({
|
||||
estimateNav: 64,
|
||||
yesterdayChangePercent: 72,
|
||||
estimateChangePercent: 80,
|
||||
totalChangePercent: 80,
|
||||
todayProfit: 80,
|
||||
holdingProfit: 80,
|
||||
};
|
||||
@@ -523,6 +526,48 @@ export default function MobileFundTable({
|
||||
},
|
||||
meta: { align: 'right', cellClassName: 'est-change-cell', width: columnWidthMap.estimateChangePercent },
|
||||
},
|
||||
{
|
||||
accessorKey: 'totalChangePercent',
|
||||
header: '综合涨幅',
|
||||
cell: (info) => {
|
||||
const original = info.row.original || {};
|
||||
const estimateValue = original.estimateChangeValue;
|
||||
const hasTodayEstimate = original.hasTodayEstimate;
|
||||
const holdingProfitPercentStr = original.holdingProfitPercent ?? '';
|
||||
|
||||
let holdingProfitPercentValue = null;
|
||||
if (holdingProfitPercentStr && holdingProfitPercentStr !== '') {
|
||||
const numStr = holdingProfitPercentStr.replace(/[+%]/g, '');
|
||||
holdingProfitPercentValue = parseFloat(numStr);
|
||||
}
|
||||
|
||||
const hasEstimate = hasTodayEstimate && estimateValue != null;
|
||||
const hasHolding = holdingProfitPercentValue != null && !isNaN(holdingProfitPercentValue);
|
||||
|
||||
if (!hasEstimate && !hasHolding) {
|
||||
return (
|
||||
<span className="muted" style={{ display: 'block', width: '100%', fontWeight: 700 }}>
|
||||
<FitText maxFontSize={14} minFontSize={10}>
|
||||
—
|
||||
</FitText>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
const total = (hasEstimate ? estimateValue : 0) + (hasHolding ? holdingProfitPercentValue : 0);
|
||||
const cls = total > 0 ? 'up' : total < 0 ? 'down' : '';
|
||||
const displayValue = `${total > 0 ? '+' : ''}${total.toFixed(2)}%`;
|
||||
|
||||
return (
|
||||
<span className={cls} style={{ display: 'block', width: '100%', fontWeight: 700 }}>
|
||||
<FitText maxFontSize={14} minFontSize={10}>
|
||||
{displayValue}
|
||||
</FitText>
|
||||
</span>
|
||||
);
|
||||
},
|
||||
meta: { align: 'right', cellClassName: 'total-change-cell', width: columnWidthMap.totalChangePercent },
|
||||
},
|
||||
{
|
||||
accessorKey: 'todayProfit',
|
||||
header: '当日收益',
|
||||
@@ -689,7 +734,7 @@ export default function MobileFundTable({
|
||||
|
||||
const getAlignClass = (columnId) => {
|
||||
if (columnId === 'fundName') return '';
|
||||
if (['latestNav', 'estimateNav', 'yesterdayChangePercent', 'estimateChangePercent', 'todayProfit', 'holdingProfit'].includes(columnId)) return 'text-right';
|
||||
if (['latestNav', 'estimateNav', 'yesterdayChangePercent', 'estimateChangePercent', 'totalChangePercent', 'todayProfit', 'holdingProfit'].includes(columnId)) return 'text-right';
|
||||
return 'text-right';
|
||||
};
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import { DragIcon, ExitIcon, SettingsIcon, StarIcon, TrashIcon } from './Icons';
|
||||
const NON_FROZEN_COLUMN_IDS = [
|
||||
'yesterdayChangePercent',
|
||||
'estimateChangePercent',
|
||||
'totalChangePercent',
|
||||
'holdingAmount',
|
||||
'todayProfit',
|
||||
'holdingProfit',
|
||||
@@ -41,6 +42,7 @@ const COLUMN_HEADERS = {
|
||||
estimateNav: '估算净值',
|
||||
yesterdayChangePercent: '昨日涨幅',
|
||||
estimateChangePercent: '估值涨幅',
|
||||
totalChangePercent: '综合涨幅',
|
||||
holdingAmount: '持仓金额',
|
||||
todayProfit: '当日收益',
|
||||
holdingProfit: '持有收益',
|
||||
@@ -512,6 +514,49 @@ export default function PcFundTable({
|
||||
cellClassName: 'est-change-cell',
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: 'totalChangePercent',
|
||||
header: '综合涨幅',
|
||||
size: 135,
|
||||
minSize: 100,
|
||||
cell: (info) => {
|
||||
const original = info.row.original || {};
|
||||
const estimateValue = original.estimateChangeValue;
|
||||
const hasTodayEstimate = original.hasTodayEstimate;
|
||||
const holdingProfitPercentStr = original.holdingProfitPercent ?? '';
|
||||
|
||||
let holdingProfitPercentValue = null;
|
||||
if (holdingProfitPercentStr && holdingProfitPercentStr !== '') {
|
||||
const numStr = holdingProfitPercentStr.replace(/[+%]/g, '');
|
||||
holdingProfitPercentValue = parseFloat(numStr);
|
||||
}
|
||||
|
||||
const hasEstimate = hasTodayEstimate && estimateValue != null;
|
||||
const hasHolding = holdingProfitPercentValue != null && !isNaN(holdingProfitPercentValue);
|
||||
|
||||
if (!hasEstimate && !hasHolding) {
|
||||
return (
|
||||
<FitText className="muted" style={{ fontWeight: 700 }} maxFontSize={14} minFontSize={10}>
|
||||
—
|
||||
</FitText>
|
||||
);
|
||||
}
|
||||
|
||||
const total = (hasEstimate ? estimateValue : 0) + (hasHolding ? holdingProfitPercentValue : 0);
|
||||
const cls = total > 0 ? 'up' : total < 0 ? 'down' : '';
|
||||
const displayValue = `${total > 0 ? '+' : ''}${total.toFixed(2)}%`;
|
||||
|
||||
return (
|
||||
<FitText className={cls} style={{ fontWeight: 700 }} maxFontSize={14} minFontSize={10}>
|
||||
{displayValue}
|
||||
</FitText>
|
||||
);
|
||||
},
|
||||
meta: {
|
||||
align: 'right',
|
||||
cellClassName: 'total-change-cell',
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: 'holdingAmount',
|
||||
header: '持仓金额',
|
||||
@@ -898,6 +943,7 @@ export default function PcFundTable({
|
||||
'estimateNav',
|
||||
'yesterdayChangePercent',
|
||||
'estimateChangePercent',
|
||||
'totalChangePercent',
|
||||
'holdingAmount',
|
||||
'todayProfit',
|
||||
'holdingProfit',
|
||||
|
||||
Reference in New Issue
Block a user