fix: production deployment improvements and configuration fixes
## 主要改动 ### 1. 修复二维码地址硬编码问题 - 将 MainDisplay.vue 中硬编码的移动端 URL 改为环境变量配置 - 添加 VITE_MOBILE_URL 环境变量支持 - 支持通过 .env 文件动态配置移动端地址 ### 2. 修复音频文件路径问题 - 修正 display.ts 中音频文件路径,添加 /screen 前缀 - 修复 BGM、抽奖音效、胜利音效的加载路径 ### 3. 修复 Docker 构建问题 - 添加中国 npm 镜像配置,解决构建超时问题 - 修复缺失的 tsconfig.base.json 文件拷贝 - 修复 Redis 环境变量配置(REDIS_HOST/REDIS_PORT) - 添加 Lua 脚本文件拷贝到生产容器 ### 4. 修复前端路由和资源加载 - 添加 Vite base path 配置 (/screen/) - 修复 Vue Router base path 配置 - 修正 Caddyfile 路由顺序,确保 /screen 路径优先匹配 ### 5. 修复 TypeScript 编译错误 - LuckyDrawView.vue: 添加 round 属性类型定义 - ProgramCard.vue: 添加非空断言处理 ### 6. 修复 SCSS 变量问题 - 替换未定义的 SCSS 变量为硬编码颜色值 - 修复 VoteView、ConnectionStatus、HomeView、ScanLoginView 中的样式问题 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
VITE_SOCKET_URL=
|
||||
VITE_API_URL=
|
||||
VITE_MOBILE_URL=
|
||||
|
||||
@@ -22,7 +22,7 @@ function generateToken(code: string): string {
|
||||
export { ADMIN_TOKEN_KEY, ADMIN_ACCESS_CODE, generateToken };
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
history: createWebHistory('/screen/'),
|
||||
routes: [
|
||||
// ============================================
|
||||
// Big Screen Display Routes (LED PC)
|
||||
|
||||
@@ -19,9 +19,9 @@ let audioPlayer: HTMLAudioElement | null = null;
|
||||
|
||||
// Audio file paths - place audio files in public/audio/
|
||||
const AUDIO_TRACKS: Record<string, string> = {
|
||||
bgm: '/audio/bgm.mp3',
|
||||
lottery: '/audio/lottery.mp3',
|
||||
fanfare: '/audio/fanfare.mp3',
|
||||
bgm: '/screen/audio/bgm.mp3',
|
||||
lottery: '/screen/audio/lottery.mp3',
|
||||
fanfare: '/screen/audio/fanfare.mp3',
|
||||
};
|
||||
|
||||
export const useDisplayStore = defineStore('display', () => {
|
||||
|
||||
@@ -25,7 +25,7 @@ const participantCount = ref(0);
|
||||
let previousSubPhase: string | null = null;
|
||||
|
||||
// Prize configuration - 从服务器加载
|
||||
const prizes = ref<Array<{ level: string; name: string; winnerCount: number; poolTag?: string }>>([]);
|
||||
const prizes = ref<Array<{ level: string; name: string; winnerCount: number; poolTag?: string; round?: number }>>([]);
|
||||
|
||||
// 从 API 获取奖项配置
|
||||
async function fetchPrizes() {
|
||||
|
||||
@@ -10,8 +10,8 @@ const displayStore = useDisplayStore();
|
||||
// QR Code Login (legacy - kept for direct access)
|
||||
const showQRLogin = ref(false);
|
||||
|
||||
// Mobile URL for entry QR code
|
||||
const mobileUrl = 'http://192.168.1.5:5174';
|
||||
// Mobile URL for entry QR code - use environment variable or fallback to current origin
|
||||
const mobileUrl = import.meta.env.VITE_MOBILE_URL || window.location.origin;
|
||||
|
||||
function handleLoginSuccess(data: { userId: string; userName: string; department: string; sessionToken: string }) {
|
||||
console.log('Login success:', data);
|
||||
|
||||
@@ -3,6 +3,7 @@ import vue from '@vitejs/plugin-vue';
|
||||
import { resolve } from 'path';
|
||||
|
||||
export default defineConfig({
|
||||
base: '/screen/',
|
||||
plugins: [vue()],
|
||||
resolve: {
|
||||
alias: {
|
||||
|
||||
Reference in New Issue
Block a user