diff --git a/zhixing-web/src/features/selection/components/pattern-score.tsx b/zhixing-web/src/features/selection/components/pattern-score.tsx index 0f370ab..9f3821a 100644 --- a/zhixing-web/src/features/selection/components/pattern-score.tsx +++ b/zhixing-web/src/features/selection/components/pattern-score.tsx @@ -6,6 +6,13 @@ interface PatternScoreProps { score: SelectionPatternScore | null } +const breakdownLabels = { + trend_structure: "趋势", + kdj_state: "KDJ", + volume_pattern: "量能", + price_shape: "价格形态", +} as const + export function PatternScoreSummary({ score }: PatternScoreProps) { if (!score) return 未评分 if (score.status === "failed") { @@ -44,9 +51,20 @@ export function PatternScoreDetails({ score }: PatternScoreProps) {

{formatScore(score.value)} 分

- - {score.status === "matched" ? "已匹配" : "低于匹配阈值"} - + {score.breakdown ? ( +
+ {Object.entries(breakdownLabels).map(([key, label]) => ( +
+
{label}
+
+ {formatScore( + score.breakdown?.[key as keyof typeof breakdownLabels], + )} +
+
+ ))} +
+ ) : null} ) } diff --git a/zhixing-web/src/features/selection/pages/selection-results-page.test.tsx b/zhixing-web/src/features/selection/pages/selection-results-page.test.tsx index 4e71d33..8a4e311 100644 --- a/zhixing-web/src/features/selection/pages/selection-results-page.test.tsx +++ b/zhixing-web/src/features/selection/pages/selection-results-page.test.tsx @@ -212,7 +212,10 @@ describe("SelectionResultsPage", () => { expect( within(detailPanel).getByText("最接近案例:华纳药厂"), ).toBeInTheDocument() - expect(within(detailPanel).queryByText("价格形态")).not.toBeInTheDocument() + expect(within(detailPanel).getByText("价格形态")).toBeInTheDocument() + expect(within(detailPanel).getByText("趋势")).toBeInTheDocument() + expect(within(detailPanel).getByText("量能")).toBeInTheDocument() + expect(within(detailPanel).queryByText("已匹配")).not.toBeInTheDocument() expect(within(detailPanel).getByText("J 值")).toBeInTheDocument() expect(within(detailPanel).getByText("RSI")).toBeInTheDocument() expect(within(detailPanel).getByText("日涨跌幅")).toBeInTheDocument() @@ -239,7 +242,7 @@ describe("SelectionResultsPage", () => { score: null, }, { - expected: "低于匹配阈值", + expected: "低于阈值", score: { breakdown: { kdj_state: 42,