From 70dd10247af81dee3cc6436231cbb4013fb97dae Mon Sep 17 00:00:00 2001 From: colden Date: Wed, 24 Dec 2025 21:45:08 +0800 Subject: [PATCH] modify team store and font --- frontend/package.json | 35 +++++++++++++++++++++ frontend/public/favicon.ico | Bin 0 -> 4286 bytes frontend/src/App.vue | 19 +++++++++--- frontend/src/store/Team.ts | 46 ++++++++++++++++++++++++++++ frontend/src/views/DriverDetail.vue | 13 ++++++++ frontend/src/views/Drivers.vue | 8 +++++ frontend/src/views/RacePage.vue | 2 +- frontend/src/views/TeamDetail.vue | 10 ++++++ frontend/src/views/Teams.vue | 9 +++--- frontend/vite.config.ts | 4 +-- 10 files changed, 135 insertions(+), 11 deletions(-) create mode 100644 frontend/package.json create mode 100755 frontend/public/favicon.ico create mode 100644 frontend/src/store/Team.ts 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 0000000000000000000000000000000000000000..df36fcfb72584e00488330b560ebcf34a41c64c2 GIT binary patch literal 4286 zcmds*O-Phc6o&64GDVCEQHxsW(p4>LW*W<827=Unuo8sGpRux(DN@jWP-e29Wl%wj zY84_aq9}^Am9-cWTD5GGEo#+5Fi2wX_P*bo+xO!)p*7B;iKlbFd(U~_d(U?#hLj56 zPhFkj-|A6~Qk#@g^#D^U0XT1cu=c-vu1+SElX9NR;kzAUV(q0|dl0|%h|dI$%VICy zJnu2^L*Te9JrJMGh%-P79CL0}dq92RGU6gI{v2~|)p}sG5x0U*z<8U;Ij*hB9z?ei z@g6Xq-pDoPl=MANPiR7%172VA%r)kevtV-_5H*QJKFmd;8yA$98zCxBZYXTNZ#QFk2(TX0;Y2dt&WitL#$96|gJY=3xX zpCoi|YNzgO3R`f@IiEeSmKrPSf#h#Qd<$%Ej^RIeeYfsxhPMOG`S`Pz8q``=511zm zAm)MX5AV^5xIWPyEu7u>qYs?pn$I4nL9J!=K=SGlKLXpE<5x+2cDTXq?brj?n6sp= zphe9;_JHf40^9~}9i08r{XM$7HB!`{Ys~TK0kx<}ZQng`UPvH*11|q7&l9?@FQz;8 zx!=3<4seY*%=OlbCbcae?5^V_}*K>Uo6ZWV8mTyE^B=DKy7-sdLYkR5Z?paTgK-zyIkKjIcpyO z{+uIt&YSa_$QnN_@t~L014dyK(fOOo+W*MIxbA6Ndgr=Y!f#Tokqv}n<7-9qfHkc3 z=>a|HWqcX8fzQCT=dqVbogRq!-S>H%yA{1w#2Pn;=e>JiEj7Hl;zdt-2f+j2%DeVD zsW0Ab)ZK@0cIW%W7z}H{&~yGhn~D;aiP4=;m-HCo`BEI+Kd6 z={Xwx{TKxD#iCLfl2vQGDitKtN>z|-AdCN|$jTFDg0m3O`WLD4_s#$S literal 0 HcmV?d00001 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 = () => {