From 87476226c39ec1c1ff54f4a4ac15aabf27cefe11 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Tue, 4 Nov 2025 19:17:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A1=8C=E4=B8=9A=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Community/components/UnifiedSearchBox.js | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/views/Community/components/UnifiedSearchBox.js b/src/views/Community/components/UnifiedSearchBox.js index 5f0e1c92..f03e1ea5 100644 --- a/src/views/Community/components/UnifiedSearchBox.js +++ b/src/views/Community/components/UnifiedSearchBox.js @@ -491,9 +491,29 @@ const UnifiedSearchBox = ({ } // 行业标签 - if (industryValue && industryValue.length > 0) { - const industryLabel = industryValue.slice(1).join(' > '); - tags.push({ key: 'industry', label: `行业: ${industryLabel}` }); + if (industryValue && industryValue.length > 0 && industryData) { + // 递归查找每个层级的 label + const findLabel = (code, data) => { + for (const item of data) { + if (code.startsWith(item.value)) { + if(item.value === code){ + return item.label; + }else { + return findLabel(code, item.children); + } + } + } + return null; + }; + + // 只显示最后一级的 label + const lastLevelCode = industryValue[industryValue.length - 1]; + const lastLevelLabel = findLabel(lastLevelCode, industryData); + + tags.push({ + key: 'industry', + label: `行业: ${lastLevelLabel}` + }); } // 日期范围标签