|
@@ -60,7 +60,8 @@ const _sfc_main = {
|
|
|
useVideo: false,
|
|
|
timerInterval: null,
|
|
|
score: 0,
|
|
|
- totalQuestions: 0
|
|
|
+ totalQuestions: 0,
|
|
|
+ interviewCompleted: false
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -112,6 +113,11 @@ const _sfc_main = {
|
|
|
if (this.isAnswerCorrect) {
|
|
|
this.score++;
|
|
|
}
|
|
|
+ if (this.currentQuestionIndex === this.questions.length - 1) {
|
|
|
+ this.showEndModal = false;
|
|
|
+ this.interviewCompleted = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.goToNextQuestion();
|
|
|
},
|
|
|
nextQuestion() {
|
|
@@ -126,7 +132,11 @@ const _sfc_main = {
|
|
|
this.selectedOption = null;
|
|
|
this.currentQuestionIndex++;
|
|
|
if (this.currentQuestionIndex >= this.questions.length) {
|
|
|
- this.showEndModal = true;
|
|
|
+ this.showEndModal = false;
|
|
|
+ this.interviewCompleted = true;
|
|
|
+ if (this.timerInterval) {
|
|
|
+ clearInterval(this.timerInterval);
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
this.resetTimer();
|
|
@@ -143,8 +153,26 @@ const _sfc_main = {
|
|
|
});
|
|
|
},
|
|
|
back() {
|
|
|
- clearInterval(this.timerInterval);
|
|
|
- common_vendor.index.navigateBack();
|
|
|
+ if (this.timerInterval) {
|
|
|
+ clearInterval(this.timerInterval);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const pages = getCurrentPages();
|
|
|
+ if (pages.length > 1) {
|
|
|
+ common_vendor.index.reLaunch({
|
|
|
+ url: "/pages/index/index"
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ common_vendor.index.reLaunch({
|
|
|
+ url: "/pages/index/index"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error("导航错误:", e);
|
|
|
+ common_vendor.index.reLaunch({
|
|
|
+ url: "/pages/index/index"
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
error(e) {
|
|
|
console.error(e.detail);
|
|
@@ -171,6 +199,11 @@ const _sfc_main = {
|
|
|
this.showResult = false;
|
|
|
this.selectedOption = null;
|
|
|
this.resetTimer();
|
|
|
+ },
|
|
|
+ // 在methods中添加测试方法
|
|
|
+ testEndScreen() {
|
|
|
+ this.interviewCompleted = true;
|
|
|
+ this.showEndModal = false;
|
|
|
}
|
|
|
},
|
|
|
// 添加生命周期钩子,确保在组件销毁时清除计时器
|
|
@@ -210,6 +243,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
o: common_vendor.t($data.totalQuestions),
|
|
|
p: common_vendor.o((...args) => $options.restartTest && $options.restartTest(...args)),
|
|
|
q: common_vendor.o((...args) => $options.back && $options.back(...args))
|
|
|
+ } : {}, {
|
|
|
+ r: $data.interviewCompleted
|
|
|
+ }, $data.interviewCompleted ? {
|
|
|
+ s: common_assets._imports_0,
|
|
|
+ t: common_vendor.o((...args) => $options.back && $options.back(...args))
|
|
|
} : {});
|
|
|
}
|
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|