fix: 修改新增题目优化验收问题
This commit is contained in:
parent
912c4dae83
commit
e44184148f
@ -53,8 +53,8 @@ import { useEditStore } from '@/management/stores/edit'
|
|||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const editStore = useEditStore()
|
const editStore = useEditStore()
|
||||||
const { newQuestionIndex } = storeToRefs(editStore)
|
const { newQuestionIndex, schema } = storeToRefs(editStore)
|
||||||
const { addQuestion, hasSetCurrentEditOne, createNewQuestion } = editStore
|
const { addQuestion, setCurrentEditOne, getSorter, createNewQuestion } = editStore
|
||||||
|
|
||||||
const activeNames = ref([0, 1])
|
const activeNames = ref([0, 1])
|
||||||
const previewImg = ref('')
|
const previewImg = ref('')
|
||||||
@ -66,14 +66,18 @@ questionLoader.init({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const onQuestionType = ({ type }) => {
|
const onQuestionType = ({ type }) => {
|
||||||
const newQuestion = createNewQuestion({ type })
|
const newQuestion = createNewQuestion({ type });
|
||||||
addQuestion({ question: newQuestion, index: newQuestionIndex.value })
|
addQuestion({ question: newQuestion, index: newQuestionIndex.value });
|
||||||
hasSetCurrentEditOne(newQuestionIndex.value)
|
const { endIndex } = getSorter();
|
||||||
}
|
setTimeout(() => {
|
||||||
|
setCurrentEditOne(endIndex - 1);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const onDragEnd = (event) => {
|
const onDragEnd = (event) => {
|
||||||
hasSetCurrentEditOne(event.newIndex)
|
const { startIndex } = getSorter();
|
||||||
}
|
setCurrentEditOne(schema.pageEditOne === 1 ? event.newIndex : startIndex + event.newIndex);
|
||||||
|
};
|
||||||
|
|
||||||
const showPreview = ({ snapshot }, id) => {
|
const showPreview = ({ snapshot }, id) => {
|
||||||
previewImg.value = snapshot
|
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({
|
const { copyQuestion, addQuestion, deleteQuestion, moveQuestion } = useQuestionData({
|
||||||
questionDataList,
|
questionDataList,
|
||||||
@ -200,7 +194,6 @@ export const useEditStore = defineStore('edit', () => {
|
|||||||
currentEditMeta,
|
currentEditMeta,
|
||||||
newQuestionIndex,
|
newQuestionIndex,
|
||||||
setCurrentEditOne,
|
setCurrentEditOne,
|
||||||
hasSetCurrentEditOne,
|
|
||||||
changeCurrentEditStatus,
|
changeCurrentEditStatus,
|
||||||
|
|
||||||
pageEditOne,
|
pageEditOne,
|
||||||
|
Loading…
Reference in New Issue
Block a user