|
@@ -204,6 +204,8 @@ const _sfc_main = {
|
|
|
this.playAiSpeaking();
|
|
|
},
|
|
|
checkAnswer() {
|
|
|
+ if (this.showResult)
|
|
|
+ return;
|
|
|
clearInterval(this.timerInterval);
|
|
|
if (!this.currentQuestion) {
|
|
|
console.error("当前问题不存在");
|
|
@@ -224,9 +226,6 @@ const _sfc_main = {
|
|
|
}
|
|
|
this.showResult = true;
|
|
|
this.saveAnswer();
|
|
|
- this.submitCurrentAnswer().catch((error) => {
|
|
|
- console.error("提交答案失败:", error);
|
|
|
- });
|
|
|
},
|
|
|
nextQuestion(data) {
|
|
|
if (!this.showResult) {
|
|
@@ -301,9 +300,10 @@ const _sfc_main = {
|
|
|
},
|
|
|
// 提交当前答案
|
|
|
async submitCurrentAnswer() {
|
|
|
- if (!this.currentAnswer)
|
|
|
+ if (!this.currentAnswer || this.isSubmitting)
|
|
|
return;
|
|
|
try {
|
|
|
+ this.isSubmitting = true;
|
|
|
common_vendor.index.showLoading({
|
|
|
title: "正在提交答案..."
|
|
|
});
|
|
@@ -325,26 +325,25 @@ const _sfc_main = {
|
|
|
const submitData = {
|
|
|
job_id: JSON.parse(common_vendor.index.getStorageSync("selectedJob")).id,
|
|
|
applicant_id: JSON.parse(common_vendor.index.getStorageSync("userInfo")).id,
|
|
|
- //uni.getStorageSync('appId'), // 或者使用其他合适的ID
|
|
|
question_id: this.currentAnswer.questionId,
|
|
|
answer_content: answerContent,
|
|
|
answer_duration: this.currentAnswer.answerDuration || 0,
|
|
|
- // 如果需要tenant_id,请在这里添加
|
|
|
tenant_id: 1
|
|
|
};
|
|
|
console.log("提交数据:", submitData);
|
|
|
const res2 = await this.$http.post(`${common_config.apiBaseUrl}/api/job/submit_answer`, submitData);
|
|
|
console.log("提交答案响应:", res2);
|
|
|
- common_vendor.index.hideLoading();
|
|
|
return res2;
|
|
|
} catch (error) {
|
|
|
console.error("提交答案失败:", error);
|
|
|
- common_vendor.index.hideLoading();
|
|
|
common_vendor.index.showToast({
|
|
|
title: "提交答案失败,请重试",
|
|
|
icon: "none"
|
|
|
});
|
|
|
throw error;
|
|
|
+ } finally {
|
|
|
+ common_vendor.index.hideLoading();
|
|
|
+ this.isSubmitting = false;
|
|
|
}
|
|
|
},
|
|
|
// 修改 goToNextQuestion 方法,添加 async 关键字
|
|
@@ -524,12 +523,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
}, $options.currentQuestion.questionType !== 0 ? {
|
|
|
l: common_vendor.f($options.currentQuestion.options, (option, index, i0) => {
|
|
|
return {
|
|
|
- a: common_vendor.t(String.fromCharCode(65 + index)),
|
|
|
- b: common_vendor.t(option.option_text || (typeof option === "string" ? option : JSON.stringify(option))),
|
|
|
- c: index,
|
|
|
- d: ($options.currentQuestion.questionType === 1 ? $data.selectedOption === index : $data.selectedOptions.includes(index)) ? 1 : "",
|
|
|
- e: $data.showResult && ($options.currentQuestion.questionType === 1 ? index === $options.currentQuestion.correctAnswer : $options.currentQuestion.correctAnswers.includes(index)) ? 1 : "",
|
|
|
- f: common_vendor.o(($event) => $options.selectOption(index), index)
|
|
|
+ a: common_vendor.t(option.option_text || (typeof option === "string" ? option : JSON.stringify(option))),
|
|
|
+ b: index,
|
|
|
+ c: ($options.currentQuestion.questionType === 1 ? $data.selectedOption === index : $data.selectedOptions.includes(index)) ? 1 : "",
|
|
|
+ d: $data.showResult && ($options.currentQuestion.questionType === 1 ? index === $options.currentQuestion.correctAnswer : $options.currentQuestion.correctAnswers.includes(index)) ? 1 : "",
|
|
|
+ e: common_vendor.o(($event) => $options.selectOption(index), index)
|
|
|
};
|
|
|
})
|
|
|
} : {}, {
|