perf(player): 优化 Tab 切换性能并改进投注历史展示
- 主 Tab 启用 keep-alive,恢复各页滚动位置,避免切页重复加载与重复请求 - 首页数据缓存、余额/头像共用 profile 缓存,冠军盘与串关面板按需加载 - 球赛与串关列表新增「仅显示待开赛」筛选 - 重构历史注单卡片,展示注单类型、赔率与日期 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -88,6 +88,18 @@ const subtitle = computed(() => {
|
|||||||
|
|
||||||
const stakeAmount = computed(() => formatMoney(props.bet.stake, locale.value));
|
const stakeAmount = computed(() => formatMoney(props.bet.stake, locale.value));
|
||||||
|
|
||||||
|
const oddsText = computed(() => {
|
||||||
|
const o = props.bet.totalOdds;
|
||||||
|
if (o == null || o === '' || o === 0) return '';
|
||||||
|
const n = parseFloat(String(o));
|
||||||
|
return Number.isFinite(n) ? n.toFixed(2) : String(o);
|
||||||
|
});
|
||||||
|
|
||||||
|
const betTypeLabel = computed(() => {
|
||||||
|
if (props.bet.isParlay) return t('bet.parlay');
|
||||||
|
return props.bet.betType || '';
|
||||||
|
});
|
||||||
|
|
||||||
const returnAmount = computed(() => {
|
const returnAmount = computed(() => {
|
||||||
if (statusKey.value === 'won') return formatMoney(props.bet.actualReturn, locale.value);
|
if (statusKey.value === 'won') return formatMoney(props.bet.actualReturn, locale.value);
|
||||||
if (statusKey.value === 'pending') return formatMoney(props.bet.potentialReturn, locale.value);
|
if (statusKey.value === 'pending') return formatMoney(props.bet.potentialReturn, locale.value);
|
||||||
@@ -107,18 +119,23 @@ function goDetail() {
|
|||||||
<template>
|
<template>
|
||||||
<article class="bet-card" @click="goDetail">
|
<article class="bet-card" @click="goDetail">
|
||||||
<StatusWatermark :label="watermarkLabel" :variant="watermarkVariant" />
|
<StatusWatermark :label="watermarkLabel" :variant="watermarkVariant" />
|
||||||
<div class="card-left">
|
<div class="card-body">
|
||||||
<span class="title">{{ title }}</span>
|
<div class="card-header">
|
||||||
<span class="subtitle">{{ subtitle }} · {{ placedDate }}</span>
|
<span v-if="betTypeLabel" class="bet-type-tag">{{ betTypeLabel }}</span>
|
||||||
|
<span class="card-date">{{ placedDate }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-right">
|
<span class="title">{{ title }}</span>
|
||||||
<span class="stake-amt">
|
<div class="card-detail-row">
|
||||||
{{ t('history.stake') }} {{ stakeAmount }}
|
<span class="pick-label">{{ subtitle }}</span>
|
||||||
</span>
|
<span v-if="oddsText" class="odds-badge">@{{ oddsText }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer">
|
||||||
|
<span class="stake-amt">{{ t('history.stake') }} {{ stakeAmount }}</span>
|
||||||
<span class="return-amt" :class="{ highlight: returnHighlight, pending: returnPending, lost: returnLost }">
|
<span class="return-amt" :class="{ highlight: returnHighlight, pending: returnPending, lost: returnLost }">
|
||||||
{{ returnAmount }}
|
{{ returnAmount }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<span class="chevron">›</span>
|
<span class="chevron">›</span>
|
||||||
</article>
|
</article>
|
||||||
</template>
|
</template>
|
||||||
@@ -141,12 +158,37 @@ function goDetail() {
|
|||||||
background: rgba(255, 255, 255, 0.02);
|
background: rgba(255, 255, 255, 0.02);
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-left {
|
.card-body {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 3px;
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bet-type-tag {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--primary-light, #c8a84e);
|
||||||
|
background: rgba(200, 168, 78, 0.12);
|
||||||
|
border: 1px solid rgba(200, 168, 78, 0.25);
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 1px 6px;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-date {
|
||||||
|
font-size: 10px;
|
||||||
|
color: #555;
|
||||||
|
font-weight: 600;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
@@ -158,21 +200,39 @@ function goDetail() {
|
|||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subtitle {
|
.card-detail-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pick-label {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
color: #666;
|
color: #888;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-right {
|
.odds-badge {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 800;
|
||||||
|
color: #c8a84e;
|
||||||
|
background: rgba(200, 168, 78, 0.1);
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 1px 6px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-footer {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
align-items: center;
|
||||||
align-items: flex-end;
|
justify-content: space-between;
|
||||||
gap: 4px;
|
gap: 8px;
|
||||||
|
margin-top: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stake-amt {
|
.stake-amt {
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, onUnmounted, computed } from 'vue';
|
import { ref, onMounted, onUnmounted, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import api from '../api';
|
|
||||||
import { formatMoney } from '../utils/localeDisplay';
|
import { formatMoney } from '../utils/localeDisplay';
|
||||||
|
import { usePlayerProfile } from '../composables/usePlayerProfile';
|
||||||
|
|
||||||
const { locale, t } = useI18n();
|
const { locale, t } = useI18n();
|
||||||
|
const { profileRaw } = usePlayerProfile();
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
const root = ref<HTMLElement | null>(null);
|
const root = ref<HTMLElement | null>(null);
|
||||||
const wallet = ref<{ availableBalance?: unknown; frozenBalance?: unknown; currency?: string } | null>(null);
|
|
||||||
|
const wallet = computed(() => profileRaw.value?.wallet ?? null);
|
||||||
|
|
||||||
function amountValue(value: unknown): number {
|
function amountValue(value: unknown): number {
|
||||||
if (value == null) return 0;
|
if (value == null) return 0;
|
||||||
@@ -33,15 +35,6 @@ const total = computed(() =>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
try {
|
|
||||||
const { data } = await api.get('/player/profile');
|
|
||||||
wallet.value = data.data?.wallet ?? null;
|
|
||||||
} catch {
|
|
||||||
wallet.value = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function toggle() {
|
function toggle() {
|
||||||
open.value = !open.value;
|
open.value = !open.value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { usePlayerProfile } from '../composables/usePlayerProfile';
|
|||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { avatarUrl, loadProfile } = usePlayerProfile();
|
const { avatarUrl } = usePlayerProfile();
|
||||||
const open = ref(false);
|
const open = ref(false);
|
||||||
const root = ref<HTMLElement | null>(null);
|
const root = ref<HTMLElement | null>(null);
|
||||||
|
|
||||||
@@ -19,10 +19,6 @@ const displayAvatarUrl = computed(() => {
|
|||||||
return seed ? playerAvatarUrl(randomAvatarKey(seed)) : null;
|
return seed ? playerAvatarUrl(randomAvatarKey(seed)) : null;
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
void loadProfile();
|
|
||||||
});
|
|
||||||
|
|
||||||
function toggle() {
|
function toggle() {
|
||||||
open.value = !open.value;
|
open.value = !open.value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ const loading = ref(true);
|
|||||||
const matches = ref<ParlayMatch[]>([]);
|
const matches = ref<ParlayMatch[]>([]);
|
||||||
const timeFilter = ref<TimeFilter>('all');
|
const timeFilter = ref<TimeFilter>('all');
|
||||||
const leagueFilter = ref('');
|
const leagueFilter = ref('');
|
||||||
|
const showClosed = ref(false);
|
||||||
const collapsed = ref<Set<string>>(new Set());
|
const collapsed = ref<Set<string>>(new Set());
|
||||||
|
|
||||||
const parlayMarketKeys = PARLAY_MARKET_TYPES.map((c) => c.key);
|
const parlayMarketKeys = PARLAY_MARKET_TYPES.map((c) => c.key);
|
||||||
@@ -190,6 +191,12 @@ const filteredMatches = computed(() => {
|
|||||||
if (leagueFilter.value) {
|
if (leagueFilter.value) {
|
||||||
list = list.filter((m) => (m.leagueId ?? m.leagueName) === leagueFilter.value);
|
list = list.filter((m) => (m.leagueId ?? m.leagueName) === leagueFilter.value);
|
||||||
}
|
}
|
||||||
|
if (!showClosed.value) {
|
||||||
|
list = list.filter((m) => {
|
||||||
|
const phase = m.matchPhase ?? (m.bettingOpen === false ? 'closed_pending' : 'open');
|
||||||
|
return phase === 'open' || phase === undefined;
|
||||||
|
});
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -273,6 +280,14 @@ function toggleCollapse(id: string) {
|
|||||||
<option value="">{{ t('bet.parlay_filter_all') }}</option>
|
<option value="">{{ t('bet.parlay_filter_all') }}</option>
|
||||||
<option v-for="lg in leagues" :key="lg.id" :value="lg.id">{{ lg.name }}</option>
|
<option v-for="lg in leagues" :key="lg.id" :value="lg.id">{{ lg.name }}</option>
|
||||||
</select>
|
</select>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="phase-toggle"
|
||||||
|
:class="{ 'phase-toggle--active': showClosed }"
|
||||||
|
@click="showClosed = !showClosed"
|
||||||
|
>
|
||||||
|
{{ showClosed ? t('bet.show_all_matches') : t('bet.show_open_only') }}
|
||||||
|
</button>
|
||||||
<BetGuideHelp
|
<BetGuideHelp
|
||||||
:title="t('bet.parlay_guide_title')"
|
:title="t('bet.parlay_guide_title')"
|
||||||
:aria-label="t('bet.parlay_guide_help')"
|
:aria-label="t('bet.parlay_guide_help')"
|
||||||
@@ -445,6 +460,25 @@ function toggleCollapse(id: string) {
|
|||||||
max-width: 140px;
|
max-width: 140px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.phase-toggle {
|
||||||
|
padding: 7px 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #888;
|
||||||
|
background: #141414;
|
||||||
|
border: 1px solid #333;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phase-toggle--active {
|
||||||
|
color: var(--primary-light);
|
||||||
|
border-color: var(--primary);
|
||||||
|
background: rgba(200, 168, 78, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
.parlay-foot-fixed {
|
.parlay-foot-fixed {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ function collectAnnouncementLines(data: HomePayload | null): string[] {
|
|||||||
export function usePlayerHome() {
|
export function usePlayerHome() {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
async function load() {
|
async function load(force = false) {
|
||||||
|
if (!force && homeRaw.value) return;
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
const { data } = await api.get('/player/home');
|
const { data } = await api.get('/player/home');
|
||||||
|
|||||||
@@ -10,12 +10,11 @@ import LocaleSwitcher from '../components/LocaleSwitcher.vue';
|
|||||||
import { useAppLocale } from '../composables/useAppLocale';
|
import { useAppLocale } from '../composables/useAppLocale';
|
||||||
import AnnouncementMarquee from '../components/AnnouncementMarquee.vue';
|
import AnnouncementMarquee from '../components/AnnouncementMarquee.vue';
|
||||||
import BottomNavIcon from '../components/BottomNavIcon.vue';
|
import BottomNavIcon from '../components/BottomNavIcon.vue';
|
||||||
import { computed, onMounted, watch } from 'vue';
|
import { computed, onMounted, ref, watch } from 'vue';
|
||||||
import { usePlayerHome } from '../composables/usePlayerHome';
|
import { usePlayerHome } from '../composables/usePlayerHome';
|
||||||
import { useOnLocaleChange } from '../composables/useOnLocaleChange';
|
|
||||||
import { usePlayerProfile } from '../composables/usePlayerProfile';
|
import { usePlayerProfile } from '../composables/usePlayerProfile';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
const auth = useAuthStore();
|
const auth = useAuthStore();
|
||||||
const { initFromUser } = useAppLocale();
|
const { initFromUser } = useAppLocale();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@@ -43,8 +42,22 @@ const showBottomNav = computed(() => {
|
|||||||
});
|
});
|
||||||
const { announcements, load: loadPlayerHome } = usePlayerHome();
|
const { announcements, load: loadPlayerHome } = usePlayerHome();
|
||||||
const { loadProfile } = usePlayerProfile();
|
const { loadProfile } = usePlayerProfile();
|
||||||
|
const mainRef = ref<HTMLElement | null>(null);
|
||||||
|
const tabScrollTops = new Map<string, number>();
|
||||||
|
|
||||||
useOnLocaleChange(loadPlayerHome);
|
watch(locale, (next, prev) => {
|
||||||
|
if (prev && next !== prev) void loadPlayerHome(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => route.fullPath,
|
||||||
|
(_path, oldPath) => {
|
||||||
|
const el = mainRef.value;
|
||||||
|
if (!el) return;
|
||||||
|
if (oldPath) tabScrollTops.set(oldPath, el.scrollTop);
|
||||||
|
el.scrollTop = tabScrollTops.get(route.fullPath) ?? 0;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (auth.user?.locale) initFromUser(auth.user.locale);
|
if (auth.user?.locale) initFromUser(auth.user.locale);
|
||||||
@@ -55,7 +68,7 @@ watch(
|
|||||||
(token) => {
|
(token) => {
|
||||||
if (token) {
|
if (token) {
|
||||||
void loadPlayerHome();
|
void loadPlayerHome();
|
||||||
void loadProfile(true);
|
void loadProfile();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ immediate: true },
|
{ immediate: true },
|
||||||
@@ -77,8 +90,13 @@ watch(
|
|||||||
<AnnouncementMarquee :items="announcements" embedded />
|
<AnnouncementMarquee :items="announcements" embedded />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<main :class="['main', { 'has-nav': showBottomNav }]">
|
<main ref="mainRef" :class="['main', { 'has-nav': showBottomNav }]">
|
||||||
<RouterView />
|
<RouterView v-slot="{ Component, route: viewRoute }">
|
||||||
|
<KeepAlive v-if="viewRoute.meta.keepAlive">
|
||||||
|
<component :is="Component" :key="viewRoute.path" />
|
||||||
|
</KeepAlive>
|
||||||
|
<component v-else :is="Component" :key="viewRoute.fullPath" />
|
||||||
|
</RouterView>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<nav v-if="showBottomNav" class="bottom-nav" aria-label="Main">
|
<nav v-if="showBottomNav" class="bottom-nav" aria-label="Main">
|
||||||
|
|||||||
@@ -150,6 +150,8 @@ const i18n = createI18n({
|
|||||||
tab_parlay: '串关投注',
|
tab_parlay: '串关投注',
|
||||||
tab_today: '今日',
|
tab_today: '今日',
|
||||||
tab_early: '早盘',
|
tab_early: '早盘',
|
||||||
|
show_open_only: '仅显示待开赛',
|
||||||
|
show_all_matches: '显示全部',
|
||||||
today: '今日',
|
today: '今日',
|
||||||
loading: '加载中…',
|
loading: '加载中…',
|
||||||
no_matches: '暂无赛事',
|
no_matches: '暂无赛事',
|
||||||
@@ -460,6 +462,8 @@ const i18n = createI18n({
|
|||||||
tab_parlay: 'Parlay',
|
tab_parlay: 'Parlay',
|
||||||
tab_today: 'Today',
|
tab_today: 'Today',
|
||||||
tab_early: 'Early',
|
tab_early: 'Early',
|
||||||
|
show_open_only: 'Open only',
|
||||||
|
show_all_matches: 'Show all',
|
||||||
today: 'Today',
|
today: 'Today',
|
||||||
loading: 'Loading…',
|
loading: 'Loading…',
|
||||||
no_matches: 'No matches',
|
no_matches: 'No matches',
|
||||||
@@ -776,6 +780,8 @@ const i18n = createI18n({
|
|||||||
tab_parlay: 'Berganda',
|
tab_parlay: 'Berganda',
|
||||||
tab_today: 'Hari Ini',
|
tab_today: 'Hari Ini',
|
||||||
tab_early: 'Awal',
|
tab_early: 'Awal',
|
||||||
|
show_open_only: 'Buka sahaja',
|
||||||
|
show_all_matches: 'Tunjuk semua',
|
||||||
today: 'Hari Ini',
|
today: 'Hari Ini',
|
||||||
loading: 'Memuatkan…',
|
loading: 'Memuatkan…',
|
||||||
no_matches: 'Tiada perlawanan',
|
no_matches: 'Tiada perlawanan',
|
||||||
|
|||||||
@@ -10,17 +10,17 @@ const router = createRouter({
|
|||||||
component: () => import('../layouts/MainLayout.vue'),
|
component: () => import('../layouts/MainLayout.vue'),
|
||||||
meta: { requiresAuth: true },
|
meta: { requiresAuth: true },
|
||||||
children: [
|
children: [
|
||||||
{ path: '', component: () => import('../views/HomeView.vue') },
|
{ path: '', component: () => import('../views/HomeView.vue'), meta: { keepAlive: true } },
|
||||||
{ path: 'bet', component: () => import('../views/FootballView.vue') },
|
{ path: 'bet', component: () => import('../views/FootballView.vue'), meta: { keepAlive: true } },
|
||||||
{ path: 'football', redirect: '/bet' },
|
{ path: 'football', redirect: '/bet' },
|
||||||
{ path: 'match/:id', component: () => import('../views/MatchDetailView.vue') },
|
{ path: 'match/:id', component: () => import('../views/MatchDetailView.vue') },
|
||||||
{ path: 'bets', component: () => import('../views/MyBetsView.vue') },
|
{ path: 'bets', component: () => import('../views/MyBetsView.vue'), meta: { keepAlive: true } },
|
||||||
{ path: 'bets/:betNo', component: () => import('../views/BetDetailView.vue') },
|
{ path: 'bets/:betNo', component: () => import('../views/BetDetailView.vue') },
|
||||||
{ path: 'wallet', component: () => import('../views/WalletView.vue') },
|
{ path: 'wallet', component: () => import('../views/WalletView.vue'), meta: { keepAlive: true } },
|
||||||
{ path: 'wallet/detail', component: () => import('../views/WalletDetailView.vue') },
|
{ path: 'wallet/detail', component: () => import('../views/WalletDetailView.vue') },
|
||||||
{ path: 'wallet/cashbacks', component: () => import('../views/CashbackRecordsView.vue') },
|
{ path: 'wallet/cashbacks', component: () => import('../views/CashbackRecordsView.vue') },
|
||||||
{ path: 'wallet/transactions/:transactionId', component: () => import('../views/WalletTransactionDetailView.vue') },
|
{ path: 'wallet/transactions/:transactionId', component: () => import('../views/WalletTransactionDetailView.vue') },
|
||||||
{ path: 'profile', component: () => import('../views/ProfileView.vue') },
|
{ path: 'profile', component: () => import('../views/ProfileView.vue'), meta: { keepAlive: true } },
|
||||||
{ path: 'profile/cashbacks', component: () => import('../views/CashbackRecordsView.vue') },
|
{ path: 'profile/cashbacks', component: () => import('../views/CashbackRecordsView.vue') },
|
||||||
{ path: 'profile/edit', component: () => import('../views/ProfileEditView.vue') },
|
{ path: 'profile/edit', component: () => import('../views/ProfileEditView.vue') },
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ const slip = useBetSlipStore();
|
|||||||
|
|
||||||
const mainTab = ref<MainTab>('matches');
|
const mainTab = ref<MainTab>('matches');
|
||||||
const timeTab = ref<TimeTab>('early');
|
const timeTab = ref<TimeTab>('early');
|
||||||
|
const showAll = ref(false);
|
||||||
const matches = ref<Match[]>([]);
|
const matches = ref<Match[]>([]);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const expandedLeagues = ref<Set<string>>(new Set());
|
const expandedLeagues = ref<Set<string>>(new Set());
|
||||||
@@ -98,7 +99,10 @@ const filteredMatches = computed(() => {
|
|||||||
if (mainTab.value !== 'matches') return [];
|
if (mainTab.value !== 'matches') return [];
|
||||||
return matches.value.filter((m) => {
|
return matches.value.filter((m) => {
|
||||||
const today = isKickoffToday(m.startTime);
|
const today = isKickoffToday(m.startTime);
|
||||||
return timeTab.value === 'today' ? today : !today;
|
const timeMatch = timeTab.value === 'today' ? today : !today;
|
||||||
|
if (!timeMatch) return false;
|
||||||
|
if (!showAll.value && m.matchPhase !== 'open' && m.matchPhase !== undefined) return false;
|
||||||
|
return true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -219,6 +223,18 @@ function goMatch(id: string) {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="phase-filter">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="phase-toggle"
|
||||||
|
:class="{ 'phase-toggle--active': showAll }"
|
||||||
|
@click="showAll = !showAll"
|
||||||
|
>
|
||||||
|
<span class="phase-toggle-dot" />
|
||||||
|
{{ showAll ? t('bet.show_all_matches') : t('bet.show_open_only') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-if="loading" class="state">
|
<div v-if="loading" class="state">
|
||||||
<GoldSpinner :size="36" />
|
<GoldSpinner :size="36" />
|
||||||
</div>
|
</div>
|
||||||
@@ -242,11 +258,9 @@ function goMatch(id: string) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-show="mainTab === 'outright'" class="outright-tab">
|
<OutrightPanel v-if="mainTab === 'outright'" class="outright-tab" />
|
||||||
<OutrightPanel />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ParlayPanel v-show="mainTab === 'parlay'" />
|
<ParlayPanel v-if="mainTab === 'parlay'" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -330,6 +344,43 @@ function goMatch(id: string) {
|
|||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.phase-filter {
|
||||||
|
padding: 0 12px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phase-toggle {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 6px 14px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #999;
|
||||||
|
background: #141414;
|
||||||
|
border: 1px solid #333;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phase-toggle--active {
|
||||||
|
color: var(--primary-light);
|
||||||
|
border-color: var(--primary);
|
||||||
|
background: rgba(200, 168, 78, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.phase-toggle-dot {
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #555;
|
||||||
|
transition: background 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.phase-toggle--active .phase-toggle-dot {
|
||||||
|
background: var(--primary-light);
|
||||||
|
}
|
||||||
|
|
||||||
.league-list {
|
.league-list {
|
||||||
padding: 4px 12px 0;
|
padding: 4px 12px 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const router = useRouter();
|
|||||||
const { banners, hotMatches, loading, load } = usePlayerHome();
|
const { banners, hotMatches, loading, load } = usePlayerHome();
|
||||||
|
|
||||||
const { pullDistance, refreshing, spinning, progress } = usePullToRefresh({
|
const { pullDistance, refreshing, spinning, progress } = usePullToRefresh({
|
||||||
onRefresh: async () => { await load(); },
|
onRefresh: async () => { await load(true); },
|
||||||
});
|
});
|
||||||
|
|
||||||
const pullIndicatorStyle = () => ({
|
const pullIndicatorStyle = () => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user