fix: handleSave 增加 try-catch & 深拷贝去代理后再 IPC
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user