|
@@ -287,6 +287,12 @@ export const useExam = () => {
|
|
|
if (!nextEnable.value) {
|
|
if (!nextEnable.value) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ // if (currentIndex.value < questionList.value.length - 1) {
|
|
|
|
|
+ // currentIndex.value++;
|
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
|
+ // subQuestionIndex.value = 0;
|
|
|
|
|
+ // }, 300);
|
|
|
|
|
+ // }
|
|
|
if (currentQuestion.value.subQuestions && currentQuestion.value.subQuestions.length > 0) {
|
|
if (currentQuestion.value.subQuestions && currentQuestion.value.subQuestions.length > 0) {
|
|
|
if (subQuestionIndex.value < currentQuestion.value.subQuestions.length - 1) {
|
|
if (subQuestionIndex.value < currentQuestion.value.subQuestions.length - 1) {
|
|
|
subQuestionIndex.value++;
|
|
subQuestionIndex.value++;
|
|
@@ -295,9 +301,7 @@ export const useExam = () => {
|
|
|
subQuestionIndex.value = 0;
|
|
subQuestionIndex.value = 0;
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- if (currentIndex.value < questionList.value.length - 1) {
|
|
|
|
|
- currentIndex.value++;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ currentIndex.value++;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 上一题
|
|
// 上一题
|
|
@@ -305,26 +309,32 @@ export const useExam = () => {
|
|
|
if (!prevEnable.value) {
|
|
if (!prevEnable.value) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- if (currentQuestion.value.subQuestions && currentQuestion.value.subQuestions.length > 0) {
|
|
|
|
|
- if (subQuestionIndex.value > 0) {
|
|
|
|
|
- subQuestionIndex.value--;
|
|
|
|
|
- } else {
|
|
|
|
|
- currentIndex.value--;
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- if (currentIndex.value > 0) {
|
|
|
|
|
- currentIndex.value--;
|
|
|
|
|
- // 如果上一个题是子题,那么,默认选中最后一个子题
|
|
|
|
|
- const prevQuestion = questionList.value[currentIndex.value - 1];
|
|
|
|
|
- if (prevQuestion.subQuestions && prevQuestion.subQuestions.length > 0) {
|
|
|
|
|
- subQuestionIndex.value = prevQuestion.subQuestions.length - 1;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (currentIndex.value > 0) {
|
|
|
|
|
+ currentIndex.value--;
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ subQuestionIndex.value = 0;
|
|
|
|
|
+ }, 300);
|
|
|
}
|
|
}
|
|
|
|
|
+ // if (currentQuestion.value.subQuestions && currentQuestion.value.subQuestions.length > 0) {
|
|
|
|
|
+ // if (subQuestionIndex.value > 0) {
|
|
|
|
|
+ // subQuestionIndex.value--;
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // currentIndex.value--;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // if (currentIndex.value > 0) {
|
|
|
|
|
+ // currentIndex.value--;
|
|
|
|
|
+ // // 如果上一个题是子题,那么,默认选中最后一个子题
|
|
|
|
|
+ // const prevQuestion = questionList.value[currentIndex.value - 1];
|
|
|
|
|
+ // if (prevQuestion.subQuestions && prevQuestion.subQuestions.length > 0) {
|
|
|
|
|
+ // subQuestionIndex.value = prevQuestion.subQuestions.length - 1;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
}
|
|
}
|
|
|
// 快速下一题
|
|
// 快速下一题
|
|
|
const nextQuestionQuickly = () => {
|
|
const nextQuestionQuickly = () => {
|
|
|
- if (currentIndex.value >= questionList.value.length - 1) {
|
|
|
|
|
|
|
+ if (!nextEnable.value) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
swiperDuration.value = 0;
|
|
swiperDuration.value = 0;
|
|
@@ -337,7 +347,7 @@ export const useExam = () => {
|
|
|
}
|
|
}
|
|
|
// 快速上一题
|
|
// 快速上一题
|
|
|
const prevQuestionQuickly = () => {
|
|
const prevQuestionQuickly = () => {
|
|
|
- if (currentIndex.value <= 0) {
|
|
|
|
|
|
|
+ if (!prevEnable.value) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
swiperDuration.value = 0;
|
|
swiperDuration.value = 0;
|
|
@@ -349,10 +359,13 @@ export const useExam = () => {
|
|
|
}, 0);
|
|
}, 0);
|
|
|
}
|
|
}
|
|
|
// 通过下标切换题目
|
|
// 通过下标切换题目
|
|
|
- const changeIndex = (index: number) => {
|
|
|
|
|
|
|
+ const changeIndex = (index: number, subIndex?: number) => {
|
|
|
swiperDuration.value = 0;
|
|
swiperDuration.value = 0;
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
currentIndex.value = index;
|
|
currentIndex.value = index;
|
|
|
|
|
+ if (!subIndex !== undefined) {
|
|
|
|
|
+ subQuestionIndex.value = subIndex || 0;
|
|
|
|
|
+ }
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
swiperDuration.value = 300;
|
|
swiperDuration.value = 300;
|
|
|
}, 0);
|
|
}, 0);
|