feat(student): widen training score dialog and reference preview

dev-QQq
chenyuan 1 month ago
parent 3f0661a77d
commit 47423a05d1

@ -39,26 +39,31 @@
</div>
<!-- 成绩弹窗:成绩、评语和参考答案(老师推送后展示) -->
<el-dialog v-model="scoreDialogVisible" title="实训成绩" width="560px" append-to-body class="task-score-dialog" @open="onScoreDialogOpen">
<div class="task-score-body">
<section v-if="hasTeacherScore || hasAiScore" class="task-score-cards">
<div v-if="hasTeacherScore" class="task-score-card task-score-card--teacher">
<p class="task-score-card__label">老师评分</p>
<p class="task-score-card__value">{{ formatScoreValue(teacherScore) }}<small>分</small></p>
<p v-if="teacherScoredAt" class="task-score-card__time">{{ formatScoreTime(teacherScoredAt) }}</p>
</div>
<div v-if="hasAiScore" class="task-score-card task-score-card--ai">
<p class="task-score-card__label">AI 评分</p>
<p class="task-score-card__value">{{ formatScoreValue(aiScore) }}<small>分</small></p>
</div>
</section>
<section v-if="teacherComment" class="task-score-block">
<p class="task-score-block__label">老师评语</p>
<p class="task-score-block__text">{{ teacherComment }}</p>
</section>
<section v-if="referenceAnswerPushed" class="task-score-block">
<el-dialog v-model="scoreDialogVisible" title="实训成绩"
:width="referenceAnswerPushed ? 'min(1280px, calc(100vw - 48px))' : 'min(760px, calc(100vw - 32px))'"
top="4vh" append-to-body class="task-score-dialog"
:class="{ 'task-score-dialog--with-reference': referenceAnswerPushed }" @open="onScoreDialogOpen">
<div class="task-score-body" :class="{ 'task-score-body--with-reference': referenceAnswerPushed && hasScoreData }">
<div v-if="hasScoreData" class="task-score-summary">
<section v-if="hasTeacherScore || hasAiScore" class="task-score-cards">
<div v-if="hasTeacherScore" class="task-score-card task-score-card--teacher">
<p class="task-score-card__label">老师评分</p>
<p class="task-score-card__value">{{ formatScoreValue(teacherScore) }}<small>分</small></p>
<p v-if="teacherScoredAt" class="task-score-card__time">{{ formatScoreTime(teacherScoredAt) }}</p>
</div>
<div v-if="hasAiScore" class="task-score-card task-score-card--ai">
<p class="task-score-card__label">AI 评分</p>
<p class="task-score-card__value">{{ formatScoreValue(aiScore) }}<small>分</small></p>
</div>
</section>
<section v-if="teacherComment" class="task-score-block">
<p class="task-score-block__label">老师评语</p>
<p class="task-score-block__text">{{ teacherComment }}</p>
</section>
</div>
<section v-if="referenceAnswerPushed" class="task-score-block task-score-block--reference">
<p class="task-score-block__label">参考答案</p>
<p class="task-score-block__text">{{ loadedTask?.referenceAnswerName || "参考答案" }}</p>
<p class="task-score-block__text task-score-reference-name">{{ loadedTask?.referenceAnswerName || "参考答案" }}</p>
<iframe v-if="referenceAnswerPdfUrl" :src="referenceAnswerPdfUrl" class="reference-answer-frame reference-answer-frame--inline" title="参考答案预览" />
<p v-else-if="referenceAnswerLoading" class="task-score-block__text">参考答案加载中...</p>
</section>
@ -557,8 +562,12 @@ function exportLegacyTraining() {
/* 成绩弹窗 */
.task-score-body { display:flex; flex-direction:column; gap:var(--student-sp-4, 16px); }
.task-score-summary { display:flex; flex-direction:column; gap:var(--student-sp-4, 16px); min-width:0; min-height:0; }
.task-score-body--with-reference { display:grid; grid-template-columns:260px minmax(0, 1fr); align-items:stretch; }
.task-score-body--with-reference .task-score-summary { overflow-y:auto; }
.task-score-body--with-reference .task-score-cards { flex-direction:column; }
.task-score-cards { display:flex; gap:var(--student-sp-3, 12px); }
.task-score-card { flex:1; border-radius:var(--student-radius-sm, 6px); padding:var(--student-sp-3, 12px) var(--student-sp-4, 16px); border:1px solid var(--student-panel-border); background:var(--student-panel-bg); }
.task-score-card { flex:1; min-width:0; border-radius:var(--student-radius-sm, 6px); padding:var(--student-sp-3, 12px) var(--student-sp-4, 16px); border:1px solid var(--student-panel-border); background:var(--student-panel-bg); }
.task-score-card--teacher { background:var(--student-accent-soft); border-color:var(--student-accent-light); }
.task-score-card--ai { background:#f0fbf6; border-color:var(--student-success); }
.task-score-card__label { margin:0 0 var(--student-sp-1, 4px); font-size:var(--student-fs-caption); color:var(--student-text-secondary); }
@ -570,8 +579,17 @@ function exportLegacyTraining() {
.task-score-block { border-radius:var(--student-radius-sm, 6px); border:1px solid var(--student-panel-border); background:var(--student-panel-bg); padding:var(--student-sp-3, 12px) var(--student-sp-4, 16px); }
.task-score-block__label { margin:0 0 var(--student-sp-1, 4px); font-size:var(--student-fs-caption); font-weight:600; color:var(--student-text-secondary); }
.task-score-block__text { margin:0; font-size:var(--student-fs-body); line-height:1.7; color:var(--student-text); white-space:pre-wrap; word-break:break-word; }
.reference-answer-frame { display:block; width:100%; height:70vh; border:1px solid var(--student-panel-border); border-radius:var(--student-radius-sm, 6px); background:var(--student-card-bg); }
@media (max-width:640px) { .task-score-cards { flex-direction:column; } }
.task-score-block--reference { display:flex; flex:1; flex-direction:column; min-width:0; min-height:0; }
.task-score-reference-name { margin-bottom:12px; color:var(--student-text-secondary); overflow-wrap:anywhere; }
.reference-answer-frame { display:block; flex:1; width:100%; height:100%; min-height:0; box-sizing:border-box; border:1px solid var(--student-panel-border); border-radius:var(--student-radius-sm, 6px); background:var(--student-card-bg); }
@media (max-width:960px) {
.task-score-body--with-reference { display:flex; }
.task-score-body--with-reference .task-score-summary { overflow-y:visible; }
.task-score-body--with-reference .task-score-cards { flex-direction:row; }
.task-score-block--reference { flex:none; min-height:0; }
.reference-answer-frame { flex:none; height:60vh; min-height:240px; }
}
@media (max-width:640px) { .task-score-cards, .task-score-body--with-reference .task-score-cards { flex-direction:column; } }
/* AI 评分结果悬浮卡片(悬浮在页面上,非弹窗) */
.ai-evaluation-float { position:fixed; top:132px; right:28px; z-index:1800; width:380px; max-height:calc(100vh - 200px); overflow-y:auto; padding:16px; background:var(--student-card-bg, #ffffff); border:1px solid var(--student-panel-border); border-radius:12px; box-shadow:0 12px 32px rgba(15,23,42,.18); }
@ -594,3 +612,47 @@ function exportLegacyTraining() {
.ai-eval-pop-enter-active, .ai-eval-pop-leave-active { transition:opacity .18s ease, transform .18s ease; }
.ai-eval-pop-enter-from, .ai-eval-pop-leave-to { opacity:0; transform:translateY(-6px); }
</style>
<!-- The dialog is appended to body; limit these layout rules to this dialog. -->
<style lang="scss">
.el-dialog.task-score-dialog {
display: flex;
flex-direction: column;
max-height: calc(100vh - 64px);
margin-bottom: 0;
border-radius: var(--student-radius-lg, 12px);
.el-dialog__header {
flex-shrink: 0;
margin-right: 0;
padding: 20px 48px 16px 24px;
border-bottom: 1px solid var(--student-panel-border, #e5e7eb);
}
.el-dialog__body {
display: flex;
flex: 1;
min-height: 0;
padding: 20px 24px 24px;
overflow-y: auto;
}
.task-score-body { flex: 1; min-width: 0; min-height: 0; }
&.task-score-dialog--with-reference {
height: min(820px, calc(100vh - 64px));
}
@media (max-width: 960px) {
&.task-score-dialog--with-reference { height: auto; }
.el-dialog__body { display: block; max-height: calc(100vh - 144px); }
}
@media (max-width: 640px) {
width: calc(100vw - 24px);
max-height: calc(100vh - 32px);
.el-dialog__header { padding: 16px 44px 12px 16px; }
.el-dialog__body { padding: 16px; max-height: calc(100vh - 112px); }
}
}
</style>

Loading…
Cancel
Save