Skip to content

Commit

Permalink
fix: 修改新增题目优化验收问题 (#449)
Browse files Browse the repository at this point in the history
* feat: 新增题目优化

* feat: 新增题目优化

* feat: 新增题目优化

* feat: 新增题目优化

* fix: 修改新增题目优化验收问题
  • Loading branch information
Liang-Yaxin authored Dec 9, 2024
1 parent b53b6fb commit 770f86d
Showing 1 changed file with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ 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('')
Expand All @@ -66,14 +67,18 @@ questionLoader.init({
})
const onQuestionType = ({ type }) => {
const newQuestion = createNewQuestion({ type })
addQuestion({ question: newQuestion, index: newQuestionIndex.value })
hasSetCurrentEditOne(newQuestionIndex.value)
}
const onDragEnd = (event) => {
hasSetCurrentEditOne(event.newIndex)
}
const newQuestion = createNewQuestion({ type });
addQuestion({ question: newQuestion, index: newQuestionIndex.value });
const { endIndex } = getSorter();
setTimeout(() => {
setCurrentEditOne(endIndex - 1);
});
};
const onDragEnd = (event) => {
const { startIndex } = getSorter();
setCurrentEditOne(schema.pageEditOne === 1 ? event.newIndex : startIndex + event.newIndex);
};
const showPreview = ({ snapshot }, id) => {
previewImg.value = snapshot
Expand Down

0 comments on commit 770f86d

Please sign in to comment.