初步添加ea2

This commit is contained in:
SunWuyuan
2025-10-12 08:32:54 +08:00
parent 0dceb0c278
commit b9efaee7ee
13 changed files with 454 additions and 8 deletions
+79
View File
@@ -0,0 +1,79 @@
<template>
<v-container class="pa-0">
<v-app-bar elevation="1">
<template #prepend>
<v-btn
icon="mdi-arrow-left"
variant="text"
@click="$router.back()"
/>
</template>
<v-app-bar-title class="text-h6">
编辑考试配置
</v-app-bar-title>
<v-spacer />
<v-btn
color="success"
variant="outlined"
prepend-icon="mdi-content-save"
:loading="saving"
@click="save"
>
保存
</v-btn>
</v-app-bar>
<v-container
class="py-4"
style="max-width: 1200px"
>
<ExamConfigEditor
v-if="id"
ref="editor"
:config-id="id"
@saved="onSaved"
@error="onError"
/>
</v-container>
</v-container>
</template>
<script>
import ExamConfigEditor from '@/components/ExamConfigEditor.vue'
export default {
name: 'ExamEditorPage',
components: { ExamConfigEditor },
data() {
return {
id: this.$route.params.id,
saving: false,
}
},
watch: {
'$route.params.id'(val) {
this.id = val
}
},
methods: {
async save() {
if (!this.$refs.editor) return
this.saving = true
try {
await this.$refs.editor.saveConfig()
} finally {
this.saving = false
}
},
onSaved() {
// 轻提示
this.$toast?.success?.('保存成功')
},
onError(msg) {
this.$toast?.error?.(msg || '保存失败')
}
}
}
</script>
<style scoped></style>