feat: 筛选添加收益率筛选

This commit is contained in:
zdl
2025-11-04 15:19:24 +08:00
parent 67981f21a2
commit 868b4ccebc

View File

@@ -388,9 +388,22 @@ const UnifiedSearchBox = ({
} }
}); });
// 处理排序参数 - 将 returns_avg/returns_week 转换为 sort=returns + return_type
const sortValue = overrides.sort ?? sort;
let actualSort = sortValue;
let returnType;
if (sortValue === 'returns_avg') {
actualSort = 'returns';
returnType = 'avg';
} else if (sortValue === 'returns_week') {
actualSort = 'returns';
returnType = 'week';
}
const result = { const result = {
// 基础参数overrides 优先级高于本地状态) // 基础参数overrides 优先级高于本地状态)
sort: overrides.sort ?? sort, sort: actualSort,
importance: overrides.importance ?? importance, importance: overrides.importance ?? importance,
date_range: dateRange ? `${dateRange[0].format('YYYY-MM-DD')}${dateRange[1].format('YYYY-MM-DD')}` : '', date_range: dateRange ? `${dateRange[0].format('YYYY-MM-DD')}${dateRange[1].format('YYYY-MM-DD')}` : '',
page: 1, page: 1,
@@ -404,6 +417,11 @@ const UnifiedSearchBox = ({
...overrides ...overrides
}; };
// 添加 return_type 参数(如果需要)
if (returnType) {
result.return_type = returnType;
}
logger.debug('UnifiedSearchBox', '🔧 buildFilterParams - 输出结果', result); logger.debug('UnifiedSearchBox', '🔧 buildFilterParams - 输出结果', result);
return result; return result;
}, [sort, importance, dateRange, filters.q, industryValue]); }, [sort, importance, dateRange, filters.q, industryValue]);
@@ -472,7 +490,12 @@ const UnifiedSearchBox = ({
// 排序标签(排除默认值 'new' // 排序标签(排除默认值 'new'
if (sort && sort !== 'new') { if (sort && sort !== 'new') {
const sortLabel = sort === 'hot' ? '最热' : sort === 'importance' ? '重要性' : sort; let sortLabel;
if (sort === 'hot') sortLabel = '最热';
else if (sort === 'importance') sortLabel = '重要性';
else if (sort === 'returns_avg') sortLabel = '平均收益率';
else if (sort === 'returns_week') sortLabel = '周收益率';
else sortLabel = sort;
tags.push({ key: 'sort', label: `排序: ${sortLabel}` }); tags.push({ key: 'sort', label: `排序: ${sortLabel}` });
} }
@@ -663,6 +686,8 @@ const UnifiedSearchBox = ({
<Option value="new">最新</Option> <Option value="new">最新</Option>
<Option value="hot">最热</Option> <Option value="hot">最热</Option>
<Option value="importance">重要性</Option> <Option value="importance">重要性</Option>
<Option value="returns_avg">平均收益率</Option>
<Option value="returns_week">周收益率</Option>
</AntSelect> </AntSelect>
</Space> </Space>
</Space> </Space>