|
@@ -17,7 +17,7 @@
|
|
|
<swiper class="h-full" :disable-touch="false" :current="currentIndex" :duration="swiperDuration"
|
|
<swiper class="h-full" :disable-touch="false" :current="currentIndex" :duration="swiperDuration"
|
|
|
@change="handleSwiperChange" @transition="handleSwiperTransition"
|
|
@change="handleSwiperChange" @transition="handleSwiperTransition"
|
|
|
@animationfinish="handleSwiperAnimationFinish">
|
|
@animationfinish="handleSwiperAnimationFinish">
|
|
|
- <swiper-item class="h-full" v-for="(item, index) in stateQuestionList" :key="index">
|
|
|
|
|
|
|
+ <swiper-item class="h-full" v-for="(item, index) in questionList" :key="index">
|
|
|
<question-wrap :question="item" @update:question="handleUpdateQuestion" />
|
|
<question-wrap :question="item" @update:question="handleUpdateQuestion" />
|
|
|
</swiper-item>
|
|
</swiper-item>
|
|
|
</swiper>
|
|
</swiper>
|
|
@@ -188,7 +188,7 @@ const beforeQuit = () => {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
const currentQuestion = computed(() => {
|
|
const currentQuestion = computed(() => {
|
|
|
- return stateQuestionList.value[currentIndex.value] || {};
|
|
|
|
|
|
|
+ return questionList.value[currentIndex.value] || {};
|
|
|
});
|
|
});
|
|
|
const hanadleNavigate = (index: number) => {
|
|
const hanadleNavigate = (index: number) => {
|
|
|
changeIndex(index);
|
|
changeIndex(index);
|
|
@@ -219,7 +219,7 @@ const handleCalendar = () => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const handleSwiperTransition = (e: any) => {
|
|
const handleSwiperTransition = (e: any) => {
|
|
|
- if (currentIndex.value === stateQuestionList.value.length - 1) {
|
|
|
|
|
|
|
+ if (currentIndex.value === questionList.value.length - 1) {
|
|
|
if (!transitionStartX.value) {
|
|
if (!transitionStartX.value) {
|
|
|
transitionStartX.value = e.detail.dx;
|
|
transitionStartX.value = e.detail.dx;
|
|
|
} else {
|
|
} else {
|
|
@@ -238,7 +238,7 @@ const stopTime = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const handleSwiperAnimationFinish = (e: any) => {
|
|
const handleSwiperAnimationFinish = (e: any) => {
|
|
|
- if (transitionStartX.value == null || transitionEndX.value == null || currentIndex.value !== stateQuestionList.value.length - 1) {
|
|
|
|
|
|
|
+ if (transitionStartX.value == null || transitionEndX.value == null || currentIndex.value !== questionList.value.length - 1) {
|
|
|
isAnimationFinish.value = true;
|
|
isAnimationFinish.value = true;
|
|
|
transitionStartX.value = null;
|
|
transitionStartX.value = null;
|
|
|
transitionEndX.value = null;
|
|
transitionEndX.value = null;
|
|
@@ -297,14 +297,14 @@ const autoSubmit = () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const handleSubmit = (tempSave: boolean = false) => {
|
|
const handleSubmit = (tempSave: boolean = false) => {
|
|
|
- console.log('handleSubmit', stateQuestionList.value)
|
|
|
|
|
|
|
+ console.log('handleSubmit', questionList.value)
|
|
|
const msg = tempSave ? '保存中...' : '提交中...';
|
|
const msg = tempSave ? '保存中...' : '提交中...';
|
|
|
uni.$ie.showLoading(msg);
|
|
uni.$ie.showLoading(msg);
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
uni.$ie.hideLoading();
|
|
uni.$ie.hideLoading();
|
|
|
const params = {
|
|
const params = {
|
|
|
...paperData.value,
|
|
...paperData.value,
|
|
|
- questions: stateQuestionList.value.map(item => {
|
|
|
|
|
|
|
+ questions: questionList.value.map(item => {
|
|
|
return {
|
|
return {
|
|
|
...item,
|
|
...item,
|
|
|
isDone: tempSave ? item.isDone : true
|
|
isDone: tempSave ? item.isDone : true
|
|
@@ -321,7 +321,7 @@ const handleSubmit = (tempSave: boolean = false) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const handleUpdateQuestion = (question: Study.Question) => {
|
|
const handleUpdateQuestion = (question: Study.Question) => {
|
|
|
- if (currentIndex.value === stateQuestionList.value.length - 1) {
|
|
|
|
|
|
|
+ if (currentIndex.value === questionList.value.length - 1) {
|
|
|
autoSubmit();
|
|
autoSubmit();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|