新增 logo、優化 AI 問答
This commit is contained in:
@@ -133,14 +133,20 @@ export function CompetitionProvider({ children }: { children: ReactNode }) {
|
||||
const competitionsData = await competitionsResponse.json()
|
||||
console.log('📋 競賽API回應:', competitionsData)
|
||||
|
||||
if (competitionsData.success && competitionsData.data) {
|
||||
// 確保每個競賽都有judges屬性
|
||||
const competitionsWithJudges = competitionsData.data.map((comp: any) => ({
|
||||
...comp,
|
||||
judges: comp.judges || []
|
||||
}))
|
||||
setCompetitions(competitionsWithJudges)
|
||||
console.log('✅ 競賽數據載入成功:', competitionsWithJudges.length, '個競賽')
|
||||
if (competitionsData.success) {
|
||||
if (competitionsData.data && competitionsData.data.length > 0) {
|
||||
// 確保每個競賽都有judges屬性
|
||||
const competitionsWithJudges = competitionsData.data.map((comp: any) => ({
|
||||
...comp,
|
||||
judges: comp.judges || []
|
||||
}))
|
||||
setCompetitions(competitionsWithJudges)
|
||||
console.log('✅ 競賽數據載入成功:', competitionsWithJudges.length, '個競賽')
|
||||
} else {
|
||||
// 沒有競賽資料是正常情況,不報錯
|
||||
setCompetitions([])
|
||||
console.log('ℹ️ 暫無競賽數據')
|
||||
}
|
||||
} else {
|
||||
console.error('❌ 競賽數據載入失敗:', competitionsData.message)
|
||||
// 設置空數組以避免undefined錯誤
|
||||
@@ -152,14 +158,20 @@ export function CompetitionProvider({ children }: { children: ReactNode }) {
|
||||
const currentData = await currentResponse.json()
|
||||
console.log('🏆 當前競賽API回應:', currentData)
|
||||
|
||||
if (currentData.success && currentData.data) {
|
||||
// 確保當前競賽也有judges屬性
|
||||
const currentCompetitionWithJudges = {
|
||||
...currentData.data,
|
||||
judges: currentData.data.judges || []
|
||||
if (currentData.success) {
|
||||
if (currentData.data) {
|
||||
// 確保當前競賽也有judges屬性
|
||||
const currentCompetitionWithJudges = {
|
||||
...currentData.data,
|
||||
judges: currentData.data.judges || []
|
||||
}
|
||||
setCurrentCompetition(currentCompetitionWithJudges)
|
||||
console.log('✅ 當前競賽載入成功:', currentCompetitionWithJudges.name)
|
||||
} else {
|
||||
// 沒有當前競賽是正常情況,不報錯
|
||||
setCurrentCompetition(null)
|
||||
console.log('ℹ️ 暫無當前競賽')
|
||||
}
|
||||
setCurrentCompetition(currentCompetitionWithJudges)
|
||||
console.log('✅ 當前競賽載入成功:', currentCompetitionWithJudges.name)
|
||||
} else {
|
||||
console.error('❌ 當前競賽載入失敗:', currentData.message)
|
||||
}
|
||||
@@ -170,9 +182,14 @@ export function CompetitionProvider({ children }: { children: ReactNode }) {
|
||||
const judgesData = await judgesResponse.json()
|
||||
console.log('評審API回應:', judgesData)
|
||||
|
||||
if (judgesData.success && judgesData.data) {
|
||||
setJudges(judgesData.data)
|
||||
console.log('✅ 評審數據載入成功:', judgesData.data.length, '個評審')
|
||||
if (judgesData.success) {
|
||||
if (judgesData.data && judgesData.data.length > 0) {
|
||||
setJudges(judgesData.data)
|
||||
console.log('✅ 評審數據載入成功:', judgesData.data.length, '個評審')
|
||||
} else {
|
||||
setJudges([])
|
||||
console.log('ℹ️ 暫無評審數據')
|
||||
}
|
||||
} else {
|
||||
console.error('❌ 評審數據載入失敗:', judgesData.message)
|
||||
setJudges([])
|
||||
|
Reference in New Issue
Block a user