feat(player): 新增桌面端 UI 与响应式双端路由架构
- 将原移动端页面重命名为 Mobile*,新增 22 个 Desktop* 视图与 DesktopShell 布局体系 - 路由入口改为 Wrapper 视图,通过 useViewport(≥1024px)自动切换移动/桌面端 - 新增投注单面板、盘口弹层、联赛侧栏、数据表格等桌面组件及独立样式令牌 - 扩展 betSlip store、串关筛选、冠军盘、Toast/悬浮信箱等交互与三语 i18n - 公告/消息 Hub 拆分移动与桌面实现;API 投注/钱包/充值记录支持 pageSize 分页
This commit is contained in:
@@ -97,6 +97,41 @@ function collectAnnouncementItems(data: HomePayload | null): PlayerAnnouncementI
|
||||
return source.filter((item) => item.translation?.title || item.translation?.body);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/** 管理端公共内容 → 玩家端首页/跑马灯(单例,避免重复请求) */
|
||||
export function usePlayerHome() {
|
||||
const { t } = useI18n();
|
||||
@@ -135,6 +170,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 +182,7 @@ export function usePlayerHome() {
|
||||
bannerItems,
|
||||
announcements,
|
||||
announcementItems,
|
||||
hubContentItems,
|
||||
hotMatches,
|
||||
upcomingMatches,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user