"use client" import { useState } from "react" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Label } from "@/components/ui/label" import { Textarea } from "@/components/ui/textarea" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog" import { CheckCircle, Edit, Loader2 } from "lucide-react" export default function ScoringFormTestPage() { const [showScoringForm, setShowScoringForm] = useState(false) const [manualScoring, setManualScoring] = useState({ judgeId: "judge1", participantId: "app1", scores: { "創新性": 0, "技術性": 0, "實用性": 0, "展示效果": 0, "影響力": 0 }, comments: "" }) const [isLoading, setIsLoading] = useState(false) const scoringRules = [ { name: "創新性", description: "技術創新程度和獨特性", weight: 25 }, { name: "技術性", description: "技術實現的複雜度和穩定性", weight: 20 }, { name: "實用性", description: "實際應用價值和用戶體驗", weight: 25 }, { name: "展示效果", description: "演示效果和表達能力", weight: 15 }, { name: "影響力", description: "對行業和社會的潛在影響", weight: 15 } ] const calculateTotalScore = (scores: Record): number => { let totalScore = 0 let totalWeight = 0 scoringRules.forEach(rule => { const score = scores[rule.name] || 0 const weight = rule.weight || 1 totalScore += score * weight totalWeight += weight }) return totalWeight > 0 ? Math.round(totalScore / totalWeight) : 0 } const handleSubmitScore = async () => { setIsLoading(true) // 模擬提交 setTimeout(() => { setIsLoading(false) setShowScoringForm(false) }, 2000) } return (

評分表單測試

測試完整的評分表單功能

評分表單演示 點擊按鈕查看完整的評分表單 評分表單 為參賽者進行評分,請根據各項指標進行評分
{/* 評分項目 */}

評分項目

{scoringRules.map((rule, index) => (

{rule.description}

權重:{rule.weight}%

{manualScoring.scores[rule.name] || 0} / 10
{/* 評分按鈕 */}
{Array.from({ length: 10 }, (_, i) => i + 1).map((score) => ( ))}
))}
{/* 總分顯示 */}
總分

根據權重計算的綜合評分

{calculateTotalScore(manualScoring.scores)} / 10
{/* 評審意見 */}