|
|
@@ -153,7 +153,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
- import { ref, reactive, computed, onMounted, defineAsyncComponent, shallowRef } from 'vue'
|
|
|
+ import { ref, reactive, computed, onMounted, shallowRef } from 'vue'
|
|
|
+ import SingleChoice from './edit/single-choice.vue'
|
|
|
+ import MultipleChoice from './edit/multiple-choice.vue'
|
|
|
+ import TrueFalse from './edit/true-false.vue'
|
|
|
+ import GapFilling from './edit/gap-filling.vue'
|
|
|
+ import ShortAnswer from './edit/short-answer.vue'
|
|
|
import { useExamStore } from '@/store/exam'
|
|
|
import tQuestionApi from '@/api/exam/question/tQuestionApi'
|
|
|
import customPagination from '@/components/customPagination.vue'
|
|
|
@@ -194,9 +199,16 @@
|
|
|
// 动态抽屉相关
|
|
|
const drawerOpen = ref(false)
|
|
|
const currentComponent = shallowRef(null)
|
|
|
- const openDrawer = (componentPath) => {
|
|
|
+ const componentMap = {
|
|
|
+ 'single-choice': SingleChoice,
|
|
|
+ 'multiple-choice': MultipleChoice,
|
|
|
+ 'true-false': TrueFalse,
|
|
|
+ 'gap-filling': GapFilling,
|
|
|
+ 'short-answer': ShortAnswer
|
|
|
+ }
|
|
|
+ const openDrawer = (componentName) => {
|
|
|
currentComponentId.value = 0
|
|
|
- currentComponent.value = defineAsyncComponent(() => import(/* @vite-ignore */ componentPath))
|
|
|
+ currentComponent.value = componentMap[componentName]
|
|
|
drawerOpen.value = true
|
|
|
}
|
|
|
const closeDrawer = () => {
|
|
|
@@ -262,8 +274,8 @@
|
|
|
}
|
|
|
|
|
|
const editQuestion = (row) => {
|
|
|
- const url = enumFormat(editUrlEnum.value, row.questionType)
|
|
|
- currentComponent.value = defineAsyncComponent(() => import(/* @vite-ignore */ url))
|
|
|
+ const componentName = enumFormat(editUrlEnum.value, row.questionType)
|
|
|
+ currentComponent.value = componentMap[componentName]
|
|
|
drawerOpen.value = true
|
|
|
currentComponentId.value = row.id
|
|
|
}
|