diff --git a/src/components/teacher/CompositeQuestion.vue b/src/components/teacher/CompositeQuestion.vue new file mode 100644 index 0000000..67462d3 --- /dev/null +++ b/src/components/teacher/CompositeQuestion.vue @@ -0,0 +1,394 @@ + + + + + + + 题目内容 + + + $emit('update:title', value)" + type="textarea" + placeholder="请输入题目内容或阅读材料..." + :rows="6" + show-count + maxlength="2000" + /> + + + + + + + + + 小题目 + + 添加小题 + + + + + + 请至少添加一道小题 + + + + + + + + 第{{ index + 1 }}题 + + 选择题型: + updateSubQuestionType(index, value)" + :options="questionTypeOptions" + placeholder="选择题型" + style="width: 150px; margin-left: 12px;" + /> + + + 分值: + updateSubQuestionScore(index, value)" + :min="0.5" + :max="100" + :step="0.5" + size="small" + /> + + + + 删除 + + + + + + updateSubQuestionTitle(index, value)" + :model-value="subQuestion.data" + @update:model-value="(value: any) => updateSubQuestionData(index, value)" + :correct-answer="subQuestion.correctAnswer" + @update:correct-answer="(value: any) => updateSubQuestionCorrectAnswer(index, value)" + :correct-answers="subQuestion.correctAnswers" + @update:correct-answers="(value: any) => updateSubQuestionCorrectAnswers(index, value)" + :answer="subQuestion.answer" + @update:answer="(value: any) => updateSubQuestionAnswer(index, value)" + :answers="subQuestion.answers" + @update:answers="(value: any) => updateSubQuestionAnswers(index, value)" + :explanation="subQuestion.explanation" + @update:explanation="(value: string) => updateSubQuestionExplanation(index, value)" + /> + + + + + + 添加小题 + + + + + + + + + diff --git a/src/components/teacher/FillBlankQuestion.vue b/src/components/teacher/FillBlankQuestion.vue new file mode 100644 index 0000000..251e3d0 --- /dev/null +++ b/src/components/teacher/FillBlankQuestion.vue @@ -0,0 +1,280 @@ + + + + + + + 题目内容 + + + $emit('update:title', value)" + type="textarea" + placeholder="请输入题目内容..." + :rows="4" + show-count + maxlength="500" + /> + + + + + + + + 填空答案 + + + + + {{ index + 1 }}. + 请输入答案 + + + handleUpdateAnswer(index, 'content', value)" + placeholder="请输入答案内容" show-count maxlength="100" class="answer-input" /> + + + 得分: + handleUpdateAnswer(index, 'score', value || 0)" + :min="0" :max="100" :step="0.5" :precision="1" size="small" /> + + + 区分大小写: + handleUpdateAnswer(index, 'caseSensitive', value === '区分')" + :options="caseOptions" size="small" class="case-select" /> + + + 删除 + + + + + + + 添加填空 + + + + + + + + + 答案解析 + + + $emit('update:explanation', value)" + type="textarea" + placeholder="请输入答案解析..." + :rows="3" + show-count + maxlength="300" + /> + + + + + + + + + diff --git a/src/components/teacher/MultipleChoiceQuestion.vue b/src/components/teacher/MultipleChoiceQuestion.vue new file mode 100644 index 0000000..e6d4bec --- /dev/null +++ b/src/components/teacher/MultipleChoiceQuestion.vue @@ -0,0 +1,260 @@ + + + + + + + 题目内容 + + + $emit('update:title', value)" + type="textarea" + placeholder="请输入题目内容..." + :rows="4" + show-count + maxlength="500" + /> + + + + + + + + 选择答案 + + + + + + handleToggleCorrectAnswer(index, checked)" + class="correct-checkbox" + /> + {{ String.fromCharCode(65 + index) }} + + handleUpdateOption(index, value)" + placeholder="请输入内容" + show-count + maxlength="200" + class="option-input" + /> + + 删除 + + + + + + 添加选项 + + + + + + + + + 答案解析 + + + $emit('update:explanation', value)" + type="textarea" + placeholder="请输入答案解析..." + :rows="3" + show-count + maxlength="300" + /> + + + + + + + + + diff --git a/src/components/teacher/QuestionTypeContainer.vue b/src/components/teacher/QuestionTypeContainer.vue new file mode 100644 index 0000000..06c1417 --- /dev/null +++ b/src/components/teacher/QuestionTypeContainer.vue @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + {{ questionType }} 题型正在开发中... + + + + + + + diff --git a/src/components/teacher/ShortAnswerQuestion.vue b/src/components/teacher/ShortAnswerQuestion.vue new file mode 100644 index 0000000..c454be7 --- /dev/null +++ b/src/components/teacher/ShortAnswerQuestion.vue @@ -0,0 +1,132 @@ + + + + + + + 题目内容 + + + $emit('update:title', value)" + type="textarea" + placeholder="请输入题目内容..." + :rows="4" + show-count + maxlength="500" + /> + + + + + + + + 参考答案 + + + $emit('update:modelValue', value)" + type="textarea" + placeholder="请输入简答题的参考答案..." + :rows="6" + show-count + maxlength="1000" + class="answer-textarea" + /> + + + 请输入详细的参考答案,可作为评分依据 + + + + + + + + + + 答案解析 + + + $emit('update:explanation', value)" + type="textarea" + placeholder="请输入答案解析..." + :rows="3" + show-count + maxlength="300" + /> + + + + + + + + + diff --git a/src/components/teacher/SingleChoiceQuestion.vue b/src/components/teacher/SingleChoiceQuestion.vue new file mode 100644 index 0000000..4ceb0c3 --- /dev/null +++ b/src/components/teacher/SingleChoiceQuestion.vue @@ -0,0 +1,239 @@ + + + + + + + 题目内容 + + + $emit('update:title', value)" + type="textarea" + placeholder="请输入题目内容..." + :rows="4" + show-count + maxlength="500" + /> + + + + + + + + 选择答案 + + + + + + handleSetCorrectAnswer(index)" name="correct-answer" + class="correct-radio" /> + {{ String.fromCharCode(65 + index) }} + + handleUpdateOption(index, value)" placeholder="请输入内容" + show-count maxlength="200" class="option-input" /> + + 删除 + + + + + + 添加选项 + + + + + + + + + 答案解析 + + + $emit('update:explanation', value)" + type="textarea" + placeholder="请输入答案解析..." + :rows="3" + show-count + maxlength="300" + /> + + + + + + + + + diff --git a/src/components/teacher/TrueFalseQuestion.vue b/src/components/teacher/TrueFalseQuestion.vue new file mode 100644 index 0000000..6254d52 --- /dev/null +++ b/src/components/teacher/TrueFalseQuestion.vue @@ -0,0 +1,194 @@ + + + + + + + 题目内容 + + + $emit('update:title', value)" + type="textarea" + placeholder="请输入题目内容..." + :rows="4" + show-count + maxlength="500" + /> + + + + + + + + 选择答案 + + + + + + handleSetAnswer(true)" + :name="radioName" + class="correct-radio" + /> + A + + 对 + + + + + + + handleSetAnswer(false)" + :name="radioName" + class="correct-radio" + /> + B + + 错 + + + + + + + + + + 答案解析 + + + $emit('update:explanation', value)" + type="textarea" + placeholder="请输入答案解析..." + :rows="3" + show-count + maxlength="300" + /> + + + + + + + + + diff --git a/src/router/index.ts b/src/router/index.ts index e51629a..4b9ebe5 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -61,6 +61,7 @@ import QuestionManagement from '@/views/teacher/ExamPages/QuestionManagement.vue import ExamLibrary from '@/views/teacher/ExamPages/ExamLibrary.vue' import MarkingCenter from '@/views/teacher/ExamPages/MarkingCenter.vue' import AddExam from '@/views/teacher/ExamPages/AddExam.vue' +import AddQuestion from '@/views/teacher/ExamPages/AddQuestion.vue' import ChapterEditor from '@/views/teacher/course/ChapterEditor.vue' @@ -267,6 +268,12 @@ const routes: RouteRecordRaw[] = [ name: 'AddExam', component: AddExam, meta: { title: '添加试卷' } + }, + { + path: 'add-question/:id?', + name: 'AddQuestionPage', + component: AddQuestion, + meta: { title: '添加试题' } } ] }, diff --git a/src/views/teacher/AdminDashboard.vue b/src/views/teacher/AdminDashboard.vue index 5727b13..af0eba3 100644 --- a/src/views/teacher/AdminDashboard.vue +++ b/src/views/teacher/AdminDashboard.vue @@ -498,6 +498,14 @@ const updateActiveNavItem = () => { activeNavItem.value = 2; // 我的资源 } else if (path.includes('personal-center')) { activeNavItem.value = 3; // 个人中心 + } else if (path.includes('exam-management')) { + activeNavItem.value = 4; // 考试管理 + examMenuExpanded.value = true; + + // 获取路由的最后一层路径(不包含/) + const pathSegments = path.split('/'); + const lastSegment = pathSegments[pathSegments.length - 1]; + activeSubNavItem.value = lastSegment || ''; } } diff --git a/src/views/teacher/ExamPages/AddQuestion.vue b/src/views/teacher/ExamPages/AddQuestion.vue new file mode 100644 index 0000000..824eb0d --- /dev/null +++ b/src/views/teacher/ExamPages/AddQuestion.vue @@ -0,0 +1,1382 @@ + + + + + + + + + + + + {{ isEditMode ? '编辑试题' : '添加试题' }} + + + 取消 + + {{ saving ? (isEditMode ? '更新中...' : '保存中...') : (isEditMode ? '更新试题' : '保存试题') }} + + + + + + + + + + + + + 题库类型: + + {{ option.label }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 题目预览 + + + + + + + + + 1. + {{ questionForm.title || '请输入题目内容...' }} + + + + + + {{ String.fromCharCode(65 + index) }} + {{ option.content || '请输入内容' }} + + + + + + + {{ String.fromCharCode(65 + index) }} + {{ option.content || '请输入内容' }} + + + + + + + A + 对 + + + B + 错 + + + + + + + {{ index + 1 }}. + + {{ answer.content || '请输入答案' }} + ({{ answer.score }}分) + 区分大小写 + + + + + + + 参考答案: + + {{ questionForm.shortAnswer || '请输入参考答案' }} + + + + + + + 请添加小题 + + + + + {{ index + 1 }}. + {{ subQuestion.title || '请输入小题内容...' }} + [{{ getQuestionTypeLabel(subQuestion.type) }}] + ({{ subQuestion.score }}分) + + + + + + {{ String.fromCharCode(65 + optIndex) }} + {{ option.option || '请输入内容' }} + + + + + + {{ String.fromCharCode(65 + optIndex) }} + {{ option.option || '请输入内容' }} + + + + + + A + 对 + + + B + 错 + + + + + + {{ answerIndex + 1 }}. + + {{ answer.value || '请输入答案' }} + ({{ answer.score }}分) + 区分大小写 + + + + + + 参考答案: + + {{ subQuestion.data || '请输入参考答案' }} + + + + + + 解析: + {{ subQuestion.explanation }} + + + + + + + + 答案解析: + {{ questionForm.explanation }} + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/views/teacher/ExamPages/QuestionManagement.vue b/src/views/teacher/ExamPages/QuestionManagement.vue index 579dfe1..db7de6e 100644 --- a/src/views/teacher/ExamPages/QuestionManagement.vue +++ b/src/views/teacher/ExamPages/QuestionManagement.vue @@ -7,10 +7,11 @@ 导入 导出 删除 + 分类设置 @@ -45,14 +46,135 @@ @success="handleImportSuccess" @template-download="handleTemplateDownload" /> + + + + + + + 已选择 {{ selectedRowKeys.length }} 个试题 + + + + + + 选择分类: + + + + + 新分类名称: + + + + 添加 + + + + + + + + + + {{ showAddCategoryInput ? '取消新增' : '新增分类' }} + + 取消 + + 确认设置 + + + + + + + + + + + + 新增分类 + + + + + + + + + 添加 + + + 取消 + + + + + + + + + {{ category.label }} + + + 编辑 + + + 删除 + + + + + + + + + + + 关闭 + + + diff --git a/src/views/teacher/course/ExamPages/ExamLibrary.vue b/src/views/teacher/course/ExamPages/ExamLibrary.vue deleted file mode 100644 index 87a6f2f..0000000 --- a/src/views/teacher/course/ExamPages/ExamLibrary.vue +++ /dev/null @@ -1,210 +0,0 @@ - - - - - 试卷库 - - 添加试卷 - 导入 - 导出 - 删除 - - 搜索 - - - - - - - - - - - - - - - diff --git a/src/views/teacher/course/ExamPages/MarkingCenter.vue b/src/views/teacher/course/ExamPages/MarkingCenter.vue deleted file mode 100644 index eb2fad6..0000000 --- a/src/views/teacher/course/ExamPages/MarkingCenter.vue +++ /dev/null @@ -1,11 +0,0 @@ - - - 阅卷中心 - - - - - -
{{ questionType }} 题型正在开发中...