提交 c621feba authored 作者: lihuihui's avatar lihuihui
...@@ -11,11 +11,16 @@ ...@@ -11,11 +11,16 @@
<div class="exam-main"> <div class="exam-main">
<div class="left"> <div class="left">
<question-list :data="currentExam" :index="index" :disabled="disabled" :hasResult="hasResult"> <question-list :data="currentExam" :index="index" :disabled="disabled" :hasResult="hasResult">
<template #index>{{ index + 1 }}/{{ data.questions.total_question_count }}</template> <template #index>{{ index + 1 }}/{{ questionList.length }}</template>
</question-list> </question-list>
</div> </div>
<div class="right"> <div class="right">
<answer-card></answer-card> <question-numbers
:index="index"
:list="questionList"
:data="currentExam"
@change="handlePageChange"
></question-numbers>
</div> </div>
</div> </div>
<div class="foot" id="foot-h"> <div class="foot" id="foot-h">
...@@ -44,9 +49,9 @@ ...@@ -44,9 +49,9 @@
<script> <script>
import * as api from '@/api/exam.js' import * as api from '@/api/exam.js'
import questionList from '@/components/exam/questionList' import questionList from '@/components/exam/questionList'
import answerCard from '@/components/exam/examNumbers' import questionNumbers from '@/components/exam/questionNumbers'
export default { export default {
components: { questionList, answerCard }, components: { questionList, questionNumbers },
props: { props: {
title: { type: String }, title: { type: String },
hasMark: { type: Boolean, default: true }, hasMark: { type: Boolean, default: true },
...@@ -130,13 +135,16 @@ export default { ...@@ -130,13 +135,16 @@ export default {
}, },
// 下一题 // 下一题
nextQuestion() { nextQuestion() {
const totalNumber = this.data.questions.total_question_count const totalNumber = this.questionList.length
if (this.index + 1 < totalNumber) this.index++ if (this.index + 1 < totalNumber) this.index++
}, },
// 上一题 // 上一题
prevQuestion() { prevQuestion() {
if (this.index !== 0) this.index-- if (this.index !== 0) this.index--
}, },
handlePageChange(index) {
this.index = index
},
// 收藏试题 // 收藏试题
collectQuestion() { collectQuestion() {
const item = this.currentItem const item = this.currentItem
......
<template> <template>
<div> <div>
<div class="order-num"> <div class="order-num">
<div> <div v-for="item in dataList" :key="item.question_item_id">
<div class="tit">判断题</div> <div class="tit">{{ item.title }}</div>
<ul> <ul>
<!-- stu1已答 stu2当前 stu3标记 --> <!-- stu1已答 stu2当前 stu3标记 -->
<li class="stu1">1</li> <li
<li class="stu2">2</li> v-for="(item, index) in item.question_list"
<li class="stu3">3</li> :class="genClass(item)"
:key="index"
@click="handleClick(item)"
>
{{ index + 1 }}
</li>
</ul> </ul>
</div> </div>
</div> </div>
...@@ -47,37 +52,71 @@ ...@@ -47,37 +52,71 @@
</template> </template>
<script> <script>
export default { export default {
props: {}, props: {
mounted() {}, index: { type: Number, default: 0 },
computed: {}, data: { type: Object, default: () => ({}) },
methods: {}, list: { type: Array, default: () => [] }
watch: {} },
computed: {
dataList() {
const results = []
this.list.forEach((item, index) => {
const findIndex = results.findIndex(data => data.question_item_id === item.question_item_id)
const quesitonlist = item.question_list.map(item => {
return { ...item, index }
})
if (findIndex === -1) {
results.push({
title: item.title,
question_type: item.question_type,
question_item_id: item.question_item_id,
question_list: quesitonlist
})
} else {
results[findIndex].question_list = results[findIndex].question_list.concat(quesitonlist)
}
})
return results
}
},
methods: {
genClass(data) {
return {
stu1: data.user_answer.length,
stu2: data.index === this.index,
stu3: data.sign
}
},
handleClick(data) {
this.$emit('change', data.index, data)
}
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.info{ .info {
display: flex; display: flex;
align-items: center; align-items: center;
height: 100px; height: 100px;
.shape{ .shape {
width: 60px; width: 60px;
height: 60px; height: 60px;
border-radius: 50%; border-radius: 50%;
overflow: hidden; overflow: hidden;
} }
img{ img {
width: 75px; width: 75px;
// transform: scale(1); // transform: scale(1);
display: block; display: block;
} }
.right{ .right {
margin-left: 22px; margin-left: 22px;
.name{ .name {
font-size: 18px; font-size: 18px;
color: #222222; color: #222222;
line-height: 25px; line-height: 25px;
} }
.code{ .code {
font-size: 14px; font-size: 14px;
color: #222222; color: #222222;
line-height: 20px; line-height: 20px;
...@@ -85,54 +124,54 @@ export default { ...@@ -85,54 +124,54 @@ export default {
} }
} }
} }
.order-num{ .order-num {
padding-top: 20px; padding-top: 20px;
padding-bottom: 90px; padding-bottom: 90px;
.tit{ .tit {
font-size: 12px; font-size: 12px;
color: #999999; color: #999999;
line-height: 17px; line-height: 17px;
margin-bottom: 10px; margin-bottom: 10px;
} }
ul{ ul {
display: flex; display: flex;
list-style: none; list-style: none;
padding: 0; padding: 0;
margin: 0; margin: 0;
flex-wrap: wrap; flex-wrap: wrap;
li{ li {
cursor: pointer; cursor: pointer;
position: relative; position: relative;
border-radius: 50px; border-radius: 50px;
width: 24px; width: 24px;
height: 24px; height: 24px;
border: 1px solid #CCCCCC; border: 1px solid #cccccc;
font-size: 14px; font-size: 14px;
color: #666666; color: #666666;
line-height: 24px; line-height: 24px;
margin-right: 20px; margin-right: 20px;
margin-bottom: 10px; margin-bottom: 10px;
text-align: center; text-align: center;
&:nth-child(5n+5){ &:nth-child(5n + 5) {
margin-right: 0; margin-right: 0;
} }
&.analy{ &.analy {
&.stu1{ &.stu1 {
border: 2px solid #0FC118; border: 2px solid #0fc118;
line-height: 22px; line-height: 22px;
background: #fff; background: #fff;
color: #999; color: #999;
} }
&.stu2{ &.stu2 {
border: 2px solid #C01540; border: 2px solid #c01540;
line-height: 22px; line-height: 22px;
background: #fff; background: #fff;
color: #999; color: #999;
} }
&.stu3{ &.stu3 {
color: #fff; color: #fff;
background: #999999; background: #999999;
&::after{ &::after {
content: ''; content: '';
position: absolute; position: absolute;
top: -1px; top: -1px;
...@@ -144,208 +183,208 @@ export default { ...@@ -144,208 +183,208 @@ export default {
} }
} }
} }
&.stu1{ &.stu1 {
background: #999; background: #999;
border: 1px solid #999; border: 1px solid #999;
color: #fff; color: #fff;
} }
&.stu2{ &.stu2 {
width: 22px; width: 22px;
height: 22px; height: 22px;
line-height: 22px; line-height: 22px;
border: 2px solid #0FC118; border: 2px solid #0fc118;
} }
&.stu3{ &.stu3 {
&::after{ &::after {
content: ''; content: '';
position: absolute; position: absolute;
top: -1px; top: -1px;
right: -1px; right: -1px;
width: 4px; width: 4px;
height: 4px; height: 4px;
background: #C01540; background: #c01540;
border-radius: 50%; border-radius: 50%;
} }
} }
} }
} }
} }
.flag-tips{ .flag-tips {
width: 260px; width: 260px;
position: fixed; position: fixed;
bottom: 60px; bottom: 60px;
right:0; right: 0;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
padding: 15px 0 10px; padding: 15px 0 10px;
background: #fff; background: #fff;
margin: 0; margin: 0;
list-style: none; list-style: none;
li{ li {
.circle1{ .circle1 {
width: 24px; width: 24px;
height: 24px; height: 24px;
background: #EEEEEE; background: #eeeeee;
border: 1px solid #CCCCCC; border: 1px solid #cccccc;
border-radius: 50%; border-radius: 50%;
} }
.circle1{ .circle1 {
width: 24px; width: 24px;
height: 24px; height: 24px;
border: 1px solid #CCCCCC; border: 1px solid #cccccc;
border-radius: 50%; border-radius: 50%;
} }
.circle2{ .circle2 {
width: 24px; width: 24px;
height: 24px; height: 24px;
border: 1px solid #CCCCCC; border: 1px solid #cccccc;
border-radius: 50%; border-radius: 50%;
} }
.circle3{ .circle3 {
width: 24px; width: 24px;
height: 24px; height: 24px;
border: 2px solid #0FC118; border: 2px solid #0fc118;
border-radius: 50%; border-radius: 50%;
} }
.circle4{ .circle4 {
position: relative; position: relative;
width: 24px; width: 24px;
height: 24px; height: 24px;
border: 1px solid #CCCCCC; border: 1px solid #cccccc;
border-radius: 50%; border-radius: 50%;
&::after{ &::after {
content: ''; content: '';
position: absolute; position: absolute;
top: -1px; top: -1px;
right: -1px; right: -1px;
width: 4px; width: 4px;
height: 4px; height: 4px;
background: #C01540; background: #c01540;
border-radius: 50%; border-radius: 50%;
} }
} }
.txt{ .txt {
margin-top: 5px; margin-top: 5px;
font-size: 12px; font-size: 12px;
color: #CCCCCC; color: #cccccc;
line-height: 17px; line-height: 17px;
} }
} }
} }
.flag-tips{ .flag-tips {
width: 260px; width: 260px;
position: fixed; position: fixed;
bottom: 60px; bottom: 60px;
right:0; right: 0;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
padding: 15px 0 10px; padding: 15px 0 10px;
background: #fff; background: #fff;
margin: 0; margin: 0;
list-style: none; list-style: none;
li{ li {
.circle1{ .circle1 {
width: 24px; width: 24px;
height: 24px; height: 24px;
background: #999; background: #999;
border: 1px solid #999; border: 1px solid #999;
border-radius: 50%; border-radius: 50%;
} }
.circle2{ .circle2 {
width: 24px; width: 24px;
height: 24px; height: 24px;
border: 1px solid #CCCCCC; border: 1px solid #cccccc;
border-radius: 50%; border-radius: 50%;
} }
.circle3{ .circle3 {
width: 24px; width: 24px;
height: 24px; height: 24px;
border: 2px solid #0FC118; border: 2px solid #0fc118;
background: rgba(15, 193, 24, 0.1); background: rgba(15, 193, 24, 0.1);
border-radius: 50%; border-radius: 50%;
} }
.circle4{ .circle4 {
position: relative; position: relative;
width: 24px; width: 24px;
height: 24px; height: 24px;
border: 1px solid #CCCCCC; border: 1px solid #cccccc;
border-radius: 50%; border-radius: 50%;
&::after{ &::after {
content: ''; content: '';
position: absolute; position: absolute;
top: -1px; top: -1px;
right: -1px; right: -1px;
width: 4px; width: 4px;
height: 4px; height: 4px;
background: #C01540; background: #c01540;
border-radius: 50%; border-radius: 50%;
} }
} }
.txt{ .txt {
margin-top: 5px; margin-top: 5px;
font-size: 12px; font-size: 12px;
color: #CCCCCC; color: #cccccc;
line-height: 17px; line-height: 17px;
} }
} }
} }
.tips-box{ .tips-box {
width: 260px; width: 260px;
position: fixed; position: fixed;
bottom: 60px; bottom: 60px;
right:0; right: 0;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
padding: 15px 0 10px; padding: 15px 0 10px;
background: #fff; background: #fff;
margin: 0; margin: 0;
list-style: none; list-style: none;
li{ li {
&:nth-child(2){ &:nth-child(2) {
// margin: 0 50px; // margin: 0 50px;
} }
.circle1{ .circle1 {
width: 24px; width: 24px;
height: 24px; height: 24px;
background: #fff; background: #fff;
border: 2px solid #0FC118; border: 2px solid #0fc118;
border-radius: 50%; border-radius: 50%;
box-sizing: border-box; box-sizing: border-box;
} }
.circle2{ .circle2 {
width: 24px; width: 24px;
height: 24px; height: 24px;
border: 2px solid #C01540; border: 2px solid #c01540;
border-radius: 50%; border-radius: 50%;
box-sizing: border-box; box-sizing: border-box;
} }
.circle3{ .circle3 {
width: 24px; width: 24px;
height: 24px; height: 24px;
background: #999999; background: #999999;
border-radius: 50%; border-radius: 50%;
} }
.circle4{ .circle4 {
position: relative; position: relative;
width: 24px; width: 24px;
height: 24px; height: 24px;
border: 1px solid #CCCCCC; border: 1px solid #cccccc;
border-radius: 50%; border-radius: 50%;
&::after{ &::after {
content: ''; content: '';
position: absolute; position: absolute;
top: -1px; top: -1px;
right: -1px; right: -1px;
width: 4px; width: 4px;
height: 4px; height: 4px;
background: #C01540; background: #c01540;
border-radius: 50%; border-radius: 50%;
} }
} }
.txt{ .txt {
margin-top: 5px; margin-top: 5px;
font-size: 12px; font-size: 12px;
color: #CCCCCC; color: #cccccc;
line-height: 17px; line-height: 17px;
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论