提交 9d49811d authored 作者: lihuihui's avatar lihuihui

fix: 修改bug

上级 fbc58e60
......@@ -57,14 +57,14 @@ export default {
const answerNum = this.genSubmitData(data).answerNum
if (answerNum !== 0) {
this.$confirm(`您还有${answerNum}道题没有作答`, '请确认', {
confirmButtonText: '继续作答',
cancelButtonText: '确认提交',
confirmButtonText: '确认提交',
cancelButtonText: '继续作答',
type: 'warning'
})
.then(() => {})
.catch(() => {
.then(() => {
this.submitApi(params)
})
.catch(() => {})
} else {
this.submitApi(params)
}
......
<template>
<div class="result-box">
<div class="card-left">
<div class="title">成绩报告</div>
<div class="chart-box">
<chart :accuracy="accuracy">
<template v-slot:tips>
<div class="num" v-if="data.sheet">{{ data.sheet.score }}</div>
<div class="t">分数</div>
</template>
</chart>
</div>
<!-- <div class="assess">测试评估</div>
<div class="assess-box">
<div class="prog">
<div class="line-box">
<div class="line" :style="setStyle"></div>
</div>
<div class="icon"></div>
</div>
<div class="text">{{ accuracy !== 100 ? '您离成功还有一段距离,继续努力!' : '成功近在眼前,再接再厉!' }}</div>
<div class="btn">全部考试服务</div>
</div> -->
</div>
<div class="card-right">
<card v-if="data.sheet" :data="data.sheet" @goQuestion="goPage">
<template v-slot:btnBox>
<div class="btn-box">
<div class="btn" @click="goPage('all')">全部解析</div>
<!-- <div class="btn" @click="goPage('err')">错题解析</div> -->
</div>
</template>
</card>
</div>
</div>
</template>
<script>
import chart from '../../components/pieChart.vue'
import card from '../../components/resultCard.vue'
import * as api from '@/api/exam.js'
export default {
components: {
chart,
card
},
data() {
return {
data: {},
accuracy: 0
}
},
created() {
this.getExamPapers()
},
computed: {
setStyle() {
return `width: ${this.accuracy}%`
}
},
mounted() {},
methods: {
goPage(param) {
const urlParam = this.$route.query
urlParam.id = param
urlParam.type = 2
this.$router.push({
path: '/course/exam/chapter',
query: urlParam
})
},
getExamPapers() {
const param = {
type: 1,
is_create: 0,
course_id: this.$route.query.course_id,
chapter_id: this.$route.query.chapter_id
}
api.getCourseQuestion(param).then(response => {
const data = JSON.parse(response.data)
this.data = data
this.accuracy = (parseInt(data.sheet.score) / parseInt(data.sheet.questions.total_score)) * 100
})
}
}
}
</script>
<style lang="scss" scoped>
.result-box {
width: 100%;
display: flex;
.card-left {
position: relative;
box-sizing: border-box;
padding: 10px 30px 20px;
flex: 1;
background: #fff;
margin-right: 10px;
height: 560px;
border-radius: 8px;
.title {
font-size: 18px;
color: #222222;
line-height: 45px;
border-bottom: 1px solid #ccc;
}
.chart-box {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
width: 148px;
// margin: 26px auto 0;
}
.assess {
font-size: 18px;
color: #222222;
line-height: 45px;
border-bottom: 1px solid #ccc;
}
.assess-box {
padding-top: 27px;
.prog {
width: 350px;
margin: 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
.line-box {
width: 300px;
width: 300px;
height: 10px;
background: #f9f9f9;
border-radius: 5px;
.line {
width: 80%;
height: 10px;
background: linear-gradient(90deg, #f47c46 0%, #f22f48 100%);
border-radius: 5px;
}
}
.icon {
width: 41px;
height: 38px;
background: url(@/assets/images/res-icon.png);
background-size: 100% 100%;
}
}
.text {
font-size: 14px;
color: #222222;
line-height: 20px;
text-align: center;
margin: 50px 0 68px 0;
}
.btn {
cursor: pointer;
text-align: center;
line-height: 40px;
width: 144px;
height: 40px;
background: #c01540;
border-radius: 4px;
font-size: 14px;
font-weight: bold;
color: #ffffff;
margin: 0 auto;
}
}
}
.card-right {
box-sizing: border-box;
flex: 1;
background: #fff;
height: 560px;
border-radius: 8px;
margin-left: 10px;
padding: 10px 30px 0;
}
}
</style>
......@@ -92,7 +92,6 @@ export default {
console.log(data)
for (const item in data.sheet.score_items) {
for (const cItem in data.sheet.score_items[item]) {
console.log(data.sheet.score_items[item][cItem].is_right, '=123isr')
if (data.sheet.score_items[item][cItem].is_right) {
numCount++
}
......
......@@ -91,12 +91,12 @@ export default {
if (isCache) {
if (answerNum !== 0) {
this.$confirm(`您还有${answerNum}道题没有作答`, '请确认', {
confirmButtonText: '继续作答',
cancelButtonText: '确认提交',
confirmButtonText: '确认提交',
cancelButtonText: '继续作答',
type: 'warning'
}).then(() => {
}).catch(() => {
this.submitApi(id, isCache, answer, refData.duration)
}).catch(() => {
})
} else {
this.submitApi(id, isCache, answer, refData.duration)
......
......@@ -88,7 +88,6 @@ export default {
console.log(data)
for (const item in data.sheet.score_items) {
for (const cItem in data.sheet.score_items[item]) {
console.log(data.sheet.score_items[item][cItem].is_right, '=123isr')
if (data.sheet.score_items[item][cItem].is_right) {
numCount++
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论