feat(player): 完善 H5 投注端与 API 演示数据

- 球赛/串关/优胜冠军、赛事详情、历史投注与个人资料编辑
- 固定顶栏、公告与底栏,仅内容区滚动
- 底部导航与站点 favicon 使用 logo,登录页精简
- API 种子、冠军盘与历史注单增强

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-02 17:18:11 +08:00
parent 7af2e418c3
commit b5dca1bfb1
75 changed files with 7077 additions and 384 deletions

View File

@@ -0,0 +1,183 @@
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue';
import { useI18n } from 'vue-i18n';
import api from '../api';
import { formatMoney } from '../utils/localeDisplay';
const { locale, t } = useI18n();
const open = ref(false);
const wallet = ref<{ availableBalance?: unknown; frozenBalance?: unknown; currency?: string } | null>(null);
const available = computed(() => formatMoney(wallet.value?.availableBalance, locale.value));
const frozen = computed(() => formatMoney(wallet.value?.frozenBalance, locale.value));
function amountValue(value: unknown): number {
if (value == null) return 0;
if (typeof value === 'number') return Number.isFinite(value) ? value : 0;
if (typeof value === 'string') {
const n = Number(value);
return Number.isFinite(n) ? n : 0;
}
if (typeof value === 'object' && typeof (value as { toString?: () => string }).toString === 'function') {
const n = Number((value as { toString: () => string }).toString());
return Number.isFinite(n) ? n : 0;
}
return 0;
}
const total = computed(() =>
formatMoney(
amountValue(wallet.value?.availableBalance) + amountValue(wallet.value?.frozenBalance),
locale.value,
),
);
onMounted(async () => {
try {
const { data } = await api.get('/player/profile');
wallet.value = data.data?.wallet ?? null;
} catch {
wallet.value = null;
}
});
function toggle() {
open.value = !open.value;
}
function close() {
open.value = false;
}
</script>
<template>
<div class="cash-chip-wrap">
<button type="button" class="cash-chip" @click="toggle">
<span class="chip-body">
<span class="chip-label">{{ t('wallet.cash_balance') }}</span>
<span class="chip-amount">{{ available }}</span>
</span>
<span class="chevron" :class="{ open }"></span>
</button>
<div v-if="open" class="cash-panel">
<div class="panel-row">
<span>{{ t('wallet.cash_balance') }}</span>
<span>{{ total }}</span>
</div>
<div class="panel-divider" />
<div class="panel-row muted">
<span>{{ t('wallet.unsettled') }}</span>
<span>{{ frozen }}</span>
</div>
<div class="panel-row highlight">
<span>{{ t('wallet.available') }}</span>
<span>{{ available }}</span>
</div>
</div>
<div v-if="open" class="backdrop" @click="close" />
</div>
</template>
<style scoped>
.cash-chip-wrap {
position: relative;
z-index: 120;
}
.cash-chip {
display: flex;
align-items: center;
gap: 4px;
padding: 4px 6px 4px 6px;
min-width: 0;
cursor: pointer;
border: 1px solid var(--border);
border-radius: 6px;
background: #141414;
}
.chip-body {
display: flex;
flex-direction: column;
align-items: flex-start;
min-width: 0;
}
.chip-label {
font-size: 9px;
color: var(--text-muted);
font-weight: 600;
letter-spacing: 0.02em;
white-space: nowrap;
line-height: 1.2;
}
.chip-amount {
font-size: 12px;
font-weight: 800;
color: var(--primary-light);
text-shadow: none;
white-space: nowrap;
line-height: 1.2;
}
.chevron {
font-size: 10px;
color: var(--primary-light);
transition: transform 0.2s;
margin-left: 0;
}
.chevron.open {
transform: rotate(180deg);
}
.cash-panel {
position: absolute;
top: calc(100% + 8px);
right: 0;
width: min(260px, 78vw);
padding: 12px 14px;
z-index: 130;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: #141414;
box-shadow: var(--shadow);
}
.cash-panel::before {
display: none;
}
.panel-row {
display: flex;
justify-content: space-between;
gap: 12px;
font-size: 13px;
font-weight: 600;
padding: 6px 0;
}
.panel-row.muted {
color: var(--text-muted);
}
.panel-row.highlight {
color: var(--primary-light);
font-weight: 800;
font-size: 14px;
}
.panel-divider {
height: 1px;
background: linear-gradient(90deg, transparent, var(--border-gold-soft), transparent);
margin: 4px 0;
}
.backdrop {
position: fixed;
inset: 0;
z-index: 110;
}
</style>