From 5f48a8a55e9abfa2606c810e036cdab27fc44f17 Mon Sep 17 00:00:00 2001
From: Bravepping <1131302745@qq.com>
Date: Tue, 22 Apr 2025 19:38:08 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=AF=94=E8=B5=9B=E7=8A=B6?=
=?UTF-8?q?=E6=80=81=E6=98=BE=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.html | 12 ++
src/components/LiveStream.vue | 230 +++++++++++++++++++++++----------
src/components/NBASchedule.vue | 74 +++++------
3 files changed, 205 insertions(+), 111 deletions(-)
diff --git a/index.html b/index.html
index 45ad93c..d522ca1 100644
--- a/index.html
+++ b/index.html
@@ -4,6 +4,18 @@
+
NBA在线
diff --git a/src/components/LiveStream.vue b/src/components/LiveStream.vue
index 4cbc3f9..1dce9a1 100644
--- a/src/components/LiveStream.vue
+++ b/src/components/LiveStream.vue
@@ -5,27 +5,28 @@
-
{{ gameData.awayTeam.city }}
+
{{ gameData.awayTeam.name }}
{{ gameData.awayTeam.record }}
-
+
VS
-
+
-
![]()
+
-
{{ gameData.homeTeam.city }}
+
{{ gameData.homeTeam.name }}
{{ gameData.homeTeam.record }}
+
-
+
-
+
@@ -40,117 +41,171 @@
-
+
-
+
\ No newline at end of file
+
diff --git a/src/components/NBASchedule.vue b/src/components/NBASchedule.vue
index 497c86e..c12bffc 100644
--- a/src/components/NBASchedule.vue
+++ b/src/components/NBASchedule.vue
@@ -122,25 +122,33 @@
@@ -175,38 +183,26 @@ const gameStore = useGameStore();
const router = useRouter();
const urlsData = ref([]);
-const shouldShowLiveArea = (game) => {
- // 1. 已结束的比赛不显示
- if (game.status === 3) return false;
-
- // 2. 获取今天的日期(北京时间)
- const today = new Date();
- const todayStr = `${today.getFullYear()}-${(today.getMonth() + 1)
- .toString()
- .padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`;
-
- // 3. 直接比较 startDate(已经是北京时间)
- return game.startDate === todayStr;
-};
-
onMounted(async () => {
try {
const response = await urls();
urlsData.value = response || [];
- // console.log("获取的直播URL数据:", urlsData.value); // 检查数据是否正确
} catch (err) {
console.error("获取直播URL失败:", err);
urlsData.value = [];
}
});
-// 判断是否为当天进行中的比赛
-const isLiveGame = (game) => {
- const isLive = game.status === 2; // 假设2表示进行中
- const gameDate = new Date(game.dateTimeUtc);
+// 判断是否为当天比赛(无论状态如何)
+const isTodayGame = (game) => {
+ // 获取今天的日期(北京时间)
const today = new Date();
- const isToday = gameDate.toDateString() === today.toDateString();
- return isLive && isToday;
+ const todayStr = `${today.getFullYear()}-${(today.getMonth() + 1)
+ .toString()
+ .padStart(2, "0")}-${today.getDate().toString().padStart(2, "0")}`;
+
+ // 直接比较 startDate(已经是北京时间)
+ return game.startDate === todayStr;
};
// 检查比赛是否有直播流
@@ -239,7 +235,6 @@ const getStreamName = (type) => {
nba: "高清原声",
mg: "咪咕体育",
zb: "高清直播",
- // 可以添加更多类型
};
return names[type] || type;
};
@@ -299,7 +294,6 @@ const props = defineProps({
const emit = defineEmits(["dateChange"]);
-// 当前显示日期
// 当前显示日期(带星期几)
const currentDisplayDate = computed(() => {
if (!props.scheduleData?.data?.start) return "加载中...";
@@ -370,7 +364,7 @@ const isWinner = (game, teamType) => {
if (game.status !== 3) return false;
// 比较比分
- if (teamType === 'away') {
+ if (teamType === "away") {
return game.awayTeamScore > game.homeTeamScore;
} else {
return game.homeTeamScore > game.awayTeamScore;
@@ -754,11 +748,11 @@ const isWinner = (game, teamType) => {
/* 如果希望更明显的效果,可以调整样式 */
.team.winner .team-name {
font-weight: bold;
- color: #2E7D32; /* 深绿色文字 */
+ color: #2e7d32; /* 深绿色文字 */
}
.team.winner .team-score {
font-weight: bold;
- color: #2E7D32; /* 深绿色比分 */
+ color: #2e7d32; /* 深绿色比分 */
}