|
@@ -49,7 +49,11 @@
|
|
</view>
|
|
</view>
|
|
|
|
|
|
<view class="options">
|
|
<view class="options">
|
|
- <!-- 只渲染非开放问题 (questionType: 1 或 2) -->
|
|
|
|
|
|
+ <!-- 只渲染非开放问题 (questionType: 1 或 2) 'option-wrong': showResult && (
|
|
|
|
+ currentQuestion.questionType === 1 ?
|
|
|
|
+ (selectedOption === index && index !== currentQuestion.correctAnswer) :
|
|
|
|
+ (selectedOptions.includes(index) && !currentQuestion.correctAnswers.includes(index))
|
|
|
|
+ )-->
|
|
<view
|
|
<view
|
|
v-if="currentQuestion.questionType !== 0"
|
|
v-if="currentQuestion.questionType !== 0"
|
|
v-for="(option, index) in currentQuestion.options"
|
|
v-for="(option, index) in currentQuestion.options"
|
|
@@ -60,31 +64,32 @@
|
|
'option-correct': showResult && (
|
|
'option-correct': showResult && (
|
|
currentQuestion.questionType === 1 ? index === currentQuestion.correctAnswer : currentQuestion.correctAnswers.includes(index)
|
|
currentQuestion.questionType === 1 ? index === currentQuestion.correctAnswer : currentQuestion.correctAnswers.includes(index)
|
|
),
|
|
),
|
|
- 'option-wrong': showResult && (
|
|
|
|
- currentQuestion.questionType === 1 ?
|
|
|
|
- (selectedOption === index && index !== currentQuestion.correctAnswer) :
|
|
|
|
- (selectedOptions.includes(index) && !currentQuestion.correctAnswers.includes(index))
|
|
|
|
- )
|
|
|
|
|
|
+
|
|
}"
|
|
}"
|
|
@click="selectOption(index)">
|
|
@click="selectOption(index)">
|
|
- <!-- 选项前添加单选/多选标识 -->
|
|
|
|
- <text class="option-prefix">{{currentQuestion.questionType === 1 ? '●' : '☐'}}</text>
|
|
|
|
|
|
+ <!-- 使用字母标识 A、B、C、D、E 等 -->
|
|
|
|
+ <text class="option-prefix">{{ String.fromCharCode(65 + index) }}.</text>
|
|
<text class="option-text">{{ option.option_text || (typeof option === 'string' ? option : JSON.stringify(option)) }}</text>
|
|
<text class="option-text">{{ option.option_text || (typeof option === 'string' ? option : JSON.stringify(option)) }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
+ <!-- 添加计时器显示 -->
|
|
<!-- <view class="timer-container">
|
|
<!-- <view class="timer-container">
|
|
- <text class="timer-text">本题剩余时间 {{remainingTime}}</text>
|
|
|
|
|
|
+ <text class="timer-text">本题剩余({{remainingTime}})</text>
|
|
</view> -->
|
|
</view> -->
|
|
|
|
|
|
- <button class="next-button" @click="nextQuestion(option)"
|
|
|
|
- :disabled="
|
|
|
|
- (currentQuestion.questionType === 0 && openQuestionAnswer.trim() === '') ||
|
|
|
|
- (currentQuestion.questionType === 1 && selectedOption === null) ||
|
|
|
|
- (currentQuestion.questionType === 2 && selectedOptions.length === 0)
|
|
|
|
- ">
|
|
|
|
- {{showResult ? '下一题' : '提交答案'}}
|
|
|
|
- </button>
|
|
|
|
|
|
+ <view class="bottom-button-container">
|
|
|
|
+ <view class="bottom-button-wrapper">
|
|
|
|
+ <button class="next-button" @click="nextQuestion(option)"
|
|
|
|
+ :disabled="
|
|
|
|
+ (currentQuestion.questionType === 0 && openQuestionAnswer.trim() === '') ||
|
|
|
|
+ (currentQuestion.questionType === 1 && selectedOption === null) ||
|
|
|
|
+ (currentQuestion.questionType === 2 && selectedOptions.length === 0)
|
|
|
|
+ ">
|
|
|
|
+ 本题剩余{{remainingTime}} {{"进入下一题"}}<!-- showResult ? '进入下一题' : '提交答案' -->
|
|
|
|
+ </button>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -319,17 +324,32 @@
|
|
// 记录开始时间
|
|
// 记录开始时间
|
|
this.questionStartTime = new Date();
|
|
this.questionStartTime = new Date();
|
|
|
|
|
|
- // 模拟倒计时
|
|
|
|
- let seconds = 30; // 每题30秒
|
|
|
|
|
|
+ // 设置倒计时时间(秒)
|
|
|
|
+ let seconds = 60; // 每题60秒,可以根据需要调整
|
|
|
|
+ this.remainingTime = `01:00`;
|
|
|
|
+
|
|
this.timerInterval = setInterval(() => {
|
|
this.timerInterval = setInterval(() => {
|
|
seconds--;
|
|
seconds--;
|
|
if (seconds <= 0) {
|
|
if (seconds <= 0) {
|
|
clearInterval(this.timerInterval);
|
|
clearInterval(this.timerInterval);
|
|
- // 时间到,自动提交答案
|
|
|
|
|
|
+ // 时间到,自动提交答案并进入下一题
|
|
if (!this.showResult) {
|
|
if (!this.showResult) {
|
|
this.checkAnswer();
|
|
this.checkAnswer();
|
|
|
|
+ // 短暂延迟后自动进入下一题
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ if (this.currentQuestionIndex < this.questions.length - 1) {
|
|
|
|
+ this.goToNextQuestion();
|
|
|
|
+ } else {
|
|
|
|
+ // 如果是最后一题,显示结束模态框或跳转
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/interview/interview'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }, 1500); // 1.5秒后自动进入下一题
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 格式化显示时间
|
|
const min = Math.floor(seconds / 60).toString().padStart(2, '0');
|
|
const min = Math.floor(seconds / 60).toString().padStart(2, '0');
|
|
const sec = (seconds % 60).toString().padStart(2, '0');
|
|
const sec = (seconds % 60).toString().padStart(2, '0');
|
|
this.remainingTime = `${min}:${sec}`;
|
|
this.remainingTime = `${min}:${sec}`;
|
|
@@ -389,25 +409,50 @@
|
|
|
|
|
|
// 显示结果
|
|
// 显示结果
|
|
this.showResult = true;
|
|
this.showResult = true;
|
|
|
|
+
|
|
|
|
+ // 保存当前题目的答案
|
|
|
|
+ this.saveAnswer();
|
|
|
|
+
|
|
|
|
+ // 提交答案
|
|
|
|
+ this.submitCurrentAnswer().catch(error => {
|
|
|
|
+ console.error('提交答案失败:', error);
|
|
|
|
+ });
|
|
},
|
|
},
|
|
|
|
|
|
nextQuestion(data) {
|
|
nextQuestion(data) {
|
|
// 如果还没有显示结果,先检查答案并提交
|
|
// 如果还没有显示结果,先检查答案并提交
|
|
if (!this.showResult) {
|
|
if (!this.showResult) {
|
|
this.checkAnswer();
|
|
this.checkAnswer();
|
|
- // 保存当前题目的答案并立即提交
|
|
|
|
- this.saveAnswer(data);
|
|
|
|
- this.submitCurrentAnswer(data).then(() => {
|
|
|
|
- // 提交成功后显示结果
|
|
|
|
- this.showResult = true;
|
|
|
|
|
|
+
|
|
|
|
+ // 保存当前题目的答案
|
|
|
|
+ this.saveAnswer();
|
|
|
|
+
|
|
|
|
+ // 提交答案
|
|
|
|
+ this.submitCurrentAnswer().then(() => {
|
|
|
|
+ // 提交成功后,短暂延迟后自动进入下一题
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ // 如果是最后一题,跳转到面试页面
|
|
|
|
+ if (this.currentQuestionIndex >= this.questions.length - 1) {
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/interview/interview'
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ // 否则进入下一题
|
|
|
|
+ this.goToNextQuestion();
|
|
|
|
+ }
|
|
|
|
+ }, 500); // 1秒后自动进入下一题
|
|
}).catch(error => {
|
|
}).catch(error => {
|
|
console.error('提交答案失败:', error);
|
|
console.error('提交答案失败:', error);
|
|
- uni.showToast({
|
|
|
|
- title: '提交答案失败,请重试',
|
|
|
|
- icon: 'none'
|
|
|
|
- });
|
|
|
|
- // 即使提交失败也显示结果
|
|
|
|
- this.showResult = true;
|
|
|
|
|
|
+ // 即使提交失败也继续下一题
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ if (this.currentQuestionIndex >= this.questions.length - 1) {
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/interview/interview'
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ this.goToNextQuestion();
|
|
|
|
+ }
|
|
|
|
+ }, 1000);
|
|
});
|
|
});
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -415,19 +460,8 @@
|
|
// 如果已经显示结果,点击"下一题"按钮时执行
|
|
// 如果已经显示结果,点击"下一题"按钮时执行
|
|
// 如果是最后一题,直接跳转到手部照片采集页面
|
|
// 如果是最后一题,直接跳转到手部照片采集页面
|
|
if (this.currentQuestionIndex >= this.questions.length - 1) {
|
|
if (this.currentQuestionIndex >= this.questions.length - 1) {
|
|
- // 直接跳转到手部照片采集页面,不显示结束模态框
|
|
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
- url: '/pages/interview/interview', // 假设这是手部照片采集页面的路径
|
|
|
|
- success: () => {
|
|
|
|
- console.log('成功跳转到手部照片采集页面');
|
|
|
|
- },
|
|
|
|
- fail: (err) => {
|
|
|
|
- console.error('跳转失败:', err);
|
|
|
|
- uni.showToast({
|
|
|
|
- title: '跳转失败,请手动返回首页',
|
|
|
|
- icon: 'none'
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ url: '/pages/interview/interview'
|
|
});
|
|
});
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -986,6 +1020,8 @@
|
|
font-size: 28rpx;
|
|
font-size: 28rpx;
|
|
transition: all 0.3s;
|
|
transition: all 0.3s;
|
|
border: 1px solid #e0e0e0;
|
|
border: 1px solid #e0e0e0;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
}
|
|
}
|
|
|
|
|
|
.option-selected {
|
|
.option-selected {
|
|
@@ -1008,13 +1044,42 @@
|
|
}
|
|
}
|
|
|
|
|
|
.timer-container {
|
|
.timer-container {
|
|
- text-align: center;
|
|
|
|
|
|
+ text-align: right;
|
|
margin: 20rpx 0;
|
|
margin: 20rpx 0;
|
|
}
|
|
}
|
|
|
|
|
|
.timer-text {
|
|
.timer-text {
|
|
font-size: 24rpx;
|
|
font-size: 24rpx;
|
|
color: #666;
|
|
color: #666;
|
|
|
|
+ background-color: #f0f0f0;
|
|
|
|
+ padding: 6rpx 12rpx;
|
|
|
|
+ border-radius: 6rpx;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .bottom-button-container {
|
|
|
|
+ position: fixed;
|
|
|
|
+ bottom: 30px;
|
|
|
|
+ left:7%;
|
|
|
|
+ right: 0;
|
|
|
|
+ background-color: #ffffff;
|
|
|
|
+ /* border-top: 1px solid #e0e0e0; */
|
|
|
|
+ padding: 20rpx;
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .bottom-button-wrapper {
|
|
|
|
+ display: flex;
|
|
|
|
+ width: 100%;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ align-items: center;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .timer-display {
|
|
|
|
+ font-size: 28rpx;
|
|
|
|
+ color: #666;
|
|
|
|
+ padding: 10rpx 20rpx;
|
|
|
|
+ border-radius: 6rpx;
|
|
}
|
|
}
|
|
|
|
|
|
.next-button {
|
|
.next-button {
|
|
@@ -1022,16 +1087,11 @@
|
|
color: #ffffff;
|
|
color: #ffffff;
|
|
border-radius: 10rpx;
|
|
border-radius: 10rpx;
|
|
font-size: 30rpx;
|
|
font-size: 30rpx;
|
|
- margin: 20rpx auto;
|
|
|
|
height: 80rpx;
|
|
height: 80rpx;
|
|
line-height: 80rpx;
|
|
line-height: 80rpx;
|
|
width: 90%;
|
|
width: 90%;
|
|
text-align: center;
|
|
text-align: center;
|
|
- }
|
|
|
|
-
|
|
|
|
- .next-button[disabled] {
|
|
|
|
- background-color: #cccccc;
|
|
|
|
- color: #999999;
|
|
|
|
|
|
+ margin: 0;
|
|
}
|
|
}
|
|
|
|
|
|
.footer {
|
|
.footer {
|
|
@@ -1281,7 +1341,8 @@
|
|
|
|
|
|
.option-prefix {
|
|
.option-prefix {
|
|
margin-right: 10rpx;
|
|
margin-right: 10rpx;
|
|
- color: #0039b3;
|
|
|
|
font-weight: bold;
|
|
font-weight: bold;
|
|
|
|
+ color: #333;
|
|
|
|
+ min-width: 30rpx;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|