fix: 修改新增题目优化验收问题

This commit is contained in:
梁亚鑫 2024-11-01 20:27:50 +08:00
parent 912c4dae83
commit e44184148f
2 changed files with 13 additions and 16 deletions

View File

@ -53,8 +53,8 @@ import { useEditStore } from '@/management/stores/edit'
import { ref } from 'vue'
const editStore = useEditStore()
const { newQuestionIndex } = storeToRefs(editStore)
const { addQuestion, hasSetCurrentEditOne, createNewQuestion } = editStore
const { newQuestionIndex, schema } = storeToRefs(editStore)
const { addQuestion, setCurrentEditOne, getSorter, createNewQuestion } = editStore
const activeNames = ref([0, 1])
const previewImg = ref('')
@ -66,14 +66,18 @@ questionLoader.init({
})
const onQuestionType = ({ type }) => {
const newQuestion = createNewQuestion({ type })
addQuestion({ question: newQuestion, index: newQuestionIndex.value })
hasSetCurrentEditOne(newQuestionIndex.value)
}
const newQuestion = createNewQuestion({ type });
addQuestion({ question: newQuestion, index: newQuestionIndex.value });
const { endIndex } = getSorter();
setTimeout(() => {
setCurrentEditOne(endIndex - 1);
});
};
const onDragEnd = (event) => {
hasSetCurrentEditOne(event.newIndex)
}
const onDragEnd = (event) => {
const { startIndex } = getSorter();
setCurrentEditOne(schema.pageEditOne === 1 ? event.newIndex : startIndex + event.newIndex);
};
const showPreview = ({ snapshot }, id) => {
previewImg.value = snapshot

View File

@ -170,12 +170,6 @@ export const useEditStore = defineStore('edit', () => {
}
})
const hasSetCurrentEditOne = (value: number) => {
if(!currentEditOne.value) {
setCurrentEditOne(value)
}
}
// 题目操作:增删改
const { copyQuestion, addQuestion, deleteQuestion, moveQuestion } = useQuestionData({
questionDataList,
@ -200,7 +194,6 @@ export const useEditStore = defineStore('edit', () => {
currentEditMeta,
newQuestionIndex,
setCurrentEditOne,
hasSetCurrentEditOne,
changeCurrentEditStatus,
pageEditOne,