fix: 移除所有硬编码的localhost:8080,使用相对路径

- 创建utils/config.ts集中管理API_BASE和文件URL
- 删除.env文件(VITE_SERVER_API_URL=http://localhost:8080)
- env.ts默认API前缀改为/api/v1匹配后端路由
- 替换16处硬编码的localhost:8080引用
This commit is contained in:
2026-05-03 19:48:07 +08:00
parent 6d5d1922f5
commit fbc2e5ac91
17 changed files with 32 additions and 37 deletions
@@ -3,6 +3,8 @@ import { ref } from 'vue'
import type { Team } from './types'
import { getFileUrl } from '@/utils/config'
const { teams } = defineProps<{
teams: Team[]
}>()
@@ -10,11 +12,7 @@ const { teams } = defineProps<{
const activeTeam = ref<Team>(teams[0])
function getAssetUrl(path: string) {
if (!path)
return ''
if (path.startsWith('http'))
return path
return `${import.meta.env.VITE_API_BASE || 'http://localhost:8080'}${path}`
return getFileUrl(path)
}
</script>