From 18dc227e405e69af5c5d1814c93c72d3651f72a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B3=E4=BD=A9=E5=BA=AD?= Date: Sun, 12 Oct 2025 03:54:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=88=97=E5=8D=B0=E9=8C=AF?= =?UTF-8?q?=E8=AA=A4=E8=B3=87=E8=A8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../results/detail/[testResultId]/page.tsx | 295 +++++++++++++++--- 1 file changed, 252 insertions(+), 43 deletions(-) diff --git a/app/admin/results/detail/[testResultId]/page.tsx b/app/admin/results/detail/[testResultId]/page.tsx index 72d69a6..2c0a165 100644 --- a/app/admin/results/detail/[testResultId]/page.tsx +++ b/app/admin/results/detail/[testResultId]/page.tsx @@ -398,7 +398,7 @@ function AdminResultDetailContent() { if (printWindow) { // 獲取當前頁面的數據 const userInfo = ` -
+

@@ -419,7 +419,7 @@ function AdminResultDetailContent() { ` const testResult = ` -
+
${result.score}
@@ -432,8 +432,81 @@ function AdminResultDetailContent() { let logicTest = '' let creativeTest = '' + let recommendations = ['繼續保持現有的學習節奏,持續提升各方面能力'] // 默認建議 if (result.type === 'combined' && result.details) { + // 調試:輸出數據結構 + console.log('Print Data Debug:', { + details: result.details, + result: result + }) + + // 從 breakdown 中獲取正確的數據 + const logicBreakdown = result.details.breakdown || {} + const creativeBreakdown = result.details.creativeBreakdown || {} + + console.log('Logic breakdown:', logicBreakdown) + console.log('Creative breakdown:', creativeBreakdown) + + // 使用與網頁相同的計算方式 + const logicQuestions = questions.filter(q => q.type === 'logic') + const creativeQuestions = questions.filter(q => q.type === 'creative') + + // 邏輯測驗:計算正確答案數 + const logicCorrectAnswers = logicQuestions.filter(q => q.isCorrect).length + const logicTotalQuestions = logicQuestions.length + + // 創意測驗:計算實際分數 + const creativeScore = creativeQuestions.reduce((sum, q) => sum + (q.score || 0), 0) + const creativeMaxScore = creativeQuestions.length * 5 // 每題5分 + + console.log('Extracted values:', { + logicCorrectAnswers, + logicTotalQuestions, + creativeScore, + creativeMaxScore + }) + + const logicLevelData = getScoreLevel(result.details.logicScore || 0, 'logic') + const creativeLevelData = getScoreLevel(result.details.creativeScore || 0, 'creative') + + // 生成發展建議(與 CombinedAnalysis 組件相同的邏輯) + const generateRecommendations = () => { + const recommendations = [] + const logicScore = result.details.logicScore || 0 + const creativityScore = result.details.creativeScore || 0 + + if (logicScore < 70) { + recommendations.push("建議加強邏輯思維訓練,多做推理題和數學題") + recommendations.push("學習系統性思維方法,如思維導圖、流程圖等") + } + + if (creativityScore < 70) { + recommendations.push("建議參與更多創意活動,如頭腦風暴、設計思維工作坊") + recommendations.push("培養好奇心,多接觸不同領域的知識和經驗") + } + + const scoreDiff = Math.abs(logicScore - creativityScore) + if (scoreDiff > 20) { + if (logicScore > creativityScore) { + recommendations.push("您的邏輯思維較強,建議平衡發展創意能力") + } else { + recommendations.push("您的創意能力較強,建議平衡發展邏輯思維") + } + } + + if (logicScore >= 80 && creativityScore >= 80) { + recommendations.push("您具備優秀的綜合能力,建議承擔更多挑戰性工作") + recommendations.push("可以考慮擔任需要創新和分析並重的領導角色") + } + + return recommendations.length > 0 ? recommendations : ["繼續保持現有的學習節奏,持續提升各方面能力"] + } + + const recommendations = generateRecommendations() + + console.log('Generated recommendations:', recommendations) + logicTest = `

@@ -442,22 +515,35 @@ function AdminResultDetailContent() { 邏輯思維測試

-
-
-
${result.details.logicScore || 0}
-
得分
+
+
得分
+
+
+
+
+ ${logicCorrectAnswers}
-
-
${result.details.logicCorrectAnswers || 0}
+
+
+
+
${logicCorrectAnswers}
答對題數
-
-
${result.details.logicTotalQuestions || 0}
+
+
${logicTotalQuestions}
總題數
-
${getScoreLevel(result.details.logicScore || 0, 'logic').level}
-
${getScoreLevel(result.details.logicScore || 0, 'logic').description}
+
+
${logicLevelData.level}
+
${logicLevelData.description}
+
+ + + + ${logicLevelData.suggestion} +
+
` @@ -469,22 +555,35 @@ function AdminResultDetailContent() { 創意能力測試

-
-
-
${result.details.creativeScore || 0}
-
得分
+
+
得分
+
+
+
+
+ ${creativeScore}
-
-
${result.details.creativeScore || 0}
+
+
+
+
${creativeScore}
原始得分
-
-
${result.details.creativeMaxScore || 0}
+
+
${creativeMaxScore}
滿分
-
${getScoreLevel(result.details.creativeScore || 0, 'creative').level}
-
${getScoreLevel(result.details.creativeScore || 0, 'creative').description}
+
+
${creativeLevelData.level}
+
${creativeLevelData.description}
+
+ + + + ${creativeLevelData.suggestion} +
+
` } @@ -536,6 +635,16 @@ function AdminResultDetailContent() { padding: 0.75rem; box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); } + .equal-height { + min-height: 12rem; + display: flex; + flex-direction: column; + } + .centered-content { + text-align: center; + justify-content: center; + align-items: center; + } .card h3 { margin: 0 0 0.5rem 0; font-size: 0.875rem; @@ -570,17 +679,20 @@ function AdminResultDetailContent() { .info-grid { display: grid; grid-template-columns: auto 1fr; - gap: 0.25rem 0.5rem; + gap: 0.5rem 1rem; margin-bottom: 0.5rem; + align-items: center; } .info-label { font-weight: 500; color: #6b7280; font-size: 0.7rem; + white-space: nowrap; } .info-value { color: #0f172a; font-size: 0.7rem; + word-break: break-all; } .score-circle { width: 2.5rem; @@ -647,6 +759,117 @@ function AdminResultDetailContent() { color: #64748b; margin-top: 0.125rem; } + .score-section { + margin-bottom: 0.75rem; + } + .score-text { + font-size: 0.65rem; + color: #6b7280; + margin-bottom: 0.25rem; + } + .progress-container { + display: flex; + align-items: center; + gap: 0.5rem; + } + .progress-bar { + flex: 1; + height: 0.375rem; + background: #e5e7eb; + border-radius: 9999px; + overflow: hidden; + position: relative; + } + .logic-progress .progress-fill { + background: #dc2626; + } + .creative-progress .progress-fill { + background: #f59e0b; + } + .progress-fill { + height: 100%; + border-radius: 9999px; + transition: width 0.3s ease; + } + .score-number { + font-size: 0.75rem; + font-weight: bold; + min-width: 1.5rem; + text-align: right; + } + .logic-score { + color: #dc2626; + } + .creative-score { + color: #f59e0b; + } + .stats-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 0.5rem; + margin-bottom: 0.75rem; + } + .stat-box { + background: #f8fafc; + border-radius: 0.375rem; + padding: 0.5rem; + text-align: center; + border: 1px solid #e2e8f0; + } + .stat-box.correct .stat-number { + color: #059669; + } + .stat-box.total .stat-number { + color: #3b82f6; + } + .stat-box.raw .stat-number { + color: #059669; + } + .stat-box.max .stat-number { + color: #3b82f6; + } + .level-section { + margin-bottom: 0.5rem; + } + .level-badge { + display: inline-block; + background: #f1f5f9; + color: #475569; + padding: 0.125rem 0.5rem; + border-radius: 9999px; + font-size: 0.6rem; + font-weight: 500; + margin-bottom: 0.5rem; + } + .logic-badge { + background: #fef2f2; + color: #dc2626; + } + .creative-badge { + background: #fef3c7; + color: #f59e0b; + } + .description { + color: #4b5563; + font-size: 0.65rem; + margin-bottom: 0.5rem; + line-height: 1.4; + } + .suggestion { + display: flex; + align-items: flex-start; + gap: 0.25rem; + color: #374151; + font-size: 0.65rem; + line-height: 1.4; + } + .suggestion-icon { + width: 0.75rem; + height: 0.75rem; + color: #6b7280; + flex-shrink: 0; + margin-top: 0.125rem; + } .ability-grid { display: grid; grid-template-columns: repeat(3, 1fr); @@ -872,26 +1095,12 @@ function AdminResultDetailContent() { 發展建議 -
-
1
-
建議加強邏輯思維訓練,多做推理題和數學題
-
-
-
2
-
學習系統性思維方法,如思維導圖、流程圖等
-
-
-
3
-
建議參與更多創意活動,如頭腦風暴、設計思維工作坊
-
-
-
4
-
培養好奇心,多接觸不同領域的知識和經驗
-
-
-
5
-
您的創意能力較強,建議平衡發展邏輯思維
-
+ ${recommendations.map((recommendation, index) => ` +
+
${index + 1}
+
${recommendation}
+
+ `).join('')}
` : ''}