fix: 错误信息内联显示在结果面板内
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
</div>
|
||||
|
||||
<div class="drawer-body" v-if="gradingStore.currentResult">
|
||||
<div class="error-message" v-if="errorMsg">{{ errorMsg }}</div>
|
||||
<div class="question-nav" v-if="questions.length > 1">
|
||||
<el-button size="small" @click="prevQuestion" :disabled="isGrading">上一题</el-button>
|
||||
<span class="question-indicator">{{ currentIdx + 1 }} / {{ questions.length }}</span>
|
||||
@@ -88,6 +89,7 @@ const settingsStore = useSettingsStore()
|
||||
|
||||
const visible = ref(false)
|
||||
const isGrading = ref(false)
|
||||
const errorMsg = ref('')
|
||||
const teacherScore = ref(0)
|
||||
const teacherComment = ref('')
|
||||
const questions = ref<QuestionItem[]>([])
|
||||
@@ -133,6 +135,7 @@ function closeDrawer() {
|
||||
async function gradeAt(idx: number) {
|
||||
if (!gradingStore.currentImage) return
|
||||
isGrading.value = true
|
||||
errorMsg.value = ''
|
||||
try {
|
||||
const q = questions.value[idx]
|
||||
const result = await window.electronAPI.ai.grade({
|
||||
@@ -159,7 +162,7 @@ async function gradeAt(idx: number) {
|
||||
})
|
||||
ElMessage.success(`第 ${idx + 1} 题评分完成`)
|
||||
} catch (err) {
|
||||
ElMessage.error('评分失败:' + (err as Error).message)
|
||||
errorMsg.value = (err as Error).message
|
||||
} finally {
|
||||
isGrading.value = false
|
||||
}
|
||||
@@ -333,6 +336,16 @@ async function confirmScore() {
|
||||
border-radius: 6px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.error-message {
|
||||
background: #fef0f0;
|
||||
color: #f56c6c;
|
||||
border: 1px solid #fde2e2;
|
||||
border-radius: 6px;
|
||||
padding: 10px;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.teacher-score-input {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user