From 85f7131efb898c8978929ef3295b1849a577385a Mon Sep 17 00:00:00 2001 From: zyh Date: Sat, 30 Aug 2025 22:28:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=9F=9F=E5=90=8D=E4=B8=BA?= =?UTF-8?q?=20uzi1.cn=EF=BC=8C=E4=BF=AE=E5=A4=8D=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E5=92=8C=E9=85=8D=E7=BD=AE=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=85=AC=E5=91=8A=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.production | 6 +- DEPLOYMENT.md | 6 +- nginx.conf | 2 +- src/api/announcement.js | 5 + src/components/play/GamePage.vue | 27 +++- src/composables/usePlayState.js | 8 +- src/composables/useQrCode.js | 2 +- src/views/Play.vue | 222 ++++++++++++++++++++++++++++++- src/views/oldplay.vue | 18 +-- 宝塔面板Nginx配置.conf | 8 +- 宝塔面板修改后的配置.conf | 2 +- 宝塔面板操作步骤.md | 6 +- 12 files changed, 277 insertions(+), 35 deletions(-) diff --git a/.env.production b/.env.production index a9aafec..ea94f09 100644 --- a/.env.production +++ b/.env.production @@ -1,7 +1,7 @@ # 生产环境API基础URL(根据实际情况选择) -VITE_API_BASE=https://2.uzi0.cc/api +VITE_API_BASE=https://uzi1.cn/api # 前端基础URL(用于生成分享链接) -VITE_BASE_URL=https://2.uzi0.cc +VITE_BASE_URL=https://uzi1.cn -IMAGE_BASE_URL=https://2.uzi0.cc/image \ No newline at end of file +IMAGE_BASE_URL=https://uzi1.cn/image \ No newline at end of file diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index a7ea763..cc2ed0b 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -2,7 +2,7 @@ ## 问题描述 -当直接访问 `http://2.uzi0.cc/play?code=973F2YTE` 时出现404错误,但其他页面正常。这是典型的单页应用(SPA)部署问题。 +当直接访问 `http://uzi1.cn/play?code=973F2YTE` 时出现404错误,但其他页面正常。这是典型的单页应用(SPA)部署问题。 ## 原因分析 @@ -49,12 +49,12 @@ npm run build # 3. 配置 Web 服务器(选择上述方案之一) # 4. 测试访问 -# http://2.uzi0.cc/play?code=973F2YTE 应该能正常访问 +# http://uzi1.cn/play?code=973F2YTE 应该能正常访问 ``` ## 验证步骤 -1. 直接访问:`http://2.uzi0.cc/play?code=973F2YTE` +1. 直接访问:`http://uzi1.cn/play?code=973F2YTE` 2. 应该能看到游戏页面,而不是404错误 3. 刷新页面应该仍然正常 4. API 请求应该正常工作(无CORS错误) diff --git a/nginx.conf b/nginx.conf index bcc81cb..e3636e4 100644 --- a/nginx.conf +++ b/nginx.conf @@ -3,7 +3,7 @@ server { listen 80; - server_name 2.uzi0.cc; + server_name uzi1.cn; root /path/to/your/dist; # 修改为你的实际部署路径 index index.html; diff --git a/src/api/announcement.js b/src/api/announcement.js index 0728445..8b89897 100644 --- a/src/api/announcement.js +++ b/src/api/announcement.js @@ -40,3 +40,8 @@ export function updateAnnouncementStatus(id, enabled) { export function getEnabledAnnouncements(params) { return http.get('/api/admin/announcement/enabled', { params }) } + +// 根据代码获取公告 +export function getAnnouncementByCode(codeNo) { + return http.get(`/api/admin/announcement/by-code/${codeNo}`) +} diff --git a/src/components/play/GamePage.vue b/src/components/play/GamePage.vue index 53b1069..4e34554 100644 --- a/src/components/play/GamePage.vue +++ b/src/components/play/GamePage.vue @@ -21,19 +21,19 @@ @@ -89,6 +89,25 @@ export default { currentPoints: { type: Number, default: 0 + }, + codeNo: { + type: String, + default: null + } + }, + data() { + return { + timestamp: Date.now() + } + }, + mounted() { + this.setupImageRefresh() + }, + methods: { + setupImageRefresh() { + setInterval(() => { + this.timestamp = Date.now() + }, 5000) } } } diff --git a/src/composables/usePlayState.js b/src/composables/usePlayState.js index 93fbe05..f0af8ce 100644 --- a/src/composables/usePlayState.js +++ b/src/composables/usePlayState.js @@ -80,7 +80,7 @@ export function usePlayState() { state.status = 'LOGGED_IN' state.assets = { - qrCodeUrl: gameData.mecmachineId ? `https://2.uzi0.cc/image/${gameData.mecmachineId}/二维码.png?t=${new Date().getTime()}` : null, + qrCodeUrl: gameData.mecmachineId ? `https://uzi1.cn/image/${gameData.mecmachineId}/二维码.png?t=${new Date().getTime()}` : null, ...(gameData.assets || {}) } @@ -159,7 +159,7 @@ export function usePlayState() { } state.assets = { - qrCodeUrl: gameData.mecmachineId ? `https://2.uzi0.cc/image/${gameData.mecmachineId}/二维码.png?t=${Date.now()}` : null + qrCodeUrl: gameData.mecmachineId ? `https://uzi1.cn/image/${gameData.mecmachineId}/二维码.png?t=${Date.now()}` : null } state.totalPoints = gameData.totalPoints || 50 @@ -230,7 +230,7 @@ export function usePlayState() { } if (data.mecmachineId) { - const qrUrl = `https://2.uzi0.cc/image/${data.mecmachineId}/二维码.png?t=${Date.now()}` + const qrUrl = `https://uzi1.cn/image/${data.mecmachineId}/二维码.png?t=${Date.now()}` state.qrInfo = { url: qrUrl, createdAt: data.qrCreatedAt, @@ -385,7 +385,7 @@ export function usePlayState() { if (!state.machineId) return null const progress = getProgressPercent() - const baseUrl = 'https://2.uzi0.cc/image' + const baseUrl = 'https://uzi1.cn/image' if (progress === 0) { return `${baseUrl}/${state.machineId}/首次主页.png` diff --git a/src/composables/useQrCode.js b/src/composables/useQrCode.js index 50a0148..fa8d553 100644 --- a/src/composables/useQrCode.js +++ b/src/composables/useQrCode.js @@ -40,7 +40,7 @@ export function useQrCode() { const fetchQrCodeAfterDelay = async (state, countdown, mecmachineId, qrCreatedAt, qrExpireAt, retryCount = 0) => { try { - const qrCodeUrl = `https://2.uzi0.cc/image/${mecmachineId}/二维码.png?t=${Date.now()}` + const qrCodeUrl = `https://uzi1.cn/image/${mecmachineId}/二维码.png?t=${Date.now()}` console.log(`尝试获取二维码 (第${retryCount + 1}次):`, qrCodeUrl) const isUrlValid = await validateQrCodeUrl(qrCodeUrl) diff --git a/src/views/Play.vue b/src/views/Play.vue index 2ada9a1..345257f 100644 --- a/src/views/Play.vue +++ b/src/views/Play.vue @@ -42,6 +42,7 @@ :status-message-class="getStatusMessageClass()" :assets="state.assets" :current-points="state.currentPoints" + :code-no="state.code" /> @@ -64,15 +65,41 @@ :error-message="getErrorMessage()" @retry="handleRetry" /> + + + +
+

{{ announcement.title }}

+
{{ announcement.content }}
+
+
+ 暂无公告内容 +
+ +