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}` + }); } // 日期范围标签