1. 优化视觉效果、后端规范化

This commit is contained in:
李琦
2026-08-03 08:01:15 +08:00
parent c4ce8d2116
commit 709893b0b0
3 changed files with 178 additions and 108 deletions

View File

@@ -748,9 +748,15 @@ const likeBusy = ref(false)
let likePulseTimer = null
const previewVisible = ref(false), previewIndex = ref(0), albumLoaded = ref(false)
const albumPreviewImages = ref([])
/** 九宫格 / 一大五小:进视口中线后停滚再串行加载
* iOS 性能足够,跳过停滚,让组件进视口自动挂载(保留滚动连续性) */
const HOLD_GALLERY_TYPES = new Set(['nine-grid', 'one-large-five-small'])
/** 重型画廊:安卓进视口中线后停滚再串行加载
* iOS 跳过停滚,由 PhotoGallery 近视口 IO 串行挂载(保留滚动连续性) */
const HOLD_GALLERY_TYPES = new Set([
'nine-grid',
'one-large-five-small',
'overlap',
'masonry',
'polaroid',
])
const isHoldGalleryType = (type) => !isIOS && HOLD_GALLERY_TYPES.has(type)
const galleryActivate = reactive({})
const galleryHold = ref(false)
@@ -965,6 +971,8 @@ const handleUserInteraction = () => {
isInteracting.value = true
cancelAnimationFrame(animId)
clearTimeout(pauseTimer)
// 立刻失效,避免暂停窗口内其它路径用旧 offset 写回顶部
freeScrollOffset = -1
if (isAtBottom()) scheduleBottomReturn(true)
pauseTimer = setTimeout(() => {
isInteracting.value = false
@@ -1099,12 +1107,12 @@ const startAutoScroll = () => {
}, 4500)
} else {
freeScrollLastTs = 0
// 首次或重启动时,把 offset 同步到当前真实位置
if (freeScrollOffset < 0) freeScrollOffset = pageScrollTop()
const tickFreeScroll = (now) => {
const dt = freeScrollLastTs ? Math.min(34, now - freeScrollLastTs) : 16.7
freeScrollLastTs = now
if (canAutoAdvance()) {
// 失效后每帧推进前同步真实位置(打断/开关自动滚后都会走到这里)
if (freeScrollOffset < 0) freeScrollOffset = pageScrollTop()
const max = pageScrollMax()
if (max - freeScrollOffset <= 8) {
scheduleBottomReturn()
@@ -1152,8 +1160,12 @@ const completeIntro = () => {
const toggleAutoScroll = () => {
isAutoScroll.value = !isAutoScroll.value
if (isAutoScroll.value && isAtBottom()) scheduleBottomReturn(true)
if (!isAutoScroll.value) clearBottomReturn()
if (isAutoScroll.value) {
freeScrollOffset = -1
if (isAtBottom()) scheduleBottomReturn(true)
} else {
clearBottomReturn()
}
}
const openInvitation = () => {