Compare commits

..

No commits in common. "e81ef0a3758037d7c0973abb6e0f561d2ca6056f" and "6a6233f2de7bf7ccd26eb3c4142f95e705307101" have entirely different histories.

3 changed files with 29 additions and 45 deletions

View File

@ -1 +1,3 @@
# TopFans
# TopFans
密码R251Y>Y8inL_BM=W
https://testflight.apple.com/join/znR5FGdG

View File

@ -5,14 +5,12 @@
scroll-x
:show-scrollbar="false"
:scroll-left="isIOS ? undefined : scrollLeft"
:bounce="false"
@scroll="onScroll"
@touchstart="onTouchStart"
@touchend="onTouchEnd"
@touchcancel="onTouchEnd"
>
<view
ref="waterfallInnerRef"
class="waterfall-inner ios-css-animate"
:style="innerStyle"
>
@ -116,23 +114,23 @@ const cafFn = (id) => {
// ========== iOS CSS ==========
// iOS 使 CSS @keyframes setInterval + scroll-left
const iosScrollPaused = ref(true)
let iosScrollPaused = false
const startIOSAutoScroll = () => {
if (!isComponentMounted || !isIOS) return
iosScrollPaused.value = false
iosScrollPaused = false
}
const stopIOSAutoScroll = () => {
iosScrollPaused.value = true
iosScrollPaused = true
}
const pauseIOSAutoScroll = () => {
iosScrollPaused.value = true
iosScrollPaused = true
}
const resumeIOSAutoScroll = () => {
iosScrollPaused.value = false
iosScrollPaused = false
}
let rafId = null
let userInteracting = false
@ -225,8 +223,8 @@ let isManualScrolling = false // 是否正在手动滚动
const onTouchStart = (e) => {
if (isIOS) {
// iOS CSS
pauseIOSAutoScroll()
// iOS
stopIOSAutoScroll()
isManualScrolling = true
clearTimeout(momentumTimer)
} else {
@ -245,12 +243,13 @@ const onTouchEnd = () => {
const tick = () => {
momentumTimer = setTimeout(() => {
if (Math.abs(currentScrollLeft - lastTouchEndPos) < 2) {
// 500ms
// 300ms
clearTimeout(momentumTimer)
momentumTimer = setTimeout(() => {
isManualScrolling = false
resumeIOSAutoScroll()
}, 1500)
autoScrollPos = currentScrollLeft
startIOSAutoScroll()
}, 300)
} else {
//
lastTouchEndPos = currentScrollLeft
@ -306,9 +305,7 @@ const innerStyle = computed(() => {
height: '100%',
'--scroll-dist': -scrollDist + 'px',
'--anim-duration': duration + 'ms',
'--play-state': iosScrollPaused.value ? 'paused' : 'running',
// animation-play-state
animationPlayState: iosScrollPaused.value ? 'paused' : 'running',
'--play-state': iosScrollPaused ? 'paused' : 'running',
}
})
@ -540,7 +537,7 @@ const batchGetPresignedUrls = async (urls) => {
}
const loadUsers = async () => {
if (!isComponentMounted) return Promise.resolve()
if (!isComponentMounted) return
//
mockDataOffset = 0
@ -761,11 +758,13 @@ onMounted(() => {
// iOS 使
const sysInfo = uni.getSystemInfoSync()
isIOS = sysInfo.platform === 'ios'
console.log('[WaterfallGrid] onMounted, platform:', sysInfo.platform, 'isIOS:', isIOS)
const containerH = props.screenHeight - props.bannerBottom
layout = new WaterfallLayout(containerH, props.category)
loadUsers().then(() => {
isInitialLoading = false
nextTick(() => {
console.log('[WaterfallGrid] loadUsers done, calling auto scroll, isIOS:', isIOS)
if (isIOS) {
startIOSAutoScroll()
} else {
@ -926,32 +925,22 @@ watch(() => props.category, (newCategory) => {
rafId = null
}
// key
//
setTimeout(() => {
loadUsersAndStartScroll()
}, 0)
loadUsers().then(() => {
nextTick(() => {
if (isIOS) {
startIOSAutoScroll()
} else {
startAutoScroll()
}
})
})
}
})
const loadUsersAndStartScroll = () => {
loadUsers().then(() => {
nextTick(() => {
if (isIOS) {
// iOS
iosScrollPaused.value = false
} else {
startAutoScroll()
}
})
})
}
</script>
<style scoped>
.waterfall-scroll {
white-space: nowrap;
overflow: hidden;
}
.waterfall-inner {
@ -963,6 +952,7 @@ const loadUsersAndStartScroll = () => {
.ios-css-animate {
animation: iosAutoScroll var(--anim-duration) linear infinite;
animation-play-state: var(--play-state, running);
}
@keyframes iosAutoScroll {

View File

@ -5,7 +5,6 @@
<!-- 横向瀑布流卡片层内部自带横向滚动 -->
<WaterfallGrid
:key="waterfallKey"
:screenWidth="screenWidth"
:screenHeight="screenHeight"
:bannerBottom="bannerBottomPx"
@ -60,7 +59,7 @@
</template>
<script setup>
import { ref, computed, watch, onMounted, onUnmounted } from 'vue'
import { ref, computed, onMounted, onUnmounted } from 'vue'
import { onLoad, onShow, onHide } from '@dcloudio/uni-app'
import { useStore } from 'vuex'
import Header from '../components/Header.vue'
@ -81,17 +80,10 @@ const currentStarId = ref(uni.getStorageSync('star_id') || null)
// ========== UI State ==========
const activeContentTab = ref('random')
const waterfallKey = ref(0) // WaterfallGrid
const navExpanded = ref(false)
const showRankingModal = ref(false)
const isActive = ref(true)
// ========== Watch activeContentTab ==========
watch(activeContentTab, () => {
// WaterfallGridiOS CSS
waterfallKey.value++
})
// ========== Screen Info ==========
const screenWidth = ref(375)
const screenHeight = ref(812)