|
@@ -395,8 +395,9 @@ const _sfc_main = {
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
- if (this.showResult)
|
|
|
- return;
|
|
|
+ if (this.showResult) {
|
|
|
+ this.showResult = false;
|
|
|
+ }
|
|
|
console.log("selectOption", index);
|
|
|
if (this.currentQuestion.questionType === 2) {
|
|
|
const optionIndex = this.selectedOptions.indexOf(index);
|
|
@@ -413,12 +414,22 @@ const _sfc_main = {
|
|
|
this.saveAnswer();
|
|
|
this.submitCurrentAnswer().then(() => {
|
|
|
setTimeout(() => {
|
|
|
- this.goToNextQuestion();
|
|
|
+ if (this.currentQuestionIndex < this.answers.length - 1) {
|
|
|
+ this.currentQuestionIndex++;
|
|
|
+ this.currentScrollId = "question-" + this.currentQuestionIndex;
|
|
|
+ } else {
|
|
|
+ this.goToNextQuestion();
|
|
|
+ }
|
|
|
}, 800);
|
|
|
}).catch((error) => {
|
|
|
console.error("提交答案失败:", error);
|
|
|
setTimeout(() => {
|
|
|
- this.goToNextQuestion();
|
|
|
+ if (this.currentQuestionIndex < this.answers.length - 1) {
|
|
|
+ this.currentQuestionIndex++;
|
|
|
+ this.currentScrollId = "question-" + this.currentQuestionIndex;
|
|
|
+ } else {
|
|
|
+ this.goToNextQuestion();
|
|
|
+ }
|
|
|
}, 1e3);
|
|
|
});
|
|
|
}, 500);
|
|
@@ -441,12 +452,22 @@ const _sfc_main = {
|
|
|
this.saveAnswer();
|
|
|
this.submitCurrentAnswer().then(() => {
|
|
|
setTimeout(() => {
|
|
|
- this.goToNextQuestion();
|
|
|
+ if (this.currentQuestionIndex < this.answers.length - 1) {
|
|
|
+ this.currentQuestionIndex++;
|
|
|
+ this.currentScrollId = "question-" + this.currentQuestionIndex;
|
|
|
+ } else {
|
|
|
+ this.goToNextQuestion();
|
|
|
+ }
|
|
|
}, 800);
|
|
|
}).catch((error) => {
|
|
|
console.error("提交答案失败:", error);
|
|
|
setTimeout(() => {
|
|
|
- this.goToNextQuestion();
|
|
|
+ if (this.currentQuestionIndex < this.answers.length - 1) {
|
|
|
+ this.currentQuestionIndex++;
|
|
|
+ this.currentScrollId = "question-" + this.currentQuestionIndex;
|
|
|
+ } else {
|
|
|
+ this.goToNextQuestion();
|
|
|
+ }
|
|
|
}, 1e3);
|
|
|
});
|
|
|
}, 500);
|
|
@@ -645,12 +666,7 @@ const _sfc_main = {
|
|
|
},
|
|
|
// 修改 handleOptionClick 方法
|
|
|
handleOptionClick(qIndex, index) {
|
|
|
- if (qIndex < this.currentQuestionIndex) {
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: "该题目已完成,无法修改",
|
|
|
- icon: "none",
|
|
|
- duration: 2e3
|
|
|
- });
|
|
|
+ if (qIndex < this.currentQuestionIndex - 1) {
|
|
|
return;
|
|
|
}
|
|
|
if (qIndex === this.questions.length - 1 && this.showContinueButton) {
|
|
@@ -679,6 +695,13 @@ const _sfc_main = {
|
|
|
clearTimeout(this._clickTimer);
|
|
|
}
|
|
|
try {
|
|
|
+ if (qIndex === this.currentQuestionIndex - 1) {
|
|
|
+ this.currentQuestionIndex = qIndex;
|
|
|
+ this.currentScrollId = "question-" + qIndex;
|
|
|
+ this.showResult = false;
|
|
|
+ this.selectedOption = null;
|
|
|
+ this.selectedOptions = [];
|
|
|
+ }
|
|
|
this.selectOption(index);
|
|
|
this._clickTimer = setTimeout(() => {
|
|
|
this._isClicking = false;
|
|
@@ -787,9 +810,6 @@ const _sfc_main = {
|
|
|
return;
|
|
|
try {
|
|
|
this.isSubmitting = true;
|
|
|
- common_vendor.index.showLoading({
|
|
|
- title: "正在提交答案..."
|
|
|
- });
|
|
|
let answerContent = "";
|
|
|
let answerOptions = [];
|
|
|
if (this.currentAnswer.questionType === 0) {
|