diff --git a/backend/competition/judge_views.py b/backend/competition/judge_views.py index 75b7537..fc248d0 100644 --- a/backend/competition/judge_views.py +++ b/backend/competition/judge_views.py @@ -432,6 +432,9 @@ def project_detail_api(request, project_id): if ai_count > 0: ai_score_avg = round(ai_total / ai_count, 2) + # 判断是否为选手查看自己的项目 + is_own_project = role == 'contestant' and project.contestant.user == user + data = { 'id': project.id, 'title': project.title, @@ -443,19 +446,20 @@ def project_detail_api(request, project_id): 'ai_result': ai_data, 'audio_url': audio_url, 'can_grade': role == 'judge' or (role == 'contestant' and project.contestant.user != user), - # 评分细项(仅评委和嘉宾可见) + 'is_own_project': is_own_project, + # 评分细项(评委、嘉宾可见,选手查看自己的项目时也可见) 'score_details': { 'judge_score': judge_score_avg, 'peer_score': peer_score_avg, 'ai_score': ai_score_avg, 'final_score': final_score - } if role in ['judge', 'guest'] else None, - # 评分公式信息 + } if role in ['judge', 'guest'] or is_own_project else None, + # 评分公式信息(评委、嘉宾可见,选手查看自己的项目时也可见) 'formula_info': { 'name': project.competition.active_formula.name if project.competition.active_formula else None, 'formula': project.competition.active_formula.formula if project.competition.active_formula else None, 'preview': project.competition.active_formula.get_formula_preview() if project.competition.active_formula else None - } if project.competition.score_calculation_type == 'formula' else None + } if project.competition.score_calculation_type == 'formula' and (role in ['judge', 'guest'] or is_own_project) else None } # Specifically for guest: can_grade is False diff --git a/backend/competition/templates/judge/dashboard.html b/backend/competition/templates/judge/dashboard.html index a6cbb68..d2112fb 100644 --- a/backend/competition/templates/judge/dashboard.html +++ b/backend/competition/templates/judge/dashboard.html @@ -177,7 +177,7 @@
- 最终平均分 + 最终总分
-- @@ -701,6 +701,20 @@ async function viewProject(id) { if (!readOnlyMsg) { readOnlyMsg = document.createElement('div'); readOnlyMsg.id = 'readOnlyMsg'; + readOnlyMsg.className = 'text-center py-10 bg-white rounded-lg border border-dashed border-gray-300 mt-4'; + gradingContainer.appendChild(readOnlyMsg); + } + + if (data.is_own_project) { + readOnlyMsg.className = 'text-center py-10 bg-white rounded-lg border border-dashed border-blue-300 mt-4'; + readOnlyMsg.innerHTML = ` +
+ +
+

查看自己的项目

+

无法对自己的项目进行评分,但可以查看详细评分

+ `; + } else { readOnlyMsg.className = 'text-center py-10 bg-white rounded-lg border border-dashed border-gray-300 mt-4'; readOnlyMsg.innerHTML = `
@@ -709,7 +723,6 @@ async function viewProject(id) {

仅浏览模式

当前身份无法进行评分

`; - gradingContainer.appendChild(readOnlyMsg); } if (data.can_grade) {