From 868b4ccebc33923d37c5bac7ff4e5b25c3394365 Mon Sep 17 00:00:00 2001
From: zdl <3489966805@qq.com>
Date: Tue, 4 Nov 2025 15:19:24 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E7=AD=9B=E9=80=89=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E6=94=B6=E7=9B=8A=E7=8E=87=E7=AD=9B=E9=80=89?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Community/components/UnifiedSearchBox.js | 29 +++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/views/Community/components/UnifiedSearchBox.js b/src/views/Community/components/UnifiedSearchBox.js
index 1f6c3ed5..7159194d 100644
--- a/src/views/Community/components/UnifiedSearchBox.js
+++ b/src/views/Community/components/UnifiedSearchBox.js
@@ -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 = {
// 基础参数(overrides 优先级高于本地状态)
- sort: overrides.sort ?? sort,
+ sort: actualSort,
importance: overrides.importance ?? importance,
date_range: dateRange ? `${dateRange[0].format('YYYY-MM-DD')} 至 ${dateRange[1].format('YYYY-MM-DD')}` : '',
page: 1,
@@ -404,6 +417,11 @@ const UnifiedSearchBox = ({
...overrides
};
+ // 添加 return_type 参数(如果需要)
+ if (returnType) {
+ result.return_type = returnType;
+ }
+
logger.debug('UnifiedSearchBox', '🔧 buildFilterParams - 输出结果', result);
return result;
}, [sort, importance, dateRange, filters.q, industryValue]);
@@ -472,7 +490,12 @@ const UnifiedSearchBox = ({
// 排序标签(排除默认值 '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}` });
}
@@ -663,6 +686,8 @@ const UnifiedSearchBox = ({
+
+