You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dianshang-qianduan/src/views/teacherEnd/score/TaskReviewPanel.vue

1756 lines
56 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div class="task-review" v-loading="loading">
<aside class="task-review__sidebar">
<el-form label-position="top" class="task-review__filters">
<el-form-item label="实训项目">
<el-select v-model="filters.projectName" placeholder="请选择实训项目" clearable @change="onProjectChange">
<el-option v-for="project in review.projects" :key="project" :label="project" :value="project" />
</el-select>
</el-form-item>
<el-form-item label="实训任务">
<el-select v-model="filters.taskId" placeholder="请选择实训任务" :disabled="!filters.classId" @change="loadReview">
<el-option v-for="task in review.tasks" :key="task.taskId" :label="task.taskName" :value="task.taskId" />
</el-select>
</el-form-item>
<el-form-item label="教学班级">
<el-select v-model="filters.classId" placeholder="请选择教学班" @change="onClassChange">
<el-option v-for="item in teachingClasses" :key="item.schoolClassId" :label="item.className" :value="item.schoolClassId" />
</el-select>
</el-form-item>
</el-form>
<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 || 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="86" align="center">
<template #default="{ row }">
<button
v-if="row.aiAssessmentScore !== null && row.aiAssessmentScore !== undefined"
type="button"
class="task-review__ai-score-btn"
title="点击查看AI评分详情"
@click.stop="openAiScorePopover(row)"
>
{{ formatScore(row.aiAssessmentScore) }}<span v-if="batchAiScoredIds.has(row.studentUserId)" class="task-review__ai-dot" title="AI评分完成"></span>
</button>
<span v-else>{{ formatScore(row.aiAssessmentScore) }}<span v-if="batchAiScoredIds.has(row.studentUserId)" class="task-review__ai-dot" title="AI评分完成"></span></span>
</template>
</el-table-column>
<el-table-column label="老师评分" min-width="118" align="center">
<template #default="{ row }">
<template v-if="canManageClass && row.scorable">
<span v-if="row.teacherScore !== null && row.teacherScore !== undefined" class="task-review__teacher-score">{{ formatScore(row.teacherScore) }}</span>
<el-button type="primary" size="small" text @click="openScoreDialog(row)">{{ row.teacherScore === null || row.teacherScore === undefined ? "评阅" : "修改" }}</el-button>
</template>
<el-tag v-else-if="!row.scorable" size="small" type="info">未完成</el-tag>
<span v-else>{{ formatScore(row.teacherScore) }}</span>
</template>
</el-table-column>
</el-table>
<el-pagination v-if="review.students.length > pagination.pageSize" v-model:current-page="pagination.currentPage" v-model:page-size="pagination.pageSize" :page-sizes="[10, 20, 50, 100]" :total="review.students.length" layout="total, sizes, prev, pager, next, jumper" class="task-review__pagination" small background @current-change="onPageChange" @size-change="onPageSizeChange" />
<p v-if="!canManageClass && filters.classId" class="task-review__readonly-tip">仅班级创建教师可评分</p>
</aside>
<section class="task-review__content">
<template v-if="selectedStudent && review.selectedTask">
<header class="task-review__student-head">
<div>
<h2>{{ selectedStudent.name || selectedStudent.username }}</h2>
<p>{{ review.selectedTask.projectName }} · {{ review.selectedTask.taskName }}</p>
</div>
<div class="task-review__head-actions">
<button type="button" class="task-review__action-btn" @click="onViewReferenceAnswer">
<el-icon><DocumentCopy /></el-icon>
查看参考答案
</button>
<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>
<div class="task-review__scores-section">
<div class="task-review__scores">
<span class="task-review__score-item">
<span class="task-review__score-label">AI评分</span>
<strong class="task-review__score-value">{{ formatScore(selectedStudent.aiAssessmentScore) }}</strong>
</span>
<span class="task-review__score-item">
<span class="task-review__score-label">老师评分</span>
<strong class="task-review__score-value">{{ formatScore(selectedStudent.teacherScore) }}</strong>
</span>
</div>
</div>
<div v-if="studentPreviewSrc" class="task-review__student-preview-scroll">
<iframe :key="studentPreviewSrc" class="task-review__student-preview" :src="studentPreviewSrc" :style="{ height: `${previewFrameHeight}px` }" scrolling="yes" title="学生任务页面只读预览" />
</div>
<el-empty v-else :description="studentPreviewError || '当前任务暂不支持页面预览'" :image-size="104" />
</template>
<el-empty v-else description="请选择教学班和实训任务后查看学生任务步骤" :image-size="128" />
</section>
<el-dialog v-model="singleScoreDialogVisible" width="480px" append-to-body :show-close="false" class="score-review-dialog" @closed="resetSingleScoreForm">
<template #header>
<div class="dialog-header">
<div class="dialog-header-main">
<span class="dialog-badge">
<el-icon><EditPen /></el-icon>
任务评阅
</span>
<h3 class="dialog-title">{{ singleScoreForm.studentName }}</h3>
</div>
<button type="button" class="dialog-close" @click="singleScoreDialogVisible = false">
<el-icon><Close /></el-icon>
</button>
</div>
</template>
<el-form ref="singleScoreFormRef" label-position="top" :model="singleScoreForm" class="score-review-form">
<el-form-item label="老师评分" class="score-review-form__score">
<div class="score-input-wrapper">
<el-input-number v-model="singleScoreForm.score" :min="0" :max="100" :precision="0" :controls="false" placeholder="0-100" class="score-number-input" />
<span class="score-unit">分</span>
</div>
</el-form-item>
<el-form-item :label="generatingComment ? '评语(AI 生成中...)' : '评语'" class="score-review-form__comment">
<el-input v-model="singleScoreForm.comment" type="textarea" :rows="4" placeholder="请输入对学生任务完成情况的评价(可选),打开评阅时会按 AI 评分/助学数据自动生成 10-50 字评语" maxlength="1000" show-word-limit class="score-comment-textarea" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<button type="button" class="dialog-btn dialog-btn--cancel" @click="singleScoreDialogVisible = false">取消</button>
<button type="button" class="dialog-btn dialog-btn--primary" :disabled="savingSingleScore" @click="saveSingleScoreDialog">
<el-icon v-if="savingSingleScore"><Loading /></el-icon>
<el-icon v-else><CircleCheck /></el-icon>
{{ savingSingleScore ? "保存中..." : "确认评阅" }}
</button>
</div>
</template>
</el-dialog>
<el-dialog
v-model="batchDialogVisible"
width="480px"
append-to-body
:show-close="false"
class="score-review-dialog"
@closed="
batchScore = null;
batchComment = null;
"
>
<template #header>
<div class="dialog-header">
<div class="dialog-header-main">
<span class="dialog-badge">
<el-icon><DocumentChecked /></el-icon>
批量打分
</span>
<h3 class="dialog-title">已选择 {{ selectedStudents.length }} 名学生</h3>
</div>
<button type="button" class="dialog-close" @click="batchDialogVisible = false">
<el-icon><Close /></el-icon>
</button>
</div>
</template>
<el-form label-position="top" class="score-review-form" @submit.prevent="saveBatchScore">
<el-form-item label="统一打分" class="score-review-form__score">
<div class="score-input-wrapper">
<el-input-number v-model="batchScore" :min="0" :max="100" :precision="0" :controls="false" placeholder="0-100" class="score-number-input" />
<span class="score-unit">分</span>
</div>
</el-form-item>
<el-form-item label="统一评语" class="score-review-form__comment">
<el-input v-model="batchComment" type="textarea" :rows="4" placeholder="请输入对选中学生的统一评价(可选)" maxlength="1000" show-word-limit class="score-comment-textarea" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<button type="button" class="dialog-btn dialog-btn--cancel" @click="batchDialogVisible = false">取消</button>
<button type="button" class="dialog-btn dialog-btn--primary" :disabled="savingBatch" @click="saveBatchScore">
<el-icon v-if="savingBatch"><Loading /></el-icon>
<el-icon v-else><CircleCheck /></el-icon>
{{ savingBatch ? "保存中..." : "确认打分" }}
</button>
</div>
</template>
</el-dialog>
<el-dialog v-model="batchAiScoreDialogVisible" width="520px" append-to-body :show-close="false" :close-on-click-modal="false" :close-on-press-escape="false" class="score-review-dialog batch-ai-score-dialog">
<template #header>
<div class="dialog-header">
<div class="dialog-header-main">
<span class="dialog-badge">
<el-icon><TrendCharts /></el-icon>
批量AI评分
</span>
<h3 class="dialog-title">已选择 {{ selectedStudents.length }} 名学生</h3>
</div>
<button v-if="batchAiScoreProgress.status !== 'running'" type="button" class="dialog-close" @click="closeBatchAiScoreDialog">
<el-icon><Close /></el-icon>
</button>
</div>
</template>
<div class="batch-ai-score-content">
<!-- 状态说明 -->
<div v-if="batchAiScoreProgress.status === 'idle'" class="batch-ai-info">
<p class="batch-ai-info__title">准备开始批量AI评分</p>
<p class="batch-ai-info__desc">AI将自动分析已选中学生的作业内容,并生成评分结果。此过程可能需要几分钟,请耐心等待。</p>
<ul class="batch-ai-info__list">
<li>AI会根据任务要求和评分标准进行评估</li>
<li>评分维度包括内容完整性、分析深度、创新性等</li>
<li>评分完成后可在学生列表中查看AI评分</li>
</ul>
</div>
<!-- 进度条和状态 -->
<div v-if="batchAiScoreProgress.status !== 'idle'" class="batch-ai-progress">
<div class="batch-ai-progress__stats">
<div class="batch-ai-progress__stat">
<span class="batch-ai-progress__label">总计</span>
<strong class="batch-ai-progress__value">{{ batchAiScoreProgress.total }}</strong>
</div>
<div class="batch-ai-progress__stat batch-ai-progress__stat--success">
<span class="batch-ai-progress__label">成功</span>
<strong class="batch-ai-progress__value">{{ batchAiScoreProgress.successCount }}</strong>
</div>
<div class="batch-ai-progress__stat batch-ai-progress__stat--fail">
<span class="batch-ai-progress__label">失败</span>
<strong class="batch-ai-progress__value">{{ batchAiScoreProgress.failCount }}</strong>
</div>
</div>
<div class="batch-ai-progress__bar-wrapper">
<el-progress :percentage="Math.floor((batchAiScoreProgress.current / batchAiScoreProgress.total) * 100)" :status="batchAiScoreProgress.status === 'completed' ? 'success' : batchAiScoreProgress.status === 'failed' ? 'exception' : undefined" :stroke-width="12" />
<p class="batch-ai-progress__text">{{ batchAiScoreProgress.current }} / {{ batchAiScoreProgress.total }}</p>
</div>
<p v-if="batchAiScoreProgress.status === 'running'" class="batch-ai-progress__tip">
<el-icon class="is-loading"><Loading /></el-icon>
正在进行AI评分,请稍候...
</p>
<p v-if="batchAiScoreProgress.status === 'completed'" class="batch-ai-progress__tip batch-ai-progress__tip--success">
<el-icon><CircleCheck /></el-icon>
批量AI评分已完成!
</p>
<p v-if="batchAiScoreProgress.status === 'failed'" class="batch-ai-progress__tip batch-ai-progress__tip--error">AI评分过程中出现错误,请重试</p>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<button v-if="batchAiScoreProgress.status === 'idle'" type="button" class="dialog-btn dialog-btn--cancel" @click="batchAiScoreDialogVisible = false">取消</button>
<button v-if="batchAiScoreProgress.status === 'idle'" type="button" class="dialog-btn dialog-btn--primary" @click="startBatchAiScore">
<el-icon><TrendCharts /></el-icon>
开始AI评分
</button>
<button v-if="batchAiScoreProgress.status === 'completed' || batchAiScoreProgress.status === 'failed'" type="button" class="dialog-btn dialog-btn--primary" @click="closeBatchAiScoreDialog">关闭</button>
</div>
</template>
</el-dialog>
<el-dialog v-model="aiAssistEvalDialogVisible" width="420px" append-to-body :show-close="false" :close-on-click-modal="false" :close-on-press-escape="false" class="score-review-dialog ai-assist-eval-dialog">
<template #header>
<div class="dialog-header">
<div class="dialog-header-main">
<span class="dialog-badge">
<el-icon><TrendCharts /></el-icon>
AI助评
</span>
<h3 class="dialog-title">{{ selectedStudent?.name || selectedStudent?.username }}</h3>
</div>
</div>
</template>
<div class="ai-assist-eval-content">
<div class="ai-assist-eval-loading">
<el-icon class="ai-assist-eval-loading__icon"><Loading /></el-icon>
<p class="ai-assist-eval-loading__text">AI正在分析学生作业...</p>
<p class="ai-assist-eval-loading__desc">这可能需要15-30秒,请稍候</p>
</div>
</div>
</el-dialog>
<el-dialog v-model="aiScoreDetailVisible" width="640px" append-to-body :show-close="false" class="ai-score-detail-dialog">
<template #header>
<div class="dialog-header">
<div class="dialog-header-main">
<span class="dialog-badge">
<el-icon><TrendCharts /></el-icon>
AI评分结果
</span>
<h3 class="dialog-title">{{ aiScoreDetailStudent || "AI评分结果" }}</h3>
</div>
<button type="button" class="dialog-close" @click="aiScoreDetailVisible = false">
<el-icon><Close /></el-icon>
</button>
</div>
</template>
<div class="ai-score-detail">
<!-- 综合评分 -->
<div class="ai-score-summary">
<div class="ai-score-summary__main">
<span class="ai-score-summary__label">综合评分</span>
<div class="ai-score-summary__score">
<span class="ai-score-summary__number">{{ aiScoreDetailData.totalScore ?? "--" }}</span>
<span class="ai-score-summary__total">/{{ aiScoreDetailData.totalFullScore }}</span>
</div>
</div>
<p v-if="aiScoreDetailData.comment" class="ai-score-summary__comment">{{ aiScoreDetailData.comment }}</p>
</div>
<!-- 各维度评分 -->
<div v-if="aiScoreDetailData.dimensions.length > 0" class="ai-score-dimensions">
<div v-for="(dimension, index) in aiScoreDetailData.dimensions" :key="index" class="ai-score-dimension">
<div class="ai-score-dimension__head">
<h4 class="ai-score-dimension__title">{{ dimension.name }}</h4>
<span class="ai-score-dimension__score">
<strong>{{ dimension.score ?? "--" }}</strong>
<span>/{{ dimension.fullScore }}</span>
</span>
</div>
<p v-if="dimension.analysis" class="ai-score-dimension__analysis">{{ dimension.analysis }}</p>
</div>
</div>
<!-- 优先改进 -->
<div v-if="aiScoreDetailData.improvements.length > 0" class="ai-score-improvements">
<h4 class="ai-score-improvements__title">优先改进</h4>
<ul class="ai-score-improvements__list">
<li v-for="(improvement, index) in aiScoreDetailData.improvements" :key="index">
{{ improvement }}
</li>
</ul>
</div>
<!-- 无数据提示 -->
<el-empty v-if="!aiScoreDetailData.totalScore && aiScoreDetailData.dimensions.length === 0" description="暂无AI评分详情数据" :image-size="120" />
</div>
</el-dialog>
<el-dialog v-model="referenceAnswerDialogVisible" title="参考答案" width="900px" append-to-body class="reference-answer-dialog">
<iframe v-if="referenceAnswerSrc" :src="referenceAnswerSrc" class="reference-answer-frame" title="参考答案在线预览" />
<el-empty v-else description="暂无可预览的 Word 参考答案" />
</el-dialog>
</div>
</template>
<script setup>
import { ElMessage } from "element-plus";
import { EditPen, DocumentChecked, Close, CircleCheck, Loading, DocumentCopy, CirclePlus, TrendCharts } from "@element-plus/icons-vue";
import * as teacherApi from "@/api/teacher";
import { listClassTrainingTasks } from "@/api/trainingTask";
import useUserStore from "@/store/modules/user";
import { clearTrainingReviewPreview, writeTrainingReviewPreview } from "@/utils/trainingReviewPreview";
const props = defineProps({
teachingClassList: { type: Array, default: () => [] },
initialClassId: { type: String, default: "" },
});
const userStore = useUserStore();
const fallbackTeachingClassList = ref([]);
const teachingClasses = computed(() => (props.teachingClassList.length ? props.teachingClassList : fallbackTeachingClassList.value));
const filters = ref({ classId: "", projectName: "", taskId: "" });
const review = ref({ projects: [], tasks: [], selectedTask: null, students: [] });
const loading = ref(false);
const savingBatch = ref(false);
const batchDialogVisible = ref(false);
const batchScore = ref(null);
const batchComment = ref("");
const singleScoreDialogVisible = ref(false);
const savingSingleScore = ref(false);
const generatingComment = ref(false);
const singleScoreFormRef = ref();
const singleScoreForm = ref({ studentId: "", studentName: "", score: null, comment: "" });
const selectedStudents = ref([]);
const selectedStudentId = ref("");
const studentTableRef = ref();
const previewKey = ref("");
const studentPreviewSrc = ref("");
const studentPreviewError = ref("");
const previewFrameHeight = ref(580);
let previewRequestVersion = 0;
const PREVIEW_HEIGHT_MESSAGE = "teacher-task-review-preview-height";
// AI评分详情悬浮层:锚定在学生列表 AI评分 一栏,点击分数弹出该生评分结果
const aiScoreDetailVisible = ref(false);
const aiScoreDetailStudent = ref("");
const aiScoreDetailData = ref({
totalScore: null,
totalFullScore: 100,
comment: "",
dimensions: [],
improvements: [],
});
const batchAiScoreDialogVisible = ref(false);
const batchAiScoring = ref(false);
const batchAiCompleted = ref(false);
const batchAiScoredIds = ref(new Set());
const batchAiScoreProgress = ref({
total: 0,
current: 0,
successCount: 0,
failCount: 0,
status: "idle", // 'idle' | 'running' | 'completed' | 'failed'
});
const aiAssistEvalDialogVisible = ref(false);
const aiAssistEvaluating = ref(false);
const referenceAnswerDialogVisible = ref(false);
const referenceAnswerSrc = ref("");
let referenceAnswerObjectUrl = "";
const pagination = ref({
currentPage: 1,
pageSize: 10,
});
const canManageClass = computed(() => {
const currentClass = teachingClasses.value.find((item) => item.schoolClassId === filters.value.classId);
return Boolean(currentClass) && String(currentClass.createdBy || "") === String(userStore.userInfo.userId || "");
});
const selectedStudent = computed(() => review.value.students.find((row) => row.studentUserId === selectedStudentId.value) || review.value.students[0] || null);
const canBatchScore = computed(() => canManageClass.value && selectedStudents.value.length > 0 && Boolean(filters.value.taskId));
const paginatedStudents = computed(() => {
const students = review.value.students;
const start = (pagination.value.currentPage - 1) * pagination.value.pageSize;
const end = start + pagination.value.pageSize;
return students.slice(start, end);
});
watch(
teachingClasses,
(classes) => {
if (!filters.value.classId && classes.length) {
const ownTeachingClass = classes.find((schoolClass) => String(schoolClass.createdBy || "") === String(userStore.userInfo.userId || ""));
filters.value.classId = ownTeachingClass?.schoolClassId || "";
if (filters.value.classId) loadReview();
}
},
{ immediate: true },
);
watch([selectedStudent, () => review.value.selectedTask], refreshStudentPreview, { immediate: true, flush: "post" });
async function refreshStudentPreview() {
const requestVersion = ++previewRequestVersion;
if (previewKey.value) clearTrainingReviewPreview(previewKey.value);
const taskKey = review.value.selectedTask?.taskKey;
const teachingClassId = filters.value.classId;
const student = selectedStudent.value;
studentPreviewError.value = "";
previewFrameHeight.value = 580;
if (!student || !taskKey || !teachingClassId) {
previewKey.value = "";
studentPreviewSrc.value = "";
return;
}
studentPreviewSrc.value = "";
try {
// 班级任务列表返回该班实际生效的配置:教师覆盖优先,未覆盖时使用管理员案例。
const response = await listClassTrainingTasks(filters.value.classId, { enabledOnly: false });
if (requestVersion !== previewRequestVersion) return;
const effectiveTask = (response?.data || []).find((task) => task.taskKey === taskKey);
if (!effectiveTask) throw new Error("未找到该教学班的有效实训案例");
const nextPreviewKey = `review-${Date.now()}-${Math.random().toString(36).slice(2)}`;
writeTrainingReviewPreview(nextPreviewKey, {
taskKey,
teachingClassId,
taskConfig: effectiveTask,
answer: { ...student },
});
previewKey.value = nextPreviewKey;
studentPreviewSrc.value = `${window.location.pathname}#/task-review-preview?taskKey=${encodeURIComponent(taskKey)}&reviewPreviewKey=${encodeURIComponent(nextPreviewKey)}`;
} catch (error) {
if (requestVersion !== previewRequestVersion) return;
previewKey.value = "";
/* 把真实失败原因透出给教师,避免只有一句通用文案没法排查 */
console.error("[task-review] 实训案例加载失败", error);
studentPreviewError.value = `该教学班的实训案例加载失败:${error?.message || "未知错误"}`;
}
}
function formatScore(score) {
return score === null || score === undefined || score === "" ? "--" : score;
}
function normalizeReview(data) {
const students = (data?.students || []).map((row) => ({ ...row }));
review.value = { projects: data?.projects || [], tasks: data?.tasks || [], selectedTask: data?.selectedTask || null, students };
const selectedTask = review.value.selectedTask;
filters.value.taskId = selectedTask?.taskId || "";
if (selectedTask && !filters.value.projectName) filters.value.projectName = selectedTask.projectName || "";
if (!students.some((row) => row.studentUserId === selectedStudentId.value)) selectedStudentId.value = students[0]?.studentUserId || "";
selectedStudents.value = [];
studentTableRef.value?.clearSelection();
// 重置分页到第一页
pagination.value.currentPage = 1;
}
async function loadReview() {
if (!filters.value.classId) return;
loading.value = true;
try {
/*
* 首次进入 / 切换班级时,前端还不知道该选哪个实训项目,因此首个请求不带
* projectName;后端在 projectName 为空时不会按项目联动过滤,会把该教学班的
* 全部实训任务都返回回来。normalizeReview 随后用 selectedTask 回填了
* projectName,但任务列表仍停留在"全量"那份数据上,表现为:
* 「实训任务」下拉展示了全部任务,手动重选一次实训项目才恢复正常。
* 这里在回填出 projectName 后按该项目重新查一次,保证两个下拉始终联动一致。
*/
const requestedProject = filters.value.projectName;
const res = await teacherApi.getTaskReview({ ...filters.value });
normalizeReview(res.data);
if (!requestedProject && filters.value.projectName) {
const projectRes = await teacherApi.getTaskReview({ ...filters.value });
const projectTasks = projectRes?.data?.tasks || [];
const currentTaskListed = projectTasks.some((task) => String(task.taskId) === String(filters.value.taskId));
if (currentTaskListed) {
// 常规路径:只替换「实训任务」下拉的选项,不动 selectedTask 与学生列表,
// 避免多触发一次右侧学生页预览重建(预览页会真实发起接口请求)。
review.value = {
...review.value,
projects: projectRes.data.projects || review.value.projects,
tasks: projectTasks,
};
} else if (projectTasks.length) {
// 兜底:过滤后不含当前任务时整体刷新,保证下拉值与选中任务一致。
normalizeReview(projectRes.data);
}
}
} finally {
loading.value = false;
}
}
async function loadTeachingClasses() {
if (props.teachingClassList.length) return;
const res = await teacherApi.getAccessibleTeachingClasses();
fallbackTeachingClassList.value = (res.data || []).filter((item) => item.classType === "TEACHING");
}
function onClassChange() {
filters.value.projectName = "";
filters.value.taskId = "";
loadReview();
}
function onProjectChange() {
filters.value.taskId = "";
loadReview();
}
function onSelectionChange(rows) {
selectedStudents.value = rows;
}
function canSelectStudent(row) {
return canManageClass.value && Boolean(row.scorable);
}
function selectStudent(row) {
selectedStudentId.value = row.studentUserId;
}
function onPageChange(page) {
pagination.value.currentPage = page;
}
function onPageSizeChange(pageSize) {
pagination.value.pageSize = pageSize;
pagination.value.currentPage = 1;
}
function studentRowClass({ row }) {
return row.studentUserId === selectedStudentId.value ? "task-review__selected-row" : "";
}
function onPreviewMessage(event) {
if (event.origin !== window.location.origin) return;
const data = event.data || {};
if (data.type !== PREVIEW_HEIGHT_MESSAGE || data.previewKey !== previewKey.value) return;
const height = Number(data.height);
if (Number.isFinite(height) && height > 0) previewFrameHeight.value = Math.max(580, Math.ceil(height));
}
async function saveBatchScore() {
if (!Number.isInteger(batchScore.value) || batchScore.value < 0 || batchScore.value > 100) {
ElMessage.error("请输入0至100之间的整数分数");
return;
}
savingBatch.value = true;
try {
await teacherApi.batchSaveTaskTeacherScore({
classId: filters.value.classId,
taskId: filters.value.taskId,
studentUserIds: selectedStudents.value.map((row) => row.studentUserId),
teacherScore: batchScore.value,
teacherComment: batchComment.value?.trim() || "",
});
ElMessage.success("批量任务评分保存成功");
batchDialogVisible.value = false;
await loadReview();
} finally {
savingBatch.value = false;
}
}
let aiCommentRequestToken = 0;
async function openScoreDialog(row) {
const requestToken = ++aiCommentRequestToken;
// 教师已保存过的评语优先展示,不被 AI 生成覆盖
singleScoreForm.value = {
studentId: row.studentUserId,
studentName: row.name || row.username,
score: row.teacherScore ?? null,
comment: row.teacherComment || "",
};
singleScoreDialogVisible.value = true;
if (row.teacherComment) return;
// 点击评阅时让 AI 基于该生的 AI 评分与助学报告生成 10-50 字评语并填入
generatingComment.value = true;
try {
const response = await teacherApi.generateTaskAiComment({ classId: filters.value.classId, taskId: filters.value.taskId, studentUserId: row.studentUserId });
const comment = response?.data?.comment || "";
if (requestToken === aiCommentRequestToken && comment) {
singleScoreForm.value = { ...singleScoreForm.value, comment };
}
} catch {
// AI 评分数据缺失或生成失败时保留空评语,教师可手填
} finally {
if (requestToken === aiCommentRequestToken) generatingComment.value = false;
}
}
function resetSingleScoreForm() {
singleScoreForm.value = { studentId: "", studentName: "", score: null, comment: "" };
singleScoreFormRef.value?.clearValidate();
}
async function saveSingleScoreDialog() {
const score = singleScoreForm.value.score;
if (score === null || score === undefined || score === "") {
ElMessage.error("请输入0至100之间的整数分数");
return;
}
if (!Number.isInteger(score) || score < 0 || score > 100) {
ElMessage.error("教师评分必须为0至100之间的整数");
return;
}
savingSingleScore.value = true;
try {
await teacherApi.saveTaskTeacherScore({
classId: filters.value.classId,
studentUserId: singleScoreForm.value.studentId,
taskId: filters.value.taskId,
teacherScore: score,
teacherComment: singleScoreForm.value.comment?.trim() || "",
});
ElMessage.success("任务评分保存成功");
singleScoreDialogVisible.value = false;
await loadReview();
} finally {
savingSingleScore.value = false;
}
}
onMounted(() => {
window.addEventListener("message", onPreviewMessage);
loadTeachingClasses();
});
onBeforeUnmount(() => {
window.removeEventListener("message", onPreviewMessage);
clearTrainingReviewPreview(previewKey.value);
});
// ========== 新增方法 ==========
function onViewReferenceAnswer() {
if (!review.value.selectedTask?.referenceAnswerUrl) {
ElMessage.info("该任务暂未上传参考答案,请先在编辑任务中上传");
return;
}
if (referenceAnswerObjectUrl) URL.revokeObjectURL(referenceAnswerObjectUrl);
referenceAnswerSrc.value = "";
teacherApi.previewTaskReferenceAnswer({ classId: filters.value.classId, taskId: filters.value.taskId }).then((response) => {
const blob = response instanceof Blob ? response : new Blob([response], { type: "application/pdf" });
referenceAnswerObjectUrl = URL.createObjectURL(blob);
referenceAnswerSrc.value = referenceAnswerObjectUrl;
referenceAnswerDialogVisible.value = true;
}).catch((error) => {
// 404 = 任务未上传参考答案;其余才是预览流程异常
if (error?.response?.status === 404) ElMessage.info("该任务暂未上传参考答案,请先在编辑任务中上传");
else ElMessage.error("参考答案预览失败,请稍后重试");
});
}
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,
successCount: 0,
failCount: 0,
status: "idle",
};
}
async function startBatchAiScore() {
batchAiScoring.value = true;
batchAiScoreProgress.value.status = "running";
batchAiScoreProgress.value.current = 0;
batchAiScoreProgress.value.successCount = 0;
batchAiScoreProgress.value.failCount = 0;
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)) {
try {
const response = await teacherApi.getTaskAiAssessment({ classId: filters.value.classId, taskId: filters.value.taskId, studentUserId: studentId });
const status = response?.data?.assessmentStatus;
if (status === "SUCCEEDED" || status === "FAILED") {
pending.delete(studentId);
if (status === "SUCCEEDED") { batchAiScoreProgress.value.successCount++; succeeded.add(studentId); }
else batchAiScoreProgress.value.failCount++;
batchAiScoreProgress.value.current++;
}
} catch { pending.delete(studentId); batchAiScoreProgress.value.failCount++; batchAiScoreProgress.value.current++; }
}
}
batchAiScoreProgress.value.status = "completed";
batchAiScoredIds.value = succeeded;
batchAiCompleted.value = true;
ElMessage.success(`AI评分完成!成功${batchAiScoreProgress.value.successCount}名学生,失败${batchAiScoreProgress.value.failCount}名`);
// 延迟关闭对话框
setTimeout(() => {
batchAiScoreDialogVisible.value = false;
loadReview();
}, 2000);
} catch (error) {
batchAiScoreProgress.value.status = "failed";
ElMessage.error("批量AI评分发生错误");
} finally {
batchAiScoring.value = false;
}
}
function closeBatchAiScoreDialog() {
if (batchAiScoreProgress.value.status === "running") {
ElMessage.warning("正在进行中,请等待...");
return;
}
batchAiScoreDialogVisible.value = false;
}
async function onAiAssistEvaluation() {
if (!selectedStudent.value) return;
aiAssistEvalDialogVisible.value = true;
aiAssistEvaluating.value = true;
try {
await teacherApi.startTaskAiAssessment({ classId: filters.value.classId, taskId: filters.value.taskId, studentUserId: selectedStudent.value.studentUserId });
let response;
for (let attempt = 0; attempt < 80; attempt++) {
await new Promise((resolve) => setTimeout(resolve, 1500));
response = await teacherApi.getTaskAiAssessment({ classId: filters.value.classId, taskId: filters.value.taskId, studentUserId: selectedStudent.value.studentUserId });
if (["SUCCEEDED", "FAILED"].includes(response?.data?.assessmentStatus)) break;
}
if (response?.data?.assessmentStatus !== "SUCCEEDED") throw new Error("AI评分未完成");
await loadReview();
aiAssistEvalDialogVisible.value = false;
} catch (error) {
ElMessage.error("AI助评失败,请重试");
} finally {
aiAssistEvaluating.value = false;
}
}
// 点击学生列表 AI评分 一栏的分数:在分数旁悬浮展示该生的 AI 评分结果
async function openAiScorePopover(row) {
aiScoreDetailStudent.value = row.name || row.username || "";
aiScoreDetailVisible.value = true;
try {
const response = await teacherApi.getTaskAiAssessment({ classId: filters.value.classId, taskId: filters.value.taskId, studentUserId: row.studentUserId });
applyAiDetail(response?.data || {});
} catch { ElMessage.error("获取AI评分详情失败"); }
}
function applyAiDetail(data) {
let report = {};
try { report = data.assessmentReportJson ? JSON.parse(data.assessmentReportJson) : {}; } catch { report = {}; }
aiScoreDetailData.value = {
totalScore: data.assessmentScore ?? report.score ?? null,
totalFullScore: 100,
comment: data.assessmentComment || report.overallComment || report.overallDiagnosis || "",
dimensions: Array.isArray(report.criteria) ? report.criteria.map((item) => ({ name: item.name, score: item.score, fullScore: item.maxScore, analysis: item.rationale })) : [],
improvements: Array.isArray(report.improvements) ? report.improvements : [],
};
}
</script>
<style lang="scss" scoped>
.task-review {
display: grid;
grid-template-columns: minmax(440px, 520px) minmax(0, 1fr);
min-height: calc(100vh - 142px);
overflow: hidden;
background: #ffffff;
border: 1px solid var(--border-color);
border-radius: var(--r-card);
/* ===== 左侧栏 ===== */
.task-review__sidebar {
min-width: 0;
padding: var(--sp-5);
border-right: 1px solid var(--border-color);
overflow: auto;
}
/* ===== 筛选(白卡)===== */
.task-review__filters {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: var(--sp-3);
padding: var(--sp-4);
background: #ffffff;
border: 1px solid var(--border-color);
border-radius: var(--r-card);
:deep(.el-form-item) {
margin-bottom: 0;
}
:deep(.el-select) {
width: 100%;
}
}
.task-review__list-head {
display: flex;
align-items: center;
justify-content: space-between;
margin: var(--sp-4) 0 var(--sp-1);
color: var(--text-strong);
font-size: var(--fs-card);
font-weight: 700;
}
.task-review__list-actions {
display: flex;
gap: 8px;
}
.task-review__score-input {
width: 70px;
}
.task-review__teacher-score {
margin-right: 4px;
color: var(--edu-primary, #2563eb);
font-weight: 700;
}
/* AI评分一栏:可点击的分数(悬浮展示评分结果) */
.task-review__ai-score-btn {
padding: 0;
color: var(--student-success, #16a34a);
font-weight: 700;
background: transparent;
border: 0;
cursor: pointer;
}
.task-review__ai-score-btn:hover {
text-decoration: underline;
}
/* 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%;
background: #ffffff;
border: 1px solid var(--border-color);
border-radius: var(--r-card);
overflow: hidden;
:deep(.el-table__header-wrapper th) {
background: #ffffff;
color: var(--text-strong);
font-weight: 600;
font-size: var(--fs-body);
}
:deep(.el-table__body tr:hover > td) {
background: #f9fafb !important;
}
:deep(.task-review__selected-row > td) {
background: #f9fafb !important;
}
:deep(.el-table__cell) {
font-size: var(--fs-body);
color: var(--text-strong);
border-color: var(--border-color);
}
:deep(.cell) {
padding: 0 10px;
}
:deep(th .cell) {
white-space: nowrap;
}
}
.task-review__readonly-tip {
margin: var(--sp-3) 0 0;
color: var(--text-muted);
font-size: var(--fs-body);
}
.task-review__pagination {
margin: 12px 0 0;
display: flex;
justify-content: flex-end;
:deep(.el-pagination) {
font-size: var(--fs-body);
}
}
/* ===== 右侧预览区 ===== */
.task-review__content {
position: relative;
min-width: 0;
padding: var(--sp-5);
}
.task-review__student-head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: var(--sp-5);
padding: 0 0 var(--sp-5);
border-bottom: 1px solid var(--border-color);
h2 {
margin: 0;
color: var(--text-strong);
font-size: var(--fs-page);
line-height: 1.35;
}
p {
margin: var(--sp-2) 0 0;
color: var(--text-body);
font-size: var(--fs-body);
}
}
.task-review__head-actions {
display: flex;
gap: 8px;
flex: 0 0 auto;
}
.task-review__action-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
height: 36px;
padding: 0 14px;
border: 1px solid var(--border-color);
border-radius: var(--r-sm, 6px);
background: var(--surface-card, #ffffff);
color: var(--text-body);
font-size: var(--fs-body-sm, 13px);
font-weight: 600;
white-space: nowrap;
cursor: pointer;
transition: all 0.16s ease;
.el-icon {
font-size: 14px;
}
&:hover {
border-color: var(--primary-color, #2563eb);
background: var(--primary-soft, #eff6ff);
color: var(--primary-color, #2563eb);
transform: translateY(-1px);
box-shadow: var(--shadow-sm, 0 2px 6px rgba(15, 23, 42, 0.08));
}
&:active {
transform: translateY(0);
}
}
.task-review__action-btn--primary {
border-color: var(--primary-color, #2563eb);
background: var(--primary-color, #2563eb);
color: var(--text-inverse, #ffffff);
box-shadow: var(--shadow-primary, 0 3px 10px rgba(37, 99, 235, 0.2));
&:hover {
border-color: var(--primary-deep, #1d4ed8);
background: var(--primary-deep, #1d4ed8);
color: #ffffff;
box-shadow: var(--shadow-primary-hover, 0 5px 14px rgba(29, 78, 216, 0.24));
transform: translateY(-1px);
}
}
.task-review__scores-section {
padding: var(--sp-4) 0 0;
}
.task-review__scores {
display: flex;
gap: var(--sp-2);
color: var(--text-body);
font-size: var(--fs-body);
white-space: nowrap;
.task-review__score-item {
display: flex;
align-items: center;
gap: 8px;
padding: var(--sp-1) var(--sp-2);
border: 1px solid var(--border-color);
border-radius: 999px;
background: #ffffff;
cursor: default;
transition: all 0.16s ease;
&:is(button) {
cursor: pointer;
&:hover {
border-color: #2563eb;
background: #eff6ff;
transform: translateY(-1px);
box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
.task-review__score-label {
color: #2563eb;
}
.task-review__score-value {
color: #2563eb;
}
}
}
}
.task-review__score-label {
color: var(--text-body);
font-size: var(--fs-body);
transition: color 0.16s ease;
}
.task-review__score-value {
color: var(--edu-primary);
font-size: var(--fs-num);
font-weight: 700;
transition: color 0.16s ease;
}
}
.task-review__student-preview-scroll {
height: calc(100vh - 260px);
min-height: 580px;
margin-top: var(--sp-5);
overflow: auto;
scrollbar-gutter: stable;
border: 1px solid var(--border-color);
border-radius: var(--r-card);
}
.task-review__student-preview {
display: block;
width: 100%;
min-height: 580px;
border: 0;
}
}
/* 批量打分弹窗(append-to-body,取不到根类令牌时按令牌值兜底) */
.task-review__batch-copy {
margin: 0 0 var(--sp-4, 16px);
color: var(--text-body);
}
.task-review__batch-input {
width: 100%;
}
.task-review__form-item-readonly {
:deep(.el-form-item__content) {
color: var(--text-strong);
font-weight: 500;
}
}
/* ============================================================
* 评阅对话框 - 教育蓝极简风格(append-to-body)
* ============================================================ */
:deep(.score-review-dialog) {
border-radius: 16px;
overflow: hidden;
.el-dialog__header {
margin: 0;
padding: 0;
border-bottom: 1px solid #e5e7eb;
}
.el-dialog__body {
padding: 24px;
}
.el-dialog__footer {
padding: 0;
}
}
.dialog-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
}
.dialog-header-main {
display: grid;
gap: 8px;
min-width: 0;
flex: 1;
}
.dialog-badge {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 12px;
border: 1px solid rgba(37, 99, 235, 0.2);
border-radius: 999px;
color: #2563eb;
background: #eff6ff;
font-size: 12px;
font-weight: 700;
width: fit-content;
.el-icon {
font-size: 13px;
}
}
.dialog-title {
margin: 0;
color: #1f2937;
font-size: 17px;
font-weight: 700;
line-height: 1.35;
}
.dialog-close {
flex: 0 0 auto;
display: flex;
align-items: center;
justify-content: center;
width: 32px;
height: 32px;
padding: 0;
border: 1px solid #e5e7eb;
border-radius: 8px;
background: #ffffff;
color: #6b7280;
cursor: pointer;
transition: all 0.16s ease;
&:hover {
border-color: #2563eb;
background: #eff6ff;
color: #2563eb;
}
.el-icon {
font-size: 16px;
}
}
.score-review-form {
.el-form-item {
margin-bottom: 20px;
&:last-child {
margin-bottom: 0;
}
}
:deep(.el-form-item__label) {
margin-bottom: 8px;
color: #374151;
font-size: 13px;
font-weight: 600;
line-height: 1.5;
}
}
.score-review-form__score {
.score-input-wrapper {
display: flex;
align-items: center;
gap: 12px;
}
.score-number-input {
flex: 1;
width: auto;
:deep(.el-input__wrapper) {
padding: 12px 16px;
border-radius: 10px;
background: #fafbfc;
border: 1px solid #e5e7eb;
box-shadow: none;
transition: all 0.16s ease;
&:hover {
border-color: #3b82f6;
background: #ffffff;
}
&.is-focus {
border-color: #2563eb;
background: #ffffff;
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
}
:deep(.el-input__inner) {
color: #1f2937;
font-size: 20px;
font-weight: 700;
font-family: var(--el-font-family), ui-monospace, "SF Mono", Consolas, monospace;
text-align: left;
&::placeholder {
color: #9ca3af;
font-weight: 600;
}
}
}
.score-unit {
flex: 0 0 auto;
color: #6b7280;
font-size: 14px;
font-weight: 600;
}
}
.score-review-form__comment {
.score-comment-textarea {
:deep(.el-textarea__inner) {
padding: 12px 14px;
border-radius: 10px;
border: 1px solid #e5e7eb;
background: #fafbfc;
color: #1f2937;
font-size: 13px;
line-height: 1.6;
resize: vertical;
min-height: 100px;
transition: all 0.16s ease;
&:hover {
border-color: #3b82f6;
background: #ffffff;
}
&:focus {
border-color: #2563eb;
background: #ffffff;
box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
&::placeholder {
color: #9ca3af;
}
}
:deep(.el-input__count) {
color: #9ca3af;
background: transparent;
font-size: 11px;
line-height: 1;
}
}
}
.dialog-footer {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 10px;
padding: 16px 24px;
border-top: 1px solid #e5e7eb;
background: #fafbfc;
}
.dialog-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
height: 40px;
padding: 0 20px;
border: 1px solid transparent;
border-radius: 10px;
font-size: 13px;
font-weight: 700;
line-height: 1;
cursor: pointer;
transition: all 0.16s ease;
white-space: nowrap;
.el-icon {
font-size: 14px;
}
&:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none !important;
}
}
.dialog-btn--cancel {
border-color: #e5e7eb;
color: #6b7280;
background: #ffffff;
&:hover:not(:disabled) {
border-color: #d1d5db;
color: #374151;
background: #f9fafb;
}
}
.dialog-btn--primary {
border-color: #2563eb;
color: #ffffff;
background: #2563eb;
box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28);
&:hover:not(:disabled) {
border-color: #1d4ed8;
background: #1d4ed8;
box-shadow: 0 5px 14px rgba(29, 78, 216, 0.32);
transform: translateY(-1px);
}
&:active:not(:disabled) {
transform: translateY(0);
}
}
/* ============================================================
* AI评分详情弹窗 - 居中弹窗展示,不受列表行数影响
* ============================================================ */
:deep(.ai-score-detail-dialog) {
border-radius: var(--r-card, 12px);
.el-dialog__header {
margin: 0;
padding: 18px 24px;
border-bottom: 1px solid var(--border-color);
}
.el-dialog__body {
padding: 20px 24px 24px;
max-height: 64vh;
overflow-y: auto;
}
}
.ai-score-detail {
display: flex;
flex-direction: column;
gap: 18px;
}
/* 综合评分:大分数 + 评语分层展示 */
.ai-score-summary {
padding: 16px 20px;
border: 1px solid rgba(37, 99, 235, 0.18);
border-radius: 12px;
background: #eff6ff;
}
.ai-score-summary__main {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
}
.ai-score-summary__label {
color: var(--text-body, #374151);
font-size: 14px;
font-weight: 600;
}
.ai-score-summary__score {
display: flex;
align-items: baseline;
gap: 6px;
}
.ai-score-summary__number {
color: var(--primary-color, #2563eb);
font-size: 40px;
font-weight: 700;
line-height: 1;
font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
.ai-score-summary__total {
color: var(--text-muted, #6b7280);
font-size: 14px;
font-weight: 600;
}
.ai-score-summary__comment {
margin: 12px 0 0;
padding-top: 12px;
border-top: 1px dashed rgba(37, 99, 235, 0.25);
color: var(--text-body, #374151);
font-size: 14px;
line-height: 1.8;
}
/* 逐项评分:独立卡片,标题+得分一行,评析另起 */
.ai-score-dimensions {
display: flex;
flex-direction: column;
gap: 12px;
}
.ai-score-dimension {
padding: 14px 16px;
border: 1px solid var(--border-color, #e5e7eb);
border-radius: 10px;
background: #fafbfc;
}
.ai-score-dimension__head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
}
.ai-score-dimension__title {
margin: 0;
color: var(--text-strong, #111827);
font-size: 14px;
font-weight: 700;
flex: 1;
}
.ai-score-dimension__score {
display: flex;
align-items: baseline;
gap: 4px;
white-space: nowrap;
strong {
color: var(--primary-color, #2563eb);
font-size: 17px;
font-weight: 700;
font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
span {
color: var(--text-muted, #6b7280);
font-size: 13px;
font-weight: 600;
}
}
.ai-score-dimension__analysis {
margin: 8px 0 0;
color: var(--text-secondary, #4b5563);
font-size: 13px;
line-height: 1.75;
}
/* 优先改进 */
.ai-score-improvements {
padding: 14px 16px;
border: 1px solid rgba(239, 68, 68, 0.18);
border-radius: 10px;
background: #fef2f2;
}
.ai-score-improvements__title {
margin: 0 0 8px;
color: #b91c1c;
font-size: 14px;
font-weight: 700;
}
.ai-score-improvements__list {
margin: 0;
padding-left: 18px;
}
.ai-score-improvements__list li {
margin-bottom: 6px;
color: var(--text-body, #374151);
font-size: 13px;
line-height: 1.8;
}
.ai-score-improvements__list li:last-child {
margin-bottom: 0;
}
/* ============================================================
* 批量AI评分对话框
* ============================================================ */
.batch-ai-score-content {
display: grid;
gap: var(--sp-5);
}
.batch-ai-info {
display: grid;
gap: var(--sp-3);
}
.batch-ai-info__title {
margin: 0;
color: var(--text-strong);
font-size: var(--fs-card, 15px);
font-weight: 600;
}
.batch-ai-info__desc {
margin: 0;
color: var(--text-muted);
font-size: var(--fs-body-sm, 13px);
line-height: 1.6;
}
.batch-ai-info__list {
margin: 4px 0 0;
padding-left: 20px;
list-style: disc;
li {
margin-bottom: 6px;
color: var(--text-muted);
font-size: var(--fs-caption, 12px);
line-height: 1.5;
&:last-child {
margin-bottom: 0;
}
}
}
.batch-ai-progress {
display: grid;
gap: var(--sp-5);
}
.batch-ai-progress__stats {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: var(--sp-3);
}
.batch-ai-progress__stat {
padding: var(--sp-3);
border: 1px solid var(--border-color);
border-radius: var(--r-sm, 6px);
background: var(--surface-muted, #fafbfc);
text-align: center;
&.batch-ai-progress__stat--success {
background: var(--success-soft, #f0fdf4);
border-color: var(--success-border, #dcfce7);
}
&.batch-ai-progress__stat--fail {
background: var(--danger-soft, #fef2f2);
border-color: var(--danger-border, #fee2e2);
}
}
.batch-ai-progress__label {
display: block;
color: var(--text-muted);
font-size: var(--fs-caption, 12px);
font-weight: 600;
text-transform: uppercase;
margin-bottom: 4px;
}
.batch-ai-progress__value {
display: block;
color: var(--text-strong);
font-size: 20px;
font-weight: 700;
font-family: ui-monospace, "SF Mono", Consolas, monospace;
.batch-ai-progress__stat--success & {
color: var(--success-color, #16a34a);
}
.batch-ai-progress__stat--fail & {
color: var(--danger-color, #dc2626);
}
}
.batch-ai-progress__bar-wrapper {
position: relative;
padding: 12px 0 8px;
:deep(.el-progress__bar) {
border-radius: 6px;
}
}
.batch-ai-progress__text {
margin: 0;
color: var(--text-muted);
font-size: var(--fs-caption, 12px);
text-align: center;
font-weight: 500;
}
.batch-ai-progress__tip {
margin: 0;
padding: 12px;
border-radius: 8px;
background: var(--surface-muted, #f3f4f6);
color: var(--text-muted);
font-size: var(--fs-caption, 12px);
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
border: 1px solid var(--border-color);
.el-icon {
font-size: 14px;
&.is-loading {
animation: rotating 2s linear infinite;
}
}
&.batch-ai-progress__tip--success {
background: var(--success-soft, #f0fdf4);
border-color: var(--success-border, #dcfce7);
color: var(--success-color, #16a34a);
}
&.batch-ai-progress__tip--error {
background: var(--danger-soft, #fef2f2);
border-color: var(--danger-border, #fee2e2);
color: var(--danger-color, #dc2626);
}
}
@keyframes rotating {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* ============================================================
* AI助评加载对话框
* ============================================================ */
.ai-assist-eval-content {
min-height: 160px;
display: flex;
align-items: center;
justify-content: center;
}
.ai-assist-eval-loading {
text-align: center;
display: grid;
gap: 12px;
}
.ai-assist-eval-loading__icon {
font-size: 48px;
color: var(--primary-light, #3b82f6);
animation: rotating 2s linear infinite;
margin: 0 auto;
}
.ai-assist-eval-loading__text {
margin: 0;
color: var(--text-strong);
font-size: var(--fs-body);
font-weight: 600;
}
.ai-assist-eval-loading__desc {
margin: 0;
color: var(--text-muted);
font-size: var(--fs-caption, 12px);
}
@media (max-width: 1180px) {
.task-review {
grid-template-columns: 1fr;
}
.task-review .task-review__sidebar {
border-right: 0;
border-bottom: 1px solid var(--border-color);
}
}
@media (max-width: 720px) {
.task-review .task-review__filters {
grid-template-columns: 1fr;
}
.task-review .task-review__content {
padding: var(--sp-5);
}
.task-review .task-review__student-head {
flex-direction: column;
}
.task-review .task-review__scores {
flex-wrap: wrap;
white-space: normal;
}
}
</style>