feat(player): 新增桌面端 UI 与响应式双端路由架构

- 将原移动端页面重命名为 Mobile*,新增 22 个 Desktop* 视图与 DesktopShell 布局体系
- 路由入口改为 Wrapper 视图,通过 useViewport(≥1024px)自动切换移动/桌面端
- 新增投注单面板、盘口弹层、联赛侧栏、数据表格等桌面组件及独立样式令牌
- 扩展 betSlip store、串关筛选、冠军盘、Toast/悬浮信箱等交互与三语 i18n
- 公告/消息 Hub 拆分移动与桌面实现;API 投注/钱包/充值记录支持 pageSize 分页
This commit is contained in:
2026-06-29 18:01:39 +08:00
parent 9c5e8d6f5c
commit 8a1ba0fd95
116 changed files with 22249 additions and 8693 deletions

View File

@@ -0,0 +1,248 @@
<script setup lang="ts">
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { formatLocalMatchDateTime } from '@thebet365/shared';
import { usePlayerHome } from '../composables/usePlayerHome';
import { stripHtml } from '../utils/html';
const AUTOPLAY_MS = 4000;
const router = useRouter();
const { t, locale } = useI18n();
const { announcementItems } = usePlayerHome();
const currentPage = ref(1);
const paused = ref(false);
const itemsPerPage = 3;
let autoplayTimer = 0;
const totalPages = computed(() => Math.max(1, Math.ceil(announcementItems.value.length / itemsPerPage)));
const paginatedItems = computed(() => {
const start = (currentPage.value - 1) * itemsPerPage;
return announcementItems.value.slice(start, start + itemsPerPage);
});
function openDetail(id: string) {
router.push(`/announcements/${id}`);
}
function formatDate(createdAt?: string) {
if (!createdAt) return '';
return formatLocalMatchDateTime(createdAt, locale.value, { variant: 'compact' });
}
function itemTitle(item: (typeof announcementItems.value)[number]) {
const title = item.translation?.title?.trim();
if (title) return title;
return stripHtml(item.translation?.body ?? '') || t('home.announcement_badge');
}
function prevPage() {
currentPage.value = currentPage.value <= 1 ? totalPages.value : currentPage.value - 1;
}
function nextPage() {
currentPage.value = currentPage.value >= totalPages.value ? 1 : currentPage.value + 1;
}
function startAutoplay() {
window.clearInterval(autoplayTimer);
if (totalPages.value <= 1) return;
autoplayTimer = window.setInterval(() => {
if (paused.value) return;
nextPage();
}, AUTOPLAY_MS);
}
function stopAutoplay() {
window.clearInterval(autoplayTimer);
autoplayTimer = 0;
}
onMounted(startAutoplay);
onUnmounted(stopAutoplay);
watch(totalPages, () => {
if (currentPage.value > totalPages.value) {
currentPage.value = 1;
}
startAutoplay();
});
</script>
<template>
<div
v-if="announcementItems.length > 0"
class="home-announce-card"
@mouseenter="paused = true"
@mouseleave="paused = false"
>
<div class="card-header">
<div class="header-title">
<svg class="announce-icon" viewBox="0 0 24 24" aria-hidden="true">
<path fill="currentColor" d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/>
</svg>
<span>{{ t('announcements.title') || '系统公告' }}</span>
</div>
<div v-if="totalPages > 1" class="pagination">
<button type="button" class="page-btn" aria-label="Previous" @click="prevPage"></button>
<span class="page-info">{{ currentPage }} / {{ totalPages }}</span>
<button type="button" class="page-btn" aria-label="Next" @click="nextPage"></button>
</div>
</div>
<div class="card-body">
<Transition name="announce-carousel" mode="out-in">
<div :key="currentPage" class="carousel-slide">
<button
v-for="item in paginatedItems"
:key="item.id"
type="button"
class="announce-row"
@click="openDetail(item.id)"
>
<span class="row-main">
<span class="title">{{ itemTitle(item) }}</span>
<span v-if="item.createdAt" class="date">{{ formatDate(item.createdAt) }}</span>
</span>
<span class="chevron" aria-hidden="true"></span>
</button>
</div>
</Transition>
</div>
</div>
</template>
<style scoped>
.home-announce-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 8px;
overflow: hidden;
}
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
border-bottom: 1px solid var(--border);
background: rgba(201, 162, 39, 0.05);
}
.header-title {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
font-weight: 800;
color: var(--primary-light);
}
.announce-icon {
width: 18px;
height: 18px;
}
.pagination {
display: flex;
align-items: center;
gap: 8px;
}
.page-btn {
width: 24px;
height: 24px;
border-radius: 4px;
border: 1px solid var(--border);
background: #1a1a1a;
color: var(--gold);
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
line-height: 1;
}
.page-info {
font-size: 12px;
color: var(--text-muted);
}
.card-body {
overflow: hidden;
}
.carousel-slide {
display: flex;
flex-direction: column;
}
.announce-row {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
border: none;
background: transparent;
text-align: left;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
transition: background 0.2s;
}
.announce-row:last-child {
border-bottom: none;
}
.announce-row:hover {
background: rgba(255, 255, 255, 0.03);
}
.row-main {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.title {
flex: 1;
font-size: 13px;
color: #fff;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.date {
font-size: 12px;
color: var(--text-muted);
flex-shrink: 0;
}
.chevron {
color: var(--gold);
font-size: 18px;
font-family: monospace;
}
.announce-carousel-enter-active,
.announce-carousel-leave-active {
transition: opacity 0.35s ease, transform 0.35s ease;
}
.announce-carousel-enter-from {
opacity: 0;
transform: translateY(10px);
}
.announce-carousel-leave-to {
opacity: 0;
transform: translateY(-10px);
}
</style>