修复首页浮层验收问题
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-05 23:27:17 +08:00
parent ad692e233a
commit a71994d490
3 changed files with 40 additions and 5 deletions

View File

@@ -242,6 +242,16 @@ const isPoiMatchingKeywords = (poi: MuseumPoi, keywords: string[]) => {
return keywords.some((keyword) => searchableText.includes(keyword.trim().toLowerCase())) return keywords.some((keyword) => searchableText.includes(keyword.trim().toLowerCase()))
} }
const findShortcutByKeyword = (keyword: string) => {
const normalized = keyword.trim().toLowerCase()
if (!normalized) return null
return [...primaryFacilities, ...serviceFacilities].find((shortcut) => (
shortcut.label.toLowerCase() === normalized
|| shortcut.keywords.some((item) => item.trim().toLowerCase() === normalized)
)) || null
}
const syncActiveFloor = () => { const syncActiveFloor = () => {
if (!displayFloors.value.length) { if (!displayFloors.value.length) {
activeFloor.value = '' activeFloor.value = ''
@@ -367,6 +377,13 @@ const handleSearchConfirm = async (event?: any) => {
searchKeyword.value = value.trim() searchKeyword.value = value.trim()
searchDraftKeyword.value = searchKeyword.value searchDraftKeyword.value = searchKeyword.value
homeExpanded.value = true homeExpanded.value = true
const matchedShortcut = findShortcutByKeyword(searchKeyword.value)
if (matchedShortcut) {
await searchShortcut(matchedShortcut)
return
}
await loadPois(searchKeyword.value) await loadPois(searchKeyword.value)
} }
@@ -485,6 +502,11 @@ defineExpose({
gap: 8px; gap: 8px;
overflow-x: auto; overflow-x: auto;
padding-bottom: 2px; padding-bottom: 2px;
scrollbar-width: none;
}
.home-category-strip::-webkit-scrollbar {
display: none;
} }
.home-category-chip { .home-category-chip {

View File

@@ -36,7 +36,7 @@
:show-layer-mode-toggle="false" :show-layer-mode-toggle="false"
:show-floor="is3DMode && !showRoutePlanner" :show-floor="is3DMode && !showRoutePlanner"
show-zoom-controls show-zoom-controls
zoom-controls-top="calc(100vh - 252px)" zoom-controls-top="calc(100vh - 292px)"
:route-preview="activeRoutePreview" :route-preview="activeRoutePreview"
:show-route="Boolean(activeRoutePreview)" :show-route="Boolean(activeRoutePreview)"
:disable-auto-exit="disableIndoorAutoExit" :disable-auto-exit="disableIndoorAutoExit"
@@ -638,7 +638,7 @@ const syncTopTabToUrl = (tabId: GuideTopTab) => {
const url = `#/pages/index/index?tab=${tabId}` const url = `#/pages/index/index?tab=${tabId}`
if (window.location.hash !== url) { if (window.location.hash !== url) {
window.history.replaceState(null, '', url) window.history.replaceState(window.history.state, '', url)
} }
} }

View File

@@ -29,6 +29,20 @@ export interface TencentSearchResult {
data: TencentPoiResult[] data: TencentPoiResult[]
} }
const FALLBACK_MUSEUM_ENTRANCE: TencentPoiResult = {
id: 'fallback-shenzhen-natural-museum-entrance',
title: '深圳自然博物馆主入口',
address: '深圳市坪山区燕子湖片区',
category: '博物馆;出入口',
lat: 22.692363,
lng: 114.363487,
location: {
lat: 22.692363,
lng: 114.363487
},
distance: 0
}
/** /**
* 路线规划起点/终点坐标 * 路线规划起点/终点坐标
*/ */
@@ -402,7 +416,7 @@ export function searchPoi(
} }
}, },
fail: (err) => { fail: (err) => {
console.error('腾讯地图 POI 搜索失败:', err) console.info('腾讯地图 POI 搜索暂不可用,已准备使用降级数据:', err)
resolve({ resolve({
status: -1, status: -1,
message: '网络请求失败', message: '网络请求失败',
@@ -423,8 +437,7 @@ export async function searchMuseumEntrance(): Promise<TencentPoiResult | null> {
const museumResult = await searchPoi('深圳自然博物馆', '深圳市', 1, 5) const museumResult = await searchPoi('深圳自然博物馆', '深圳市', 1, 5)
if (museumResult.status !== 0 || museumResult.data.length === 0) { if (museumResult.status !== 0 || museumResult.data.length === 0) {
console.warn('未找到深圳自然博物馆') return FALLBACK_MUSEUM_ENTRANCE
return null
} }
const museum = museumResult.data[0] const museum = museumResult.data[0]