|
|
|
@ -29,7 +29,6 @@ |
|
|
|
<div class="questions-container"> |
|
|
|
<div v-for="question in currentQuestions" :key="question.id" class="question-card"> |
|
|
|
<div class="question-header"> |
|
|
|
<!-- <span class="question-number">第 {{ getQuestionIndex(question.id) }} 题</span> --> |
|
|
|
<div class="question"> |
|
|
|
<span class="text-lg font-bold mr-2">{{ question.id }}、</span> |
|
|
|
{{ question.stem }} |
|
|
|
@ -160,14 +159,14 @@ |
|
|
|
@click="changeNavPage(1)" |
|
|
|
:class="{ active: page === 1 }" |
|
|
|
> |
|
|
|
第一页 |
|
|
|
上一页 |
|
|
|
</button> |
|
|
|
<button |
|
|
|
class="pagination-btn" |
|
|
|
@click="changeNavPage(2)" |
|
|
|
:class="{ active: page === 2 }" |
|
|
|
> |
|
|
|
第二页 |
|
|
|
下一页 |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
@ -208,6 +207,11 @@ export default { |
|
|
|
showTeam: false, |
|
|
|
}; |
|
|
|
}, |
|
|
|
created() { |
|
|
|
for (let i = 1; i <= this.totalQuestions; i++) { |
|
|
|
this.$set(this.answers, i, 0) |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
// 当前页显示的两个题目 |
|
|
|
currentQuestions() { |
|
|
|
@ -221,7 +225,9 @@ export default { |
|
|
|
return Math.ceil(this.questions.length / this.questionsPerPage); |
|
|
|
}, |
|
|
|
answeredCount() { |
|
|
|
return Object.keys(this.answers).length; |
|
|
|
return Object.keys(this.answers).filter( |
|
|
|
key => this.answers[key] !== 0 |
|
|
|
).length |
|
|
|
}, |
|
|
|
completionRate() { |
|
|
|
return (this.answeredCount / this.totalQuestions) * 100; |
|
|
|
@ -242,8 +248,6 @@ export default { |
|
|
|
this.questions = response.data.data.list; |
|
|
|
} catch (error) { |
|
|
|
console.error('获取题目失败:', error); |
|
|
|
// 如果接口失败,使用默认题目 |
|
|
|
this.questions = this.getDefaultQuestions(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
@ -371,14 +375,9 @@ export default { |
|
|
|
// 如果倒计时结束,自动提交试卷 |
|
|
|
if (remainingMinutes <= 0 && !this.isSubmitted) { |
|
|
|
this.isSubmitted = true; |
|
|
|
this.autoSubmitTest(); |
|
|
|
this.submitAnswers(); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 自动提交试卷 |
|
|
|
async autoSubmitTest() { |
|
|
|
alert('考试时间已结束,系统将自动提交试卷!'); |
|
|
|
await this.submitAnswers(); |
|
|
|
}, |
|
|
|
// 提交答案到后端 |
|
|
|
async submitAnswers() { |
|
|
|
try { |
|
|
|
@ -462,7 +461,7 @@ export default { |
|
|
|
display: grid; |
|
|
|
grid-template-columns: repeat(5, 1fr); |
|
|
|
gap: 10px; |
|
|
|
margin: auto; |
|
|
|
margin: auto 30px; |
|
|
|
} |
|
|
|
|
|
|
|
.question-number { |
|
|
|
@ -474,7 +473,6 @@ export default { |
|
|
|
justify-content: center; |
|
|
|
font-weight: bold; |
|
|
|
cursor: pointer; |
|
|
|
transition: all 0.3s ease; |
|
|
|
position: relative; |
|
|
|
} |
|
|
|
|
|
|
|
@ -631,22 +629,22 @@ body { |
|
|
|
} |
|
|
|
.time-module { |
|
|
|
border: #274779 solid 2px; |
|
|
|
border-radius: 50px; |
|
|
|
border-radius: 30px; |
|
|
|
padding: 15px; |
|
|
|
margin-bottom: 20px; |
|
|
|
background-color: #2f374d; |
|
|
|
} |
|
|
|
.question-nav { |
|
|
|
border: #274779 solid 2px; |
|
|
|
border-radius: 50px; |
|
|
|
padding: 15px; |
|
|
|
border-radius: 30px; |
|
|
|
padding: 15px 0 15px 19px ; |
|
|
|
margin-bottom: 20px; |
|
|
|
background-color: #2f374d; |
|
|
|
} |
|
|
|
.statistics { |
|
|
|
height: 150px; |
|
|
|
border: #274779 solid 2px; |
|
|
|
border-radius: 50px; |
|
|
|
border-radius: 30px; |
|
|
|
padding: 15px; |
|
|
|
margin-bottom: 20px; |
|
|
|
background-color: #2f374d; |
|
|
|
@ -655,7 +653,7 @@ body { |
|
|
|
margin-bottom: 15px; |
|
|
|
color: #f1f5f9; |
|
|
|
font-size: 1.2em; |
|
|
|
border-bottom: 1px solid #374151; |
|
|
|
border-bottom: 2px solid #274779; |
|
|
|
padding-bottom: 10px; |
|
|
|
} |
|
|
|
.countdown { |
|
|
|
@ -665,9 +663,9 @@ body { |
|
|
|
} |
|
|
|
.pagination { |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
margin-top: 20px; |
|
|
|
gap: 10px; |
|
|
|
/* justify-content: center; */ |
|
|
|
margin: 30px 148px 5px; |
|
|
|
gap: 20px; |
|
|
|
} |
|
|
|
.pagination-btn { |
|
|
|
padding: 8px 15px; |
|
|
|
@ -678,6 +676,7 @@ body { |
|
|
|
font-weight: bold; |
|
|
|
cursor: pointer; |
|
|
|
transition: all 0.3s ease; |
|
|
|
margin: auto 20px; |
|
|
|
} |
|
|
|
.pagination-btn:hover { |
|
|
|
background-color: #2563eb; |
|
|
|
@ -699,8 +698,6 @@ body { |
|
|
|
background-color: #3b82f6; |
|
|
|
color: white; |
|
|
|
font-weight: bold; |
|
|
|
cursor: pointer; |
|
|
|
transition: all 0.3s ease; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
gap: 5px; |
|
|
|
@ -720,13 +717,12 @@ body { |
|
|
|
} |
|
|
|
.statistics-item { |
|
|
|
display: flex; |
|
|
|
font-size: larger; |
|
|
|
justify-content: space-between; |
|
|
|
margin-bottom: 10px; |
|
|
|
padding-bottom: 10px; |
|
|
|
border-bottom: 1px solid #374151; |
|
|
|
} |
|
|
|
.statistics-item:last-child { |
|
|
|
border-bottom: none; |
|
|
|
margin-top: 30px; |
|
|
|
padding-top: 10px; |
|
|
|
padding-bottom: 2px; |
|
|
|
border-bottom: 2px solid #274779; |
|
|
|
} |
|
|
|
.statistics-label { |
|
|
|
color: #e5e7eb; |
|
|
|
|