diff --git a/src/components/search/PoiSearchPanel.vue b/src/components/search/PoiSearchPanel.vue index b4af831..ba16f7d 100644 --- a/src/components/search/PoiSearchPanel.vue +++ b/src/components/search/PoiSearchPanel.vue @@ -242,6 +242,16 @@ const isPoiMatchingKeywords = (poi: MuseumPoi, keywords: string[]) => { 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 = () => { if (!displayFloors.value.length) { activeFloor.value = '' @@ -367,6 +377,13 @@ const handleSearchConfirm = async (event?: any) => { searchKeyword.value = value.trim() searchDraftKeyword.value = searchKeyword.value homeExpanded.value = true + + const matchedShortcut = findShortcutByKeyword(searchKeyword.value) + if (matchedShortcut) { + await searchShortcut(matchedShortcut) + return + } + await loadPois(searchKeyword.value) } @@ -485,6 +502,11 @@ defineExpose({ gap: 8px; overflow-x: auto; padding-bottom: 2px; + scrollbar-width: none; +} + +.home-category-strip::-webkit-scrollbar { + display: none; } .home-category-chip { diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 25d1610..8ec17db 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -36,7 +36,7 @@ :show-layer-mode-toggle="false" :show-floor="is3DMode && !showRoutePlanner" show-zoom-controls - zoom-controls-top="calc(100vh - 252px)" + zoom-controls-top="calc(100vh - 292px)" :route-preview="activeRoutePreview" :show-route="Boolean(activeRoutePreview)" :disable-auto-exit="disableIndoorAutoExit" @@ -638,7 +638,7 @@ const syncTopTabToUrl = (tabId: GuideTopTab) => { const url = `#/pages/index/index?tab=${tabId}` if (window.location.hash !== url) { - window.history.replaceState(null, '', url) + window.history.replaceState(window.history.state, '', url) } } diff --git a/src/services/tencent/TencentMapService.ts b/src/services/tencent/TencentMapService.ts index 082fab9..a38dcdd 100644 --- a/src/services/tencent/TencentMapService.ts +++ b/src/services/tencent/TencentMapService.ts @@ -29,6 +29,20 @@ export interface TencentSearchResult { 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) => { - console.error('腾讯地图 POI 搜索失败:', err) + console.info('腾讯地图 POI 搜索暂不可用,已准备使用降级数据:', err) resolve({ status: -1, message: '网络请求失败', @@ -423,8 +437,7 @@ export async function searchMuseumEntrance(): Promise { const museumResult = await searchPoi('深圳自然博物馆', '深圳市', 1, 5) if (museumResult.status !== 0 || museumResult.data.length === 0) { - console.warn('未找到深圳自然博物馆') - return null + return FALLBACK_MUSEUM_ENTRANCE } const museum = museumResult.data[0]