feat(theme-4): fix dark backgrounds, quick bet, inbox spacing, customer service theme

This commit is contained in:
mars
2026-07-09 18:03:57 +08:00
parent dcf9afacd6
commit ecfea51545
124 changed files with 26710 additions and 8578 deletions

View File

@@ -6,6 +6,27 @@ import { resolveBanners } from '../constants/defaultBanner';
import { resolveAnnouncements } from '../constants/defaultAnnouncement';
import { stripHtml } from '../utils/html';
export interface PlayerHomeMatchSelection {
id: string;
selectionCode?: string;
selectionName: string;
selectionDisplayName?: string;
odds: string;
status?: string;
oddsVersion?: string;
}
export interface PlayerHomeMatchMarket {
id: string;
marketType: string;
marketDisplayName?: string;
lineValue?: number | null;
status: string;
allowSingle?: boolean;
allowParlay?: boolean;
selections: PlayerHomeMatchSelection[];
}
export interface PlayerHomeMatch {
id: string;
leagueName?: string;
@@ -19,6 +40,8 @@ export interface PlayerHomeMatch {
startTime: string;
isHot?: boolean;
displayOrder?: number;
bettingOpen?: boolean;
markets?: PlayerHomeMatchMarket[];
}
export interface PlayerContentItem {
@@ -90,11 +113,66 @@ function collectAnnouncementLines(data: HomePayload | null): string[] {
function collectAnnouncementItems(data: HomePayload | null): PlayerAnnouncementItem[] {
if (!data) return [];
const source =
data.announcements && data.announcements.length > 0
? data.announcements
: [...(data.ticker ?? []), ...(data.notices ?? [])];
return source.filter((item) => item.translation?.title || item.translation?.body);
const seen = new Set<string>();
const merged: PlayerAnnouncementItem[] = [];
const pushItems = (items: PlayerAnnouncementItem[] | undefined) => {
for (const item of items ?? []) {
if (!item?.id || seen.has(item.id)) continue;
if (!item.translation?.title && !item.translation?.body) continue;
seen.add(item.id);
merged.push(item);
}
};
pushItems(data.banners);
pushItems(data.announcements);
pushItems(data.ticker);
pushItems(data.notices);
merged.sort((a, b) => {
const timeA = a.createdAt ? Date.parse(a.createdAt) : 0;
const timeB = b.createdAt ? Date.parse(b.createdAt) : 0;
if (timeB !== timeA) return timeB - timeA;
return (a.sortOrder ?? 0) - (b.sortOrder ?? 0);
});
return merged;
}
function collectHubContentItems(data: HomePayload | null): PlayerContentItem[] {
if (!data) return [];
const seen = new Set<string>();
const merged: PlayerContentItem[] = [];
const pushItems = (items: PlayerContentItem[] | undefined, fallbackType?: string) => {
for (const item of items ?? []) {
if (!item?.id || seen.has(item.id)) continue;
const hasContent =
item.translation?.title?.trim() ||
item.translation?.body?.trim() ||
item.translation?.imageUrl?.trim();
if (!hasContent) continue;
seen.add(item.id);
merged.push({
...item,
contentType: item.contentType || fallbackType,
});
}
};
pushItems(data.banners, 'BANNER');
pushItems(data.ticker, 'TICKER');
pushItems(data.notices, 'NOTICE');
pushItems(data.announcements);
merged.sort((a, b) => {
const timeA = a.createdAt ? Date.parse(a.createdAt) : 0;
const timeB = b.createdAt ? Date.parse(b.createdAt) : 0;
if (timeB !== timeA) return timeB - timeA;
return (a.sortOrder ?? 0) - (b.sortOrder ?? 0);
});
return merged;
}
/** 管理端公共内容 → 玩家端首页/跑马灯(单例,避免重复请求) */
@@ -135,6 +213,7 @@ export function usePlayerHome() {
resolveAnnouncements(collectAnnouncementLines(homeRaw.value), t('home.announcement_default')),
);
const announcementItems = computed(() => collectAnnouncementItems(homeRaw.value));
const hubContentItems = computed(() => collectHubContentItems(homeRaw.value));
const hotMatches = computed(() => homeRaw.value?.hotMatches ?? []);
const upcomingMatches = computed(() => homeRaw.value?.upcomingMatches ?? []);
@@ -146,6 +225,7 @@ export function usePlayerHome() {
bannerItems,
announcements,
announcementItems,
hubContentItems,
hotMatches,
upcomingMatches,
};