From 4fa9591629721797386fc11836e3a9deb69cd58c Mon Sep 17 00:00:00 2001
From: lrj <owen.stl@gmail.com>
Date: 星期三, 24 九月 2025 17:00:37 +0800
Subject: [PATCH] 修改评分逻辑,支持多个评委

---
 web/src/components/RatingForm.vue |  170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 162 insertions(+), 8 deletions(-)

diff --git a/web/src/components/RatingForm.vue b/web/src/components/RatingForm.vue
index 4437203..bc3e575 100644
--- a/web/src/components/RatingForm.vue
+++ b/web/src/components/RatingForm.vue
@@ -2,8 +2,52 @@
   <div class="rating-form">
     <div class="form-header">
       <h3>{{ ratingForm.schemeName || '璇勫垎琛ㄥ崟' }}</h3>
-      <div class="total-score">
-        鎬诲垎锛歿{ totalScore }} / {{ ratingForm.totalMaxScore }}
+      <div class="header-info">
+        <div class="judge-info">
+          <el-tag type="primary" size="large">
+            <el-icon><User /></el-icon>
+            褰撳墠璇勫锛歿{ currentJudgeName || '鏈煡璇勫' }}
+          </el-tag>
+        </div>
+        <div class="total-score">
+          鎬诲垎锛歿{ totalScore }} / {{ ratingForm.totalMaxScore }}
+        </div>
+      </div>
+    </div>
+    
+    <!-- 澶氳瘎濮旇瘎鍒嗙姸鎬� -->
+    <div v-if="judgeRatings && judgeRatings.length > 0" class="judge-ratings-status">
+      <h4>璇勫璇勫垎鐘舵��</h4>
+      <div class="judge-status-list">
+        <div 
+          v-for="judgeRating in judgeRatings" 
+          :key="judgeRating.judgeId"
+          class="judge-status-item"
+          :class="{ 'current-judge': judgeRating.isCurrentJudge }"
+        >
+          <div class="judge-name">
+            <el-icon v-if="judgeRating.isCurrentJudge"><Star /></el-icon>
+            {{ judgeRating.judgeName }}
+          </div>
+          <div class="judge-score">
+            <el-tag 
+              :type="judgeRating.status === 1 ? 'success' : 'info'"
+              size="small"
+            >
+              {{ judgeRating.status === 1 ? `宸茶瘎鍒�: ${judgeRating.totalScore}鍒哷 : '鏈瘎鍒�' }}
+            </el-tag>
+          </div>
+        </div>
+      </div>
+      
+      <!-- 骞冲潎鍒嗘樉绀� -->
+      <div v-if="averageScore !== null" class="average-score">
+        <el-statistic 
+          title="褰撳墠骞冲潎鍒�" 
+          :value="averageScore" 
+          :precision="2"
+          suffix="鍒�"
+        />
       </div>
     </div>
     
@@ -82,7 +126,8 @@
 
 <script setup>
 import { ref, reactive, computed, watch } from 'vue'
-import { ElForm, ElFormItem, ElInputNumber, ElInput, ElButton, ElMessage } from 'element-plus'
+import { ElForm, ElFormItem, ElInputNumber, ElInput, ElButton, ElMessage, ElTag, ElIcon, ElStatistic } from 'element-plus'
+import { User, Star } from '@element-plus/icons-vue'
 
 const props = defineProps({
   ratingForm: {
@@ -92,6 +137,26 @@
   activityPlayerId: {
     type: [String, Number],
     required: true
+  },
+  // 鏂板锛氬綋鍓嶈瘎濮斾俊鎭�
+  currentJudgeName: {
+    type: String,
+    default: ''
+  },
+  // 鏂板锛氭墍鏈夎瘎濮旇瘎鍒嗙姸鎬�
+  judgeRatings: {
+    type: Array,
+    default: () => []
+  },
+  // 鏂板锛氬钩鍧囧垎
+  averageScore: {
+    type: Number,
+    default: null
+  },
+  // 鏂板锛氬綋鍓嶈瘎濮旂殑宸叉湁璇勫垎
+  existingRating: {
+    type: Object,
+    default: null
   }
 })
 
@@ -110,8 +175,19 @@
 const initScores = () => {
   if (props.ratingForm.items) {
     props.ratingForm.items.forEach(item => {
-      formData.scores[item.id] = null
+      // 濡傛灉鏈夊凡鏈夎瘎鍒嗭紝鍒欏姞杞藉凡鏈夊垎鏁�
+      if (props.existingRating && props.existingRating.items) {
+        const existingItem = props.existingRating.items.find(ratingItem => ratingItem.ratingItemId === item.id)
+        formData.scores[item.id] = existingItem ? existingItem.score : null
+      } else {
+        formData.scores[item.id] = null
+      }
     })
+  }
+  
+  // 鍔犺浇宸叉湁璇勮
+  if (props.existingRating && props.existingRating.remark) {
+    formData.comment = props.existingRating.remark
   }
 }
 
@@ -185,6 +261,11 @@
 watch(() => props.ratingForm, () => {
   initScores()
 }, { immediate: true })
+
+// 鐩戝惉宸叉湁璇勫垎鍙樺寲锛岄噸鏂板垵濮嬪寲
+watch(() => props.existingRating, () => {
+  initScores()
+}, { immediate: true })
 </script>
 
 <style scoped>
@@ -196,19 +277,29 @@
 }
 
 .form-header {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
   margin-bottom: 20px;
   padding-bottom: 16px;
   border-bottom: 1px solid #EBEEF5;
 }
 
 .form-header h3 {
-  margin: 0;
+  margin: 0 0 12px 0;
   color: #303133;
   font-size: 18px;
   font-weight: 600;
+}
+
+.header-info {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  flex-wrap: wrap;
+  gap: 12px;
+}
+
+.judge-info {
+  display: flex;
+  align-items: center;
 }
 
 .total-score {
@@ -220,6 +311,69 @@
   border-radius: 20px;
 }
 
+.judge-ratings-status {
+  margin-bottom: 24px;
+  padding: 16px;
+  background: #F8F9FA;
+  border-radius: 8px;
+  border: 1px solid #E9ECEF;
+}
+
+.judge-ratings-status h4 {
+  margin: 0 0 16px 0;
+  color: #303133;
+  font-size: 16px;
+  font-weight: 600;
+}
+
+.judge-status-list {
+  display: grid;
+  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
+  gap: 12px;
+  margin-bottom: 16px;
+}
+
+.judge-status-item {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 12px;
+  background: white;
+  border-radius: 6px;
+  border: 1px solid #E4E7ED;
+  transition: all 0.3s ease;
+}
+
+.judge-status-item:hover {
+  border-color: #409EFF;
+  box-shadow: 0 2px 4px rgba(64, 158, 255, 0.1);
+}
+
+.judge-status-item.current-judge {
+  border-color: #409EFF;
+  background: #ECF5FF;
+}
+
+.judge-name {
+  display: flex;
+  align-items: center;
+  gap: 6px;
+  font-weight: 500;
+  color: #303133;
+}
+
+.judge-score {
+  flex-shrink: 0;
+}
+
+.average-score {
+  text-align: center;
+  padding: 16px;
+  background: white;
+  border-radius: 6px;
+  border: 1px solid #E4E7ED;
+}
+
 .rating-items {
   margin-bottom: 20px;
 }

--
Gitblit v1.8.0