初始化足球投注平台 MVP Monorepo
包含 NestJS 后端、三端前端、Prisma 数据模型、结算引擎测试与 PRD 文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
66
apps/player/src/views/FootballView.vue
Normal file
66
apps/player/src/views/FootballView.vue
Normal file
@@ -0,0 +1,66 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import api from '../api';
|
||||
|
||||
const router = useRouter();
|
||||
const matches = ref<Match[]>([]);
|
||||
|
||||
interface Match {
|
||||
id: string;
|
||||
homeTeamName: string;
|
||||
awayTeamName: string;
|
||||
startTime: string;
|
||||
leagueName: string;
|
||||
markets?: Array<{ marketType: string; selections: Selection[] }>;
|
||||
}
|
||||
|
||||
interface Selection {
|
||||
id: string;
|
||||
selectionCode: string;
|
||||
selectionName: string;
|
||||
odds: string;
|
||||
oddsVersion: string;
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
const { data } = await api.get('/player/matches');
|
||||
matches.value = data.data;
|
||||
});
|
||||
|
||||
function goMatch(id: string) {
|
||||
router.push(`/match/${id}`);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<h2 class="title">足球赛事</h2>
|
||||
<div v-for="match in matches" :key="match.id" class="card">
|
||||
<div class="league">{{ match.leagueName }}</div>
|
||||
<div class="teams" @click="goMatch(match.id)">
|
||||
{{ match.homeTeamName }} vs {{ match.awayTeamName }}
|
||||
</div>
|
||||
<div class="time">{{ new Date(match.startTime).toLocaleString() }}</div>
|
||||
|
||||
<div v-if="match.markets?.length" class="odds-row">
|
||||
<template v-for="market in match.markets.filter(m => m.marketType === 'FT_1X2')" :key="market.marketType">
|
||||
<div v-for="sel in market.selections" :key="sel.id" class="odds-btn" @click="goMatch(match.id)">
|
||||
<div class="label">{{ sel.selectionName }}</div>
|
||||
<div class="value">{{ sel.odds }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!matches.length" class="empty">暂无赛事</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.title { font-size: 18px; margin-bottom: 16px; }
|
||||
.league { font-size: 11px; color: var(--primary); margin-bottom: 4px; }
|
||||
.teams { font-weight: 600; cursor: pointer; margin-bottom: 4px; }
|
||||
.time { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
|
||||
.odds-row { display: flex; gap: 8px; }
|
||||
.empty { text-align: center; color: var(--text-muted); padding: 40px; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user