完成評審評分機制

This commit is contained in:
2025-09-18 18:34:31 +08:00
parent 2101767690
commit ffa1e45f63
54 changed files with 5730 additions and 709 deletions

View File

@@ -0,0 +1,112 @@
'use client'
import { useState, useEffect } from 'react'
import { CompetitionProvider } from '@/contexts/competition-context'
export default function TestManualScoringPage() {
const [competition, setCompetition] = useState<any>(null)
const [teams, setTeams] = useState<any[]>([])
const [loading, setLoading] = useState(true)
useEffect(() => {
loadCompetitionData()
}, [])
const loadCompetitionData = async () => {
try {
console.log('🔍 開始載入競賽數據...')
// 載入競賽信息
const competitionResponse = await fetch('/api/competitions/be4b0a71-91f1-11f0-bb38-4adff2d0e33e')
const competitionData = await competitionResponse.json()
if (competitionData.success) {
setCompetition(competitionData.data.competition)
console.log('✅ 競賽載入成功:', competitionData.data.competition.name)
}
// 載入團隊數據
const teamsResponse = await fetch('/api/competitions/be4b0a71-91f1-11f0-bb38-4adff2d0e33e/teams')
const teamsData = await teamsResponse.json()
if (teamsData.success) {
setTeams(teamsData.data.teams)
console.log('✅ 團隊載入成功:', teamsData.data.teams.length, '個團隊')
teamsData.data.teams.forEach((team: any) => {
console.log(` - ${team.name}: ${team.apps?.length || 0} 個APP`)
if (team.apps && team.apps.length > 0) {
team.apps.forEach((app: any) => {
console.log(` * ${app.name} (${app.id})`)
})
}
})
}
} catch (error) {
console.error('❌ 載入數據失敗:', error)
} finally {
setLoading(false)
}
}
if (loading) {
return <div className="p-8">...</div>
}
return (
<CompetitionProvider>
<div className="p-8">
<h1 className="text-2xl font-bold mb-4"></h1>
<div className="mb-6">
<h2 className="text-lg font-semibold mb-2"></h2>
{competition ? (
<div className="bg-gray-100 p-4 rounded">
<p><strong>:</strong> {competition.name}</p>
<p><strong>:</strong> {competition.type}</p>
<p><strong>:</strong> {competition.status}</p>
</div>
) : (
<p className="text-red-500"></p>
)}
</div>
<div className="mb-6">
<h2 className="text-lg font-semibold mb-2"></h2>
{teams.length > 0 ? (
<div className="space-y-4">
{teams.map((team) => (
<div key={team.id} className="bg-gray-100 p-4 rounded">
<h3 className="font-semibold">{team.name}</h3>
<p><strong>ID:</strong> {team.id}</p>
<p><strong>APP數量:</strong> {team.apps?.length || 0}</p>
{team.apps && team.apps.length > 0 && (
<div className="mt-2">
<h4 className="font-medium">APP列表:</h4>
<ul className="ml-4">
{team.apps.map((app: any) => (
<li key={app.id} className="text-sm">
{app.name} ({app.id})
</li>
))}
</ul>
</div>
)}
</div>
))}
</div>
) : (
<p className="text-red-500"></p>
)}
</div>
<div className="mb-6">
<h2 className="text-lg font-semibold mb-2"></h2>
<p className="text-gray-600">
</p>
</div>
</div>
</CompetitionProvider>
)
}