支持在线时间跨天并优化发布与筛选体验
允许在线时段 end 早于 start 表示跨天,统一展示「次日」文案;修复移动端价格区间清空后被 sessionStorage 回写;优化 PC/移动端在线时间控件密度与通栏展示。
This commit is contained in:
@@ -382,13 +382,19 @@ onBeforeUnmount(() => {
|
||||
watch(
|
||||
() => filterQuerySignature(),
|
||||
() => {
|
||||
syncMobileHomeQuery()
|
||||
// 筛选变化时清空旧列表缓存,避免返回时命中过期数据
|
||||
homeCache.clearList()
|
||||
loadListings(true)
|
||||
// 筛选弹层打开时只改本地 state,避免每个按键写 URL/storage 后被旧缓存回写
|
||||
if (filterOpen.value) return
|
||||
applyFilterStateAndReload()
|
||||
}
|
||||
)
|
||||
|
||||
watch(filterOpen, (open, wasOpen) => {
|
||||
// 关闭弹层时再统一同步 URL 并刷新列表
|
||||
if (wasOpen && !open) {
|
||||
applyFilterStateAndReload()
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => route.query,
|
||||
() => {
|
||||
@@ -623,10 +629,20 @@ function applyRouteQueryToMobileState() {
|
||||
rangeFilters.value = nextRanges
|
||||
}
|
||||
|
||||
function applyFilterStateAndReload() {
|
||||
syncMobileHomeQuery()
|
||||
// 筛选变化时清空旧列表缓存,避免返回时命中过期数据
|
||||
homeCache.clearList()
|
||||
loadListings(true)
|
||||
}
|
||||
|
||||
function syncMobileHomeQuery() {
|
||||
const query = mergeHomeQuery(route.query, mobileHomeFilterQueryKeys, buildMobileHomeQueryValues())
|
||||
if (hasHomeQueryValues(query, mobileHomeFilterQueryKeys)) {
|
||||
storeHomeQuery(mobileHomeFilterStorageKey, query)
|
||||
} else {
|
||||
// 筛选被清空时必须清掉 storage,否则 URL 变空会回退读出旧区间(最后一位删不掉)
|
||||
clearStoredHomeQuery(mobileHomeFilterStorageKey)
|
||||
}
|
||||
if (isSameQuery(route.query, query)) return
|
||||
router.replace({ path: route.path, query })
|
||||
|
||||
Reference in New Issue
Block a user