fix: load hot league matches for all filter

This commit is contained in:
hajimi
2026-08-03 02:18:32 +08:00
parent a7c4e3f673
commit 9ad49bad57
3 changed files with 36 additions and 18 deletions
+10 -1
View File
@@ -128,7 +128,16 @@ export interface WorldCupOddsMatchItem {
export type MatchLiveCardItem = WorldCupLiveCardItem
export type MatchOddsMatchItem = WorldCupOddsMatchItem
export function getMatchList(data?: Record<string, any>) {
export interface MatchListParams {
sport_type?: number
league_name?: string
hot_only?: 0 | 1
ended_page?: number
ended_page_size?: number
ended_only?: 0 | 1
}
export function getMatchList(data?: MatchListParams) {
return request.get({ url: '/match/lists', data: data }, { withToken: false })
}
@@ -44,7 +44,7 @@
<view class="league-tabs__inner">
<view class="league-tab" :class="{ 'league-tab--active': currentLeague === '' }"
@tap="switchLeague('')">
<text>{{ hotLeagueMode ? '全部热门' : '全部' }}</text>
<text>全部</text>
</view>
<view v-for="(league, idx) in leagueTabs" :key="idx" class="league-tab"
:class="{ 'league-tab--active': currentLeague === league.league_name }"
@@ -68,8 +68,8 @@
<text class="match-group__arrow"></text>
</view>
</view>
<view v-for="item in group.items" :key="item.id || item.match_id" v-show="!collapsedGroups[group.type]"
class="match-card-wrap" @tap="goDetail(item)">
<view v-for="item in group.items" :key="item.id || item.match_id"
v-show="!collapsedGroups[group.type]" class="match-card-wrap" @tap="goDetail(item)">
<MatchCenterScheduleCard :match="item" @detail="goDetail(item)" @ai="goAiAnalysis(item)" />
</view>
</view>
@@ -79,8 +79,7 @@
<text>加载中...</text>
</view>
<view v-if="!scheduleLoading && !matchGroups.length" class="content-empty">
<u-empty :text="hotLeagueMode && !leagueTabs.length ? '暂无后台配置的热门联赛' : '暂无赛事'"
mode="data" />
<u-empty :text="hotLeagueMode && !leagueTabs.length ? '暂无热门联赛' : '暂无赛事'" mode="data" />
</view>
<view v-if="endedNoMore && endedList.length" class="content-nomore">
<text>没有更多赛事了</text>
@@ -131,8 +130,10 @@
<text class="match-live-card__anchor-name">{{ liveAnchorName(live) }}</text>
</view>
<view class="match-live-card__stats">
<text class="match-live-card__stat">观看 {{ formatLiveCount(live.room_view_count) }}</text>
<text class="match-live-card__stat">关注 {{ formatLiveCount(live.room_focus_count) }}</text>
<text class="match-live-card__stat">观看 {{ formatLiveCount(live.room_view_count)
}}</text>
<text class="match-live-card__stat">关注 {{ formatLiveCount(live.room_focus_count)
}}</text>
</view>
<text class="match-live-card__notice">{{ liveRoomNotice(live) }}</text>
</view>
@@ -145,12 +146,10 @@
<block v-else>
<view class="match-odds-filter">
<scroll-view scroll-x
class="match-odds-filter__tabs match-odds-filter__platforms"
<scroll-view scroll-x class="match-odds-filter__tabs match-odds-filter__platforms"
show-scrollbar="false">
<view class="match-odds-filter__tabs-inner">
<view v-for="item in oddsPlatformOptions" :key="item.key"
class="match-odds-filter__tab"
<view v-for="item in oddsPlatformOptions" :key="item.key" class="match-odds-filter__tab"
:class="{ 'match-odds-filter__tab--active': oddsSourceSite === item.key }"
@tap="switchOddsSourceSite(item.key)">
<text>{{ item.label }}</text>
@@ -225,7 +224,7 @@
<text class="match-odds-platform__tag">{{ platform.show_type_text }}</text>
</view>
<text class="match-odds-platform__update">{{ formatOddsUpdateTime(platform.update_time)
}}</text>
}}</text>
</view>
<view v-for="market in platform.markets"
@@ -405,12 +404,9 @@ const ensureSelectedMatchDate = () => {
}
const filterScheduleItems = (items: any[]) => {
const dateFiltered = selectedDateKey.value
return selectedDateKey.value
? items.filter((item: any) => getMatchDateKey(item) === selectedDateKey.value)
: items
if (!hotLeagueMode.value || currentLeague.value) return dateFiltered
const hotLeagueNames = new Set(leagueTabs.value.map((item: any) => String(item?.league_name || '')))
return dateFiltered.filter((item: any) => hotLeagueNames.has(String(item?.league_name || '')))
}
const leagueTabs = computed(() => {
@@ -505,6 +501,7 @@ const fetchMatchList = async (refresh = false) => {
}
if (currentSport.value > 0) params.sport_type = currentSport.value
if (currentLeague.value) params.league_name = currentLeague.value
if (hotLeagueMode.value && !currentLeague.value) params.hot_only = 1
if (!refresh) params.ended_only = 1
const data = await getMatchList(params)
if (refresh) {
@@ -1455,7 +1452,7 @@ onMounted(() => {
padding-top: 14rpx;
border-top: 1rpx solid #eef2f7;
& + & {
&+& {
margin-top: 14rpx;
}
}