fix: 修改新增题目优化验收问题
This commit is contained in:
parent
912c4dae83
commit
e44184148f
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user