fix: handleSave 增加 try-catch & 深拷贝去代理后再 IPC

This commit is contained in:
2026-07-16 06:32:14 +08:00
parent daade6ba91
commit aa5f9b2999
2 changed files with 13 additions and 7 deletions
+11 -7
View File
@@ -84,13 +84,17 @@ function removeQuestion(idx: number) {
}
async function handleSave() {
gradingStore.setQuestions(JSON.parse(JSON.stringify(questions.value)))
await window.electronAPI?.rubric.storeData({
questions: questions.value,
currentIndex: 0
})
ElMessage.success('评分标准已应用')
handleClose()
try {
gradingStore.setQuestions(JSON.parse(JSON.stringify(questions.value)))
await window.electronAPI?.rubric.storeData({
questions: JSON.parse(JSON.stringify(questions.value)),
currentIndex: 0
})
ElMessage.success('评分标准已应用')
handleClose()
} catch (err) {
ElMessage.error('保存失败:' + (err as Error).message)
}
}
function handleClose() {