feat(task-review): 批量/单个AI评分交互完善

- 批量AI评分:发起后工具栏按钮进入'正在评分...'禁用态,完成后按钮与
  已完成学生的AI评分旁显示小绿点,弹窗展示成功/失败进度
- AI助评:按钮进入'正在评分...'加载态,完成后右侧AI评分徽标刷新并
  可点击浮窗查看评分详情(综合评分/逐项评分/优先改进,与学生端一致)
dev-QQq
chenyuan 1 month ago
parent f520d0e218
commit f3ec905211

@ -22,16 +22,19 @@
<div class="task-review__list-head">
<span>学生列表({{ review.students.length }})</span>
<div class="task-review__list-actions">
<el-button type="default" size="small" :disabled="!canBatchScore" @click="onBatchAiScore">批量AI评分</el-button>
<el-button type="primary" size="small" :disabled="!canBatchScore" @click="batchDialogVisible = true">批量打分</el-button>
<el-button type="default" size="small" :disabled="!canBatchScore || batchAiScoring" :loading="batchAiScoring" @click="onBatchAiScore">{{ batchAiScoring ? "正在评分..." : "批量AI评分" }}<span v-if="batchAiCompleted && !batchAiScoring" class="task-review__ai-dot" title="AI评分完成"></span></el-button>
<el-button type="primary" size="small" :disabled="!canBatchScore || batchAiScoring" @click="batchDialogVisible = true">批量打分</el-button>
</div>
</div>
<el-table ref="studentTableRef" class="task-review__student-table" :data="paginatedStudents" border size="small" row-key="studentUserId" highlight-current-row :row-class-name="studentRowClass" @selection-change="onSelectionChange" @row-click="selectStudent">
<el-table-column type="selection" width="42" :selectable="canSelectStudent" />
<el-table-column prop="name" label="姓名" width="86" show-overflow-tooltip />
<el-table-column prop="username" label="学号" width="102" show-overflow-tooltip />
<el-table-column label="AI评分" width="78" align="center">
<template #default="{ row }">{{ formatScore(row.aiAssessmentScore) }}</template>
<el-table-column label="AI评分" width="86" align="center">
<template #default="{ row }">
<span>{{ formatScore(row.aiAssessmentScore) }}</span>
<span v-if="batchAiScoredIds.has(row.studentUserId)" class="task-review__ai-dot" title="AI评分完成"></span>
</template>
</el-table-column>
<el-table-column label="老师评分" min-width="118" align="center">
<template #default="{ row }">
@ -60,9 +63,10 @@
<el-icon><DocumentCopy /></el-icon>
查看参考答案
</button>
<button type="button" class="task-review__action-btn task-review__action-btn--primary" @click="onAiAssistEvaluation">
<el-icon><CirclePlus /></el-icon>
AI助评
<button type="button" class="task-review__action-btn task-review__action-btn--primary" :disabled="aiAssistEvaluating" @click="onAiAssistEvaluation">
<el-icon v-if="aiAssistEvaluating" class="is-loading"><Loading /></el-icon>
<el-icon v-else><CirclePlus /></el-icon>
{{ aiAssistEvaluating ? "正在评分..." : "AI助评" }}
</button>
</div>
</header>
@ -380,6 +384,8 @@ const aiScoreDetailData = ref({
});
const batchAiScoreDialogVisible = ref(false);
const batchAiScoring = ref(false);
const batchAiCompleted = ref(false);
const batchAiScoredIds = ref(new Set());
const batchAiScoreProgress = ref({
total: 0,
current: 0,
@ -655,6 +661,8 @@ function onViewReferenceAnswer() {
function onBatchAiScore() {
if (!selectedStudents.value || selectedStudents.value.length === 0) return;
batchAiScoreDialogVisible.value = true;
batchAiCompleted.value = false;
batchAiScoredIds.value = new Set();
batchAiScoreProgress.value = {
total: selectedStudents.value.length,
current: 0,
@ -674,6 +682,7 @@ async function startBatchAiScore() {
try {
await teacherApi.startBatchTaskAiAssessment({ classId: filters.value.classId, taskId: filters.value.taskId, studentUserIds: selectedStudents.value.map((student) => student.studentUserId) });
const pending = new Set(selectedStudents.value.map((student) => student.studentUserId));
const succeeded = new Set();
while (pending.size) {
await new Promise((resolve) => setTimeout(resolve, 1500));
for (const studentId of Array.from(pending)) {
@ -682,7 +691,7 @@ async function startBatchAiScore() {
const status = response?.data?.assessmentStatus;
if (status === "SUCCEEDED" || status === "FAILED") {
pending.delete(studentId);
if (status === "SUCCEEDED") batchAiScoreProgress.value.successCount++;
if (status === "SUCCEEDED") { batchAiScoreProgress.value.successCount++; succeeded.add(studentId); }
else batchAiScoreProgress.value.failCount++;
batchAiScoreProgress.value.current++;
}
@ -691,6 +700,8 @@ async function startBatchAiScore() {
}
batchAiScoreProgress.value.status = "completed";
batchAiScoredIds.value = succeeded;
batchAiCompleted.value = true;
ElMessage.success(`AI评分完成!成功${batchAiScoreProgress.value.successCount}名学生,失败${batchAiScoreProgress.value.failCount}名`);
// 延迟关闭对话框
@ -840,6 +851,17 @@ function applyAiDetail(data) {
font-weight: 700;
}
/* AI评分完成小绿点 */
.task-review__ai-dot {
display: inline-block;
width: 6px;
height: 6px;
margin-left: 4px;
vertical-align: middle;
background: #22c55e;
border-radius: 50%;
}
/* ===== 学生表格(纯白 + 灰线)===== */
.task-review__student-table {
width: 100%;

Loading…
Cancel
Save