调整馆内点位搜索状态流转
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-13 23:51:27 +08:00
parent 350491157a
commit 2a274aebcf
4 changed files with 186 additions and 6 deletions

View File

@@ -627,6 +627,12 @@ const resetSearchState = async () => {
emitResultsState()
}
// 从详情页返回时只清理搜索 UI 与分类 marker不参与地图目标焦点的复位。
const returnToCollapsedAfterDetail = async () => {
await resetSearchState()
uni.hideKeyboard()
}
const handleCancel = async () => {
await resetSearchState()
uni.hideKeyboard()
@@ -744,14 +750,27 @@ const handleSearchClear = async () => {
await focusSearchInput()
}
const searchShortcut = async (categoryInput: PoiCategoryDefinition | PoiCategoryId) => {
type SearchShortcutOptions = {
homeCategoryResults?: boolean
}
const searchShortcut = async (
categoryInput: PoiCategoryDefinition | PoiCategoryId,
options: SearchShortcutOptions = {}
) => {
const category = typeof categoryInput === 'string'
? getPoiCategoryById(categoryInput)
: categoryInput
if (!category) return
const requestSeq = ++searchRequestSeq
const useHomeResultList = props.variant === 'home' && !homeExpanded.value
const useHomeResultList = props.variant === 'home'
&& (options.homeCategoryResults ?? !homeExpanded.value)
if (useHomeResultList) {
homeExpanded.value = false
searchInputFocused.value = false
uni.hideKeyboard()
}
searchKeyword.value = category.label
searchDraftKeyword.value = category.label
activeCategoryId.value = category.id
@@ -778,7 +797,10 @@ const searchShortcut = async (categoryInput: PoiCategoryDefinition | PoiCategory
}
const handleFacilityShortcut = (category: PoiCategoryDefinition) => {
void searchShortcut(category)
void searchShortcut(category, {
// 快捷入口始终进入首页底部分类结果;关键词确认仍保留全屏搜索结果。
homeCategoryResults: props.variant === 'home'
})
}
const handleSearchConfirm = async (event?: any) => {
@@ -959,6 +981,7 @@ defineExpose({
expandHomePanel,
collapseHomePanel,
resetSearchState,
returnToCollapsedAfterDetail,
focusSearchInput,
searchShortcut,
retryCurrentSearch,