feat: 我的练习接口对接

This commit is contained in:
cgd_mac 2022-01-13 16:28:18 +08:00
parent 9e2f1662f5
commit bb309c72af
4 changed files with 90 additions and 35 deletions

View File

@ -6,16 +6,16 @@ const practiceApi = {
del: 'practice/del',
list: 'practice/list',
collectionList: 'practice/collection/pageList', // 我的收藏列表
recordList: 'practice/record/pageList', // 错题集
wrongList: 'practice/wrong/pageList', // 答题记录
startAnswer: 'practice/startAnswer', // 开始答题
recordList: 'practice/record/pageList', // 答题记录
wrongList: 'practice/wrong/pageList', // 错题集
startAnswer: 'practice/startAnswer' // 开始答题
}
export function practiceStartAnswer(params) {
return request({
url: practiceApi.startAnswer,
method: 'post',
data: params
params: params
})
}

View File

@ -7,9 +7,15 @@
</div>
<div class="options-box">
<ul class="answer-list">
<li :class="{'success-li' : index == 2}" v-for="(item, index) in options" :key="index">
<!-- <li :class="{'success-li' : index == 2}" v-for="(item, index) in options" :key="index">
<span>{{ optionKeys[index] }}</span>{{ item.label }}
</li>
</li> -->
<li v-if="data.answerA || data.answerA === 0" :class="{'success-li' : data.rightAnswers == 'A'}"><span>A</span>{{ data.answerA }}</li>
<li v-if="data.answerB || data.answerB === 0" :class="{'success-li' : data.rightAnswers == 'B'}"><span>B</span>{{ data.answerB }}</li>
<li v-if="data.answerC || data.answerC === 0" :class="{'success-li' : data.rightAnswers == 'C'}"><span>C</span>{{ data.answerC }}</li>
<li v-if="data.answerD || data.answerD === 0" :class="{'success-li' : data.rightAnswers == 'D'}"><span>D</span>{{ data.answerD }}</li>
<li v-if="data.answerE || data.answerE === 0" :class="{'success-li' : data.rightAnswers == 'E'}"><span>E</span>{{ data.answerE }}</li>
<li v-if="data.answerF || data.answerF === 0" :class="{'success-li' : data.rightAnswers == 'F'}"><span>F</span>{{ data.answerF }}</li>
</ul>
</div>
<div class="flex-center justify-between" style="margin-top: 10px;">
@ -26,13 +32,13 @@
<a-tag color="blue" >统计</a-tag>
</div>
</div>
<div class="analysis-value">答题时间44全站正确率47%易错项D</div>
<div class="analysis-value">答题时间{{data.answerTime}}全站正确率{{data.accuracyRate}}%易错项{{data.wrongItem || '无'}}</div>
</div>
<div class="flex-center analysis">
<div class="analysis-label">
<a-tag color="blue" style="margin-top: 6px;">解析</a-tag>
</div>
<div class="analysis-value" style="color: #333;">第一步本题考查新发展理念第二步十三五规划建议提出的创新协调绿色开放共享五大发展理念集中反映了我们党对经济社会发展规律认识的深化是建议的精髓和主线也是本次全会的亮点和重大贡献创新发展注重的是解决发展动力问题我国创新能力不强科技发展水平总体不高科技对经济社会发展的支撑能力不足科技对经济增长的贡献率远低于发达国家水平协调发展注重的是解决发展不平衡问题我国发展不协调是一个长期存在的问题突出表现在区域城乡经济和社会物质文明和精神文明经济建设和国防建设等关系上绿色发展注重的是解决人与自然和谐共生问题我国资源约束趋紧环境污染严重生态系统退化的问题十分严峻开放发展注重的是解决发展内外联动问题现在的问题不是要不要对外开放而是如何提高对外开放的质量和发展的内外联动性共享发展注重的是解决社会公平正义问题我国经济发展的蛋糕不断做大但分配不公问题比较突出收入差距城乡区域公共服务水平差距较大在共享改革发展成果上无论是实际情况还是制度设计都还有不完善的地方所以①③④正确因此选择C选项</div>
<div class="analysis-value" style="color: #333;">{{data.answerParse || '无'}}</div>
</div>
</div>
</div>
@ -41,6 +47,10 @@
<script>
export default {
props: {
data: {
type: Object,
default: () => ({})
},
questionIndex: {
type: [Number],
default: 1

View File

@ -2,32 +2,43 @@
<a-card :bordered="false">
<a-tabs v-if="activeTab" :default-active-key="activeTab">
<a-tab-pane key="1" tab="我的收藏">
<a-card title="我的收藏题目(共5题)" :bordered="false" :bodyStyle="{padding: '0px !important'}" :headStyle="{paddingLeft: '0px !important'}">
<template v-for="(item, index) in 10" >
<a-card :title="`我的收藏题目(共${collectionInfo.total}题)`" :bordered="false" :bodyStyle="{padding: '0px !important'}" :headStyle="{paddingLeft: '0px !important'}">
<template v-if="collectionInfo.list && collectionInfo.list.length>0">
<template v-for="(item, index) in collectionInfo.list" >
<div :key="index">
<DbQuestionInfoItem :questionIndex="index+1" ></DbQuestionInfoItem>
<DbQuestionInfoItem :data="item" :questionIndex="index+1" ></DbQuestionInfoItem>
<a-divider></a-divider>
</div>
</template>
<a-pagination :default-current="6" :total="500" />
<div class="flex-center">
<a-pagination @change="(page, size) =>{changePaginatio(page, size, 'collection')}" :default-current="collectionInfo.pageNum" :total="collectionInfo.total" />
</div>
</template>
<a-empty style="margin: 30px 0;" v-else />
</a-card>
</a-tab-pane>
<a-tab-pane key="2" tab="错题集">
<a-card title="我的错题题目(共5题)" :bordered="false" :bodyStyle="{padding: '0px !important'}" :headStyle="{paddingLeft: '0px !important'}">
<template v-for="(item, index) in 10" >
<template v-if="wrongInfo.list && wrongInfo.list.length>0">
<template v-for="(item, index) in wrongInfo.list" >
<div :key="index">
<DbQuestionInfoItem :questionIndex="index+1" ></DbQuestionInfoItem>
<a-divider></a-divider>
</div>
</template>
<div class="flex-center">
<a-pagination @change="(page, size) =>{changePaginatio(page, size, 'record')}" :default-current="wrongInfo.pageNum" :total="wrongInfo.total" />
</div>
</template>
<a-empty style="margin: 30px 0;" v-else />
</a-card>
</a-tab-pane>
<a-tab-pane key="3" tab="答题记录">
<a-card v-for="(item, index) in 10" :key="index" style="margin-bottom: 15px;">
<a-card v-for="(item, index) in recordInfo.list" :key="index" style="margin-bottom: 15px;">
<div class="flex-center" >
<div style="flex: 1;">
<h3>建筑施工安全培训第一期课程学习6.8-7.8</h3>
<div><span style="margin-right: 20px;">答题情况做对10/30</span><span>交卷时间2021-06-18 12:00</span></div>
<h3>{{item.courseName}}</h3>
<div><span style="margin-right: 20px;">答题情况做对{{item.rightQuestions}}/{{item.totalQuestions}}</span><span>交卷时间{{item.submitTime}}</span></div>
</div>
<div style="flex: 0 0 200px; text-align: right;">
<div :span="24" style="margin-bottom: 10px;"><a-button type="primary" size="small" >查看报告</a-button></div>
@ -35,34 +46,41 @@
</div>
</div>
</a-card>
<div class="flex-center">
<a-pagination @change="(page, size) =>{changePaginatio(page, size, 'wrong')}" :default-current="recordInfo.pageNum" :total="recordInfo.total" />
</div>
</a-tab-pane>
</a-tabs>
</a-card>
</template>
<script>
import { Pagination } from 'ant-design-vue'
import DbQuestionInfoItem from '@/components/DbQuestionInfoItem/index.vue'
import { practiceCollectionPageList, practiceRecordPageList, practiceWrongPageList } from '@/api/practice/practice'
export default {
components: { DbQuestionInfoItem },
components: { DbQuestionInfoItem, 'a-pagination': Pagination },
data () {
return {
activeTab: '',
collectionInfo: {
list: [],
size: 10,
pageIndex: 1
pageSize: 10,
pageNum: 1,
total: 0
},
recordInfo: {
list: [],
size: 10,
pageIndex: 1
pageSize: 10,
pageNum: 1,
total: 0
},
wrongInfo: {
list: [],
size: 10,
pageIndex: 1
pageSize: 10,
pageNum: 1,
total: 0
}
}
},
@ -72,18 +90,45 @@ export default {
},
methods: {
initData () {
this.getPracticeCollectionPageList()
this.getPracticeRecordPageList()
this.getPracticeWrongPageList()
this.getPracticecollectionPageList()
this.getPracticerecordPageList()
this.getPracticewrongPageList()
},
getPracticeCollectionPageList () {
practiceCollectionPageList().then(res => {
//
getPracticecollectionPageList () {
const { collectionInfo } = this
practiceCollectionPageList({ pageSize: collectionInfo.pageSize, pageNum: collectionInfo.pageNum }).then(res => {
this.collectionInfo.list = res.rows
this.collectionInfo.total = res.total
})
},
//
getPracticerecordPageList () {
const { recordInfo } = this
practiceRecordPageList({ pageSize: recordInfo.pageSize, pageNum: recordInfo.pageNum }).then(res => {
this.recordInfo.list = res.rows
this.recordInfo.total = res.total
})
},
//
getPracticewrongPageList () {
const { wrongInfo } = this
practiceWrongPageList({ pageSize: wrongInfo.pageSize, pageNum: wrongInfo.pageNum }).then(res => {
this.wrongInfo.list = res.rows
this.wrongInfo.total = res.total
})
},
//
changePaginatio (page, size, type) {
this[`${type}Info`] = { ...this[`${type}Info`], pageSize: size, pageNum: page }
this.$nextTick(() => {
this[`getPractice${type}PageList`]()
})
}
}
}
</script>
<style>
<style lang="less" scoped>
</style>

View File

@ -1,6 +1,6 @@
<template>
<div>
<DbExam></DbExam>
<DbExam :type="$route.query.type"></DbExam>
</div>
</template>