deploy: auto commit repo-root changes 2026-06-21 16:10:02
This commit is contained in:
@@ -29,7 +29,8 @@
|
|||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<scroll-view scroll-y class="worldcup-scroll">
|
<scroll-view scroll-y class="worldcup-scroll"
|
||||||
|
:scroll-into-view="activeTab === 'schedule' ? scheduleScrollIntoView : ''">
|
||||||
<view v-if="activeTab === 'schedule'" class="worldcup-section">
|
<view v-if="activeTab === 'schedule'" class="worldcup-section">
|
||||||
<view class="worldcup-sortbar" @tap="toggleScheduleSort">
|
<view class="worldcup-sortbar" @tap="toggleScheduleSort">
|
||||||
<text class="worldcup-sortbar__label">{{ scheduleSortLabel }}</text>
|
<text class="worldcup-sortbar__label">{{ scheduleSortLabel }}</text>
|
||||||
@@ -37,14 +38,15 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="scheduleGroups.length">
|
<view v-if="scheduleGroups.length">
|
||||||
<view v-for="group in scheduleGroups" :key="group.key" class="worldcup-group">
|
<view v-for="group in scheduleGroups" :key="group.key" :id="scheduleGroupAnchorId(group.key)"
|
||||||
|
class="worldcup-group">
|
||||||
<view class="worldcup-group__title">
|
<view class="worldcup-group__title">
|
||||||
<view class="worldcup-group__dot"></view>
|
<view class="worldcup-group__dot"></view>
|
||||||
<text>{{ group.label }}</text>
|
<text>{{ group.label }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-for="(match, index) in group.items" :key="match.id || match.match_id"
|
<view v-for="(match, index) in group.items" :key="match.id || match.match_id"
|
||||||
class="wc-match-card" @tap="goMatchDetail(match)">
|
:id="scheduleMatchAnchorId(match)" class="wc-match-card" @tap="goMatchDetail(match)">
|
||||||
<view class="wc-match-card__team wc-match-card__team--left">
|
<view class="wc-match-card__team wc-match-card__team--left">
|
||||||
<image v-if="match.home_icon" class="wc-match-card__logo" :src="match.home_icon"
|
<image v-if="match.home_icon" class="wc-match-card__logo" :src="match.home_icon"
|
||||||
mode="aspectFit" />
|
mode="aspectFit" />
|
||||||
@@ -195,7 +197,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref, watch, onMounted } from 'vue'
|
import { computed, nextTick, onMounted, ref, watch } from 'vue'
|
||||||
import RankingNav from '../pages/worldcup/components/ranking/RankingNav.vue'
|
import RankingNav from '../pages/worldcup/components/ranking/RankingNav.vue'
|
||||||
import StandingsPanel from '../pages/worldcup/components/ranking/StandingsPanel.vue'
|
import StandingsPanel from '../pages/worldcup/components/ranking/StandingsPanel.vue'
|
||||||
import PlayerRankingPanel from '../pages/worldcup/components/ranking/PlayerRankingPanel.vue'
|
import PlayerRankingPanel from '../pages/worldcup/components/ranking/PlayerRankingPanel.vue'
|
||||||
@@ -242,6 +244,7 @@ const activeTab = ref<MainTab>(tabs[0].key)
|
|||||||
const rankingMode = ref<RankingMode>('standings')
|
const rankingMode = ref<RankingMode>('standings')
|
||||||
const scheduleSort = ref<ScheduleSort>('time')
|
const scheduleSort = ref<ScheduleSort>('time')
|
||||||
const activeBracketTab = ref<BracketTabKey>(bracketTabs[0].key)
|
const activeBracketTab = ref<BracketTabKey>(bracketTabs[0].key)
|
||||||
|
const scheduleScrollIntoView = ref('')
|
||||||
const statusBarHeight = ref(0)
|
const statusBarHeight = ref(0)
|
||||||
|
|
||||||
const scheduleData = ref<any>({
|
const scheduleData = ref<any>({
|
||||||
@@ -454,8 +457,18 @@ const initLayout = () => {
|
|||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const scheduleGroupAnchorId = (key: string) => `worldcup-schedule-group-${key}`
|
||||||
|
|
||||||
|
const scheduleMatchAnchorId = (match: any) => {
|
||||||
|
const rawId = match?.id || match?.match_id || `${match?.match_time || 0}-${match?.round_name || ''}-${match?.round_index || 0}`
|
||||||
|
return `worldcup-schedule-match-${String(rawId).replace(/[^a-zA-Z0-9_-]/g, '-')}`
|
||||||
|
}
|
||||||
|
|
||||||
const fetchSchedule = async () => {
|
const fetchSchedule = async () => {
|
||||||
scheduleData.value = await getWorldCupSchedule() || { current_round_name: '', bracket_rounds: [], schedule_rounds: [] }
|
scheduleData.value = await getWorldCupSchedule() || { current_round_name: '', bracket_rounds: [], schedule_rounds: [] }
|
||||||
|
if (activeTab.value === 'schedule') {
|
||||||
|
void scrollScheduleToToday()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchStandings = async () => {
|
const fetchStandings = async () => {
|
||||||
@@ -538,14 +551,17 @@ const getWorldCupDisplayDate = (timestamp: number) => {
|
|||||||
return getLocalMatchDate(timestamp, WORLD_CUP_MATCH_CONTEXT)
|
return getLocalMatchDate(timestamp, WORLD_CUP_MATCH_CONTEXT)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const formatDateKeyFromDate = (date: Date | null) => {
|
||||||
|
if (!date) return '0'
|
||||||
|
const y = date.getFullYear()
|
||||||
|
const m = String(date.getMonth() + 1).padStart(2, '0')
|
||||||
|
const day = String(date.getDate()).padStart(2, '0')
|
||||||
|
return `${y}-${m}-${day}`
|
||||||
|
}
|
||||||
|
|
||||||
const formatDateKey = (timestamp: number) => {
|
const formatDateKey = (timestamp: number) => {
|
||||||
if (!timestamp) return '0'
|
if (!timestamp) return '0'
|
||||||
const d = getWorldCupDisplayDate(timestamp)
|
return formatDateKeyFromDate(getWorldCupDisplayDate(timestamp))
|
||||||
if (!d) return '0'
|
|
||||||
const y = d.getFullYear()
|
|
||||||
const m = String(d.getMonth() + 1).padStart(2, '0')
|
|
||||||
const day = String(d.getDate()).padStart(2, '0')
|
|
||||||
return `${y}-${m}-${day}`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatDateLabel = (timestamp: number) => {
|
const formatDateLabel = (timestamp: number) => {
|
||||||
@@ -576,6 +592,33 @@ const formatBracketDate = (timestamp: number) => {
|
|||||||
return `${date.getMonth() + 1}月${date.getDate()}日`
|
return `${date.getMonth() + 1}月${date.getDate()}日`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getTodayScheduleDateKey = () => formatDateKeyFromDate(new Date())
|
||||||
|
|
||||||
|
const resolveTodayScheduleAnchorId = () => {
|
||||||
|
const todayKey = getTodayScheduleDateKey()
|
||||||
|
if (!todayKey) return ''
|
||||||
|
|
||||||
|
if (scheduleSort.value === 'time') {
|
||||||
|
const group = scheduleGroups.value.find((item) => item.key === todayKey && item.items.length)
|
||||||
|
if (group) return scheduleGroupAnchorId(group.key)
|
||||||
|
}
|
||||||
|
|
||||||
|
const todayMatch = flattenScheduleMatches.value.find((match) => formatDateKey(match.match_time) === todayKey)
|
||||||
|
if (!todayMatch) return ''
|
||||||
|
return scheduleMatchAnchorId(todayMatch)
|
||||||
|
}
|
||||||
|
|
||||||
|
const scrollScheduleToToday = async () => {
|
||||||
|
if (activeTab.value !== 'schedule') return
|
||||||
|
|
||||||
|
const targetId = resolveTodayScheduleAnchorId()
|
||||||
|
if (!targetId) return
|
||||||
|
|
||||||
|
scheduleScrollIntoView.value = ''
|
||||||
|
await nextTick()
|
||||||
|
scheduleScrollIntoView.value = targetId
|
||||||
|
}
|
||||||
|
|
||||||
const matchCenterText = (match: any) => {
|
const matchCenterText = (match: any) => {
|
||||||
if (match.status === 1) return match.current_minute || '进行中'
|
if (match.status === 1) return match.current_minute || '进行中'
|
||||||
if (match.status === 2) return `${match.home_score}-${match.away_score}`
|
if (match.status === 2) return `${match.home_score}-${match.away_score}`
|
||||||
@@ -633,6 +676,12 @@ watch(rankingMode, () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(scheduleSort, () => {
|
||||||
|
if (activeTab.value === 'schedule') {
|
||||||
|
void scrollScheduleToToday()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
initViewState()
|
initViewState()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user