1
0
mirror of https://github.com/ZeroCatDev/Classworks.git synced 2026-02-04 16:03:10 +00:00

feat: 使用消息提示替换成功和错误信息的赋值方式

This commit is contained in:
Sunwuyuan 2025-12-13 21:29:25 +08:00
parent 4eb8c74d84
commit 0d91c8844a
No known key found for this signature in database
GPG Key ID: A6A54CF66F56BB64

View File

@ -839,8 +839,7 @@ Now please generate the exam configuration based on the above rules:`
throw new Error(listResponse.error?.message || '更新列表失败') throw new Error(listResponse.error?.message || '更新列表失败')
} }
this.success = '新配置创建成功' this.$message.success('新配置创建成功')
// //
const newConfig = this.configs.find(c => c.id === newId) const newConfig = this.configs.find(c => c.id === newId)
if (newConfig) { if (newConfig) {
@ -848,7 +847,7 @@ Now please generate the exam configuration based on the above rules:`
this.editDialog = true this.editDialog = true
} }
} catch (err) { } catch (err) {
this.error = '创建配置失败: ' + err.message this.$message.error('创建配置失败: ' + err.message)
} }
}, },
@ -889,12 +888,13 @@ Now please generate the exam configuration based on the above rules:`
this.configs[configIndex].examName = this.newConfigName this.configs[configIndex].examName = this.newConfigName
} }
this.success = '配置重命名成功'
this.$message.success('配置重命名成功')
this.renameDialog = false this.renameDialog = false
this.configToRename = null this.configToRename = null
this.newConfigName = '' this.newConfigName = ''
} catch (err) { } catch (err) {
this.error = '重命名配置失败: ' + err.message this.$message.error('重命名配置失败: ' + err.message)
} finally { } finally {
this.renaming = false this.renaming = false
} }
@ -938,31 +938,35 @@ Now please generate the exam configuration based on the above rules:`
* 配置保存成功回调 * 配置保存成功回调
*/ */
onConfigSaved() { onConfigSaved() {
this.success = '配置保存成功!'
this.$message.success('配置保存成功!')
this.loadConfigs() // this.loadConfigs() //
setTimeout(() => {
this.success = ''
}, 3000) this.$message.success('配置保存成功!')
}, },
/** /**
* 配置保存错误回调 * 配置保存错误回调
*/ */
onConfigError(error) { onConfigError(error) {
this.error = error || '保存配置时发生错误'
setTimeout(() => { this.$message.error(error || '保存配置时发生错误')
this.error = ''
}, 5000) this.$message.error(error || '保存配置时发生错误')
}, },
/** /**
* 配置打开成功回调 * 配置打开成功回调
*/ */
onConfigOpened() { onConfigOpened() {
this.success = '配置已在新窗口中打开'
setTimeout(() => { this.$message.success('配置已在新窗口中打开')
this.success = ''
}, 3000)
this.$message.success('配置已在新窗口中打开')
}, },
/** /**
@ -970,13 +974,15 @@ Now please generate the exam configuration based on the above rules:`
*/ */
onConfigDeleted(result) { onConfigDeleted(result) {
if (result.success) { if (result.success) {
this.success = result.message || "配置删除成功"
this.$message.success(result.message || "配置删除成功")
// //
this.editDialog = false this.editDialog = false
// //
this.loadConfigs() this.loadConfigs()
} else { } else {
this.error = result.message || "删除失败"
this.$message.error(result.message || "删除失败")
} }
}, },