diff --git a/frontend/package.json b/frontend/package.json new file mode 100644 index 0000000..9079551 --- /dev/null +++ b/frontend/package.json @@ -0,0 +1,35 @@ +{ + "name": "formula1", + "version": "0.0.0", + "private": true, + "type": "module", + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "scripts": { + "dev": "vite --host=0.0.0.0", + "build": "run-p type-check \"build-only {@}\" --", + "preview": "vite preview", + "build-only": "vite build", + "type-check": "vue-tsc --build" + }, + "dependencies": { + "@element-plus/icons-vue": "^2.3.2", + "element-plus": "^2.11.7", + "pinia": "^3.0.4", + "vue": "^3.5.22", + "vue-router": "^4.6.3" + }, + "devDependencies": { + "@tsconfig/node22": "^22.0.2", + "@types/node": "^22.18.11", + "@vitejs/plugin-vue": "^6.0.1", + "@vue/tsconfig": "^0.8.1", + "npm-run-all2": "^8.0.4", + "sass-embedded": "^1.93.3", + "typescript": "~5.9.0", + "vite": "^7.1.11", + "vite-plugin-vue-devtools": "^8.0.3", + "vue-tsc": "^3.1.1" + } +} diff --git a/frontend/public/favicon.ico b/frontend/public/favicon.ico new file mode 100755 index 0000000..df36fcf Binary files /dev/null and b/frontend/public/favicon.ico differ diff --git a/frontend/src/App.vue b/frontend/src/App.vue index a4240f5..3e49896 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -115,12 +115,23 @@ const hideHeader = computed(() => route.name === 'login' || route.name === 'regi .main { margin-top: 90px; padding: 0; + height: calc(100vh - 90px); + overflow-y: auto; + position: relative; +} + +.main::before { + content: ""; + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; background-image: url('@/assets/far.jpg'); background-size: cover; - height: calc(100vh - 90px); - &>*{ - backdrop-filter: blur(10px); - } + filter: blur(10px); + transform: scale(1.1); + z-index: -1; } .main-no-header { diff --git a/frontend/src/store/Team.ts b/frontend/src/store/Team.ts new file mode 100644 index 0000000..6feca44 --- /dev/null +++ b/frontend/src/store/Team.ts @@ -0,0 +1,46 @@ +import { defineStore } from 'pinia' +import { ref } from 'vue' + +export const useTeamsStore = defineStore('teams', () => { + const teamsList = ref([]) + const hasFetched = ref(false) + const isLoading = ref(false) + + const fetchTeams = async (forceRefresh = false) => { + if (hasFetched.value && !forceRefresh) { + return teamsList.value + } + + isLoading.value = true + try { + const response = await fetch('/api/teams') + const data = await response.json() + + teamsList.value = Array.isArray(data) ? data : (data?.data ?? []) + + hasFetched.value = true // 标记为已获取 + return teamsList.value + } catch (error) { + console.error('获取teams失败:', error) + throw error + } finally { + isLoading.value = false + } + } + + const ensureTeamsLoaded = async () => { + if (!hasFetched.value) { + await fetchTeams() + } + } + + fetchTeams(true).catch(() => {}) + + return { + teamsList, + isLoading, + hasFetched, + fetchTeams, + ensureTeamsLoaded + } +}) diff --git a/frontend/src/views/DriverDetail.vue b/frontend/src/views/DriverDetail.vue index 3d72a9b..7800b6e 100755 --- a/frontend/src/views/DriverDetail.vue +++ b/frontend/src/views/DriverDetail.vue @@ -191,6 +191,14 @@ const goBack = () => {