feat: 新增题目导入服务并优化用户端答题流程

- 新增 question-importer 服务,支持从 JSON 文件批量导入题目到题库
- 重构用户端答题流程,整合抽题、答题、结果分析页面状态管理
- 将题目分类从 UI 模板类型切换为业务分类(question_category_name)
- 在题库管理页面支持题目批量选择和删除功能
- 优化用户端组别选择,增加“已结束”状态提示和禁用逻辑
- 修复题目新增/更新 API 请求参数格式问题
- 为富文本编辑器配置排除不必要的工具栏按键
This commit is contained in:
2026-02-11 17:27:08 +08:00
parent 61a7412fc1
commit f3136cd9ad
34 changed files with 4154 additions and 225 deletions

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
import { onBeforeUnmount, shallowRef } from 'vue'
import { nextTick, onBeforeUnmount, onMounted, shallowRef } from 'vue'
import { getAliOssTokenAxios } from '@/service/api/upload'
import { browserPathJoin } from '@/utils/date'
import { initOSSClient, uploadFileToOSS } from '@/utils/oss'
@ -12,6 +12,7 @@ interface Props {
mode?: 'default' | 'simple'
height?: string
path?: string
excludeKeys?: string[]
}
const props = withDefaults(defineProps<Props>(), {
@ -20,6 +21,7 @@ const props = withDefaults(defineProps<Props>(), {
mode: 'default',
height: '300px',
path: 'temp',
excludeKeys: () => [],
})
const emit = defineEmits(['update:modelValue'])
@ -27,7 +29,7 @@ const emit = defineEmits(['update:modelValue'])
// Editor Logic
const editorRef = shallowRef()
const toolbarConfig = {
excludeKeys: [],
excludeKeys: props.excludeKeys || [],
}
type InsertFnType = (url: string, alt: string, href: string) => void
@ -71,9 +73,19 @@ const editorConfig = {
// // 似乎 wangeditor 不支持动态修改 placeholder这里作为占位
// }
// })
onMounted(() => {
// eslint-disable-next-line no-console
console.log(toolbarConfig, 'toolbarConfig')
nextTick(() => {
// eslint-disable-next-line no-console
console.log(editorRef.value)
})
})
function handleCreated(editor: any) {
editorRef.value = editor
// eslint-disable-next-line no-console
console.log('Toolbar keys:', editor.getAllMenuKeys())
}
function handleChange(editor: any) {