lrj
2 天以前 c61d4fe27c97d2ecc907756aa571a4ef14a7b9b6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<template>
  <div class="rating-container">
    <div v-if="loading" class="loading">
      <el-skeleton :rows="8" animated />
    </div>
    
    <div v-else-if="detail" class="rating-content">
      <!-- 左侧面板:学员信息和参赛信息 -->
      <div class="left-panel">
        <!-- 学员信息卡片 -->
        <PlayerInfoCard :player-info="detail.playerInfo" />
        
        <!-- 参赛信息卡片 -->
        <div class="submission-card">
          <h3>参赛信息</h3>
          <div class="info-item">
            <label>比赛名称:</label>
            <span>{{ detail.activityName }}</span>
          </div>
          <div class="info-item">
            <label>项目简介:</label>
            <p>{{ detail.description || '暂无简介' }}</p>
          </div>
          
          <!-- 提交资料 -->
          <SubmissionFiles :files="detail.submissionFiles" />
        </div>
      </div>
      
      <!-- 右侧面板:评分表单 -->
      <div class="right-panel">
        <RatingForm 
          v-if="detail.ratingForm"
          :rating-form="detail.ratingForm"
          :activity-player-id="detail.id"
          @submit="handleRatingSubmit"
        />
        <div v-else class="no-rating">
          <el-empty description="该比赛未配置评分模板" />
        </div>
      </div>
    </div>
    
    <div v-else class="error">
      <el-empty description="未找到报名信息" />
    </div>
  </div>
</template>
 
<script setup>
import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage, ElSkeleton, ElEmpty } from 'element-plus'
import { getActivityPlayerDetail, saveActivityPlayerRating } from '@/api/activityPlayer'
import PlayerInfoCard from '@/components/PlayerInfoCard.vue'
import SubmissionFiles from '@/components/SubmissionFiles.vue'
import RatingForm from '@/components/RatingForm.vue'
 
const route = useRoute()
const loading = ref(true)
const detail = ref(null)
 
const loadDetail = async () => {
  try {
    loading.value = true
    const id = route.params.id
    const response = await getActivityPlayerDetail(id)
    detail.value = response.activityPlayerDetail
  } catch (error) {
    console.error('加载报名详情失败:', error)
    ElMessage.error('加载报名详情失败')
  } finally {
    loading.value = false
  }
}
 
const handleRatingSubmit = async (ratingData) => {
  try {
    console.log('评分提交:', ratingData)
    
    // 构造提交数据
    const input = {
      activityPlayerId: detail.value.id,
      ratings: ratingData.ratings.map(item => ({
        itemId: item.itemId,
        score: item.score
      })),
      comment: ratingData.comment || ''
    }
    
    // 调用保存 API
    const result = await saveActivityPlayerRating(input)
    
    if (result.saveActivityPlayerRating) {
      ElMessage.success('评分提交成功')
    } else {
      ElMessage.error('评分提交失败')
    }
  } catch (error) {
    console.error('评分提交失败:', error)
    ElMessage.error('评分提交失败: ' + error.message)
  }
}
 
onMounted(() => {
  loadDetail()
})
</script>
 
<style scoped>
.rating-container {
  padding: 20px;
  min-height: calc(100vh - 120px);
}
 
.loading {
  padding: 20px;
}
 
.rating-content {
  display: flex;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
}
 
.left-panel {
  flex: 1;
  max-width: 600px;
}
 
.right-panel {
  flex: 1;
  max-width: 600px;
}
 
.submission-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-top: 20px;
}
 
.submission-card h3 {
  margin: 0 0 16px 0;
  color: #303133;
  font-size: 18px;
  font-weight: 600;
}
 
.info-item {
  margin-bottom: 12px;
}
 
.info-item label {
  font-weight: 600;
  color: #606266;
  margin-right: 8px;
}
 
.info-item p {
  margin: 4px 0 0 0;
  color: #303133;
  line-height: 1.6;
}
 
.no-rating {
  background: white;
  border-radius: 8px;
  padding: 40px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
}
 
.error {
  text-align: center;
  padding: 40px;
}
 
@media (max-width: 1200px) {
  .rating-content {
    flex-direction: column;
  }
  
  .left-panel,
  .right-panel {
    max-width: none;
  }
}
</style>