提交 cfbe9bd0 authored 作者: 王鹏飞's avatar 王鹏飞

增加考试路由跳转

上级 33707f35
module.exports = {
domain: 'dev.ezijing.com',
url: 'https://transport2.ezijing.com/api',
url: 'https://transport.ezijing.com/api',
webpack: {
externals: {
CKEDITOR: 'window.CKEDITOR',
......
......@@ -56,8 +56,7 @@ export default {
},
// 去知识点考试页面
toExamPage() {
const path = `/exam/courseNodeExam?tag_id=${this.detail.id}`
this.$router.push({ path })
this.$router.push({ path: '/course/exam/examSite', query: { tag_id: this.detail.id } })
},
// 去课程视频页面
toCourseVideo() {
......
......@@ -6,11 +6,15 @@
<li v-for="subItem in item.children" :key="subItem.id">
<div class="name">{{ subItem.name }}</div>
<div class="buttons">
<el-button round size="mini" v-if="subItem.status === '100'">测试</el-button>
<el-button round size="mini" v-if="['0', '3'].includes(subItem.status)">继续测试</el-button>
<el-button round size="mini" v-if="subItem.status === '100'" @click="toExamPage(subItem, 1)">
测试
</el-button>
<el-button round size="mini" v-if="['0', '3'].includes(subItem.status)" @click="toExamPage(subItem, 2)">
继续测试
</el-button>
<template v-if="['1', '2'].includes(subItem.status)">
<el-button round size="mini">重新测试</el-button>
<el-button round size="mini">报告</el-button>
<el-button round size="mini" @click="toExamPage(subItem, 1)">重新测试</el-button>
<el-button round size="mini" @click="toExamPage(subItem, 3)">报告</el-button>
</template>
</div>
</li>
......@@ -54,6 +58,12 @@ export default {
.finally(() => {
this.loaded = true
})
},
toExamPage(data, type) {
this.$router.push({
path: '/course/exam/chapter',
query: { course_id: this.courseId, chapter_id: data.id, type }
})
}
},
beforeMount() {
......
......@@ -57,7 +57,7 @@ export default {
})
},
onTagClick(data) {
console.log(data)
this.$router.push({ path: '/course/exam/examSite', query: { tag_id: data.id } })
}
},
beforeMount() {
......
<template>
<div class="card_box">
<div class="head" id="top-view2">
<i class="el-icon-arrow-left"></i>
</div>
<div id="bottom-view2">
<div class="card_con">
<div class="flag">
<ul>
<li>
<div class="circle active1"></div>
<div class="txt">正确</div>
</li>
<li>
<div class="circle active2"></div>
<div class="txt">错误</div>
</li>
<!-- <li>
<div class="circle active3"></div>
<div class="txt">未答</div>
</li> -->
</ul>
</div>
<div class="question">
<div class="tips" v-if="$route.query.type == 1">按答题时间排序,最新错题在前面</div>
<div class="tips" v-if="$route.query.type == 2">按答题时间排序,最新收藏题在前面</div>
<ul>
<template v-for="(item, index) in dataList">
<li @click="goQuestionDetail(item.question_id)" :class="item.answer == 1 ? 'active1' : item.answer == 2 ? 'active2' : 'active3'" :key="index">
<div class="circle">{{ index + 1 }}</div>
<div class="txt">{{ questionType[item.question_type] }}</div>
</li>
</template>
</ul>
<van-empty description="暂无内容" v-if="dataList.length == 0"/>
<div class="tips" v-if="$route.query.type == 3">未做试题剩余{{unDo}}题</div>
</div>
</div>
</div>
<div class="clear-btn" v-if="this.$route.query.type != 3">
<div class="btn" @click="clearQuestion">清空记录,重新答题</div>
</div>
<div class="exam_submit" v-if="isPopShow">
<div class="pop">
<div class="tit"></div>
<div class="txt">您确定要清空当前做题记录并重新开始吗?</div>
<div class="btn_box">
<div class="btn" @click="isPopShow = false">取消</div>
<div class="btn btn2" @click="clearQuestion">清空</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { Toast } from 'vant'
import * as api from '@/api/my.js'
export default {
components: {
[Toast.name]: Toast
},
mounted() {
this.initData()
},
data() {
return {
unDo: 0,
questionType: {
1: '单选题',
2: '多选题',
5: '案例题',
6: '判断题'
},
dataList: [],
isPopShow: false
}
},
methods: {
clearQuestion() {
const param = {
type: this.$route.query.type,
question_type: this.$route.query.questionType,
clear: 1
}
api.cacheQuestion(param).then(res => {
Toast('清空成功')
window.localStorage.cachequestion = JSON.stringify([])
this.initData()
})
},
goQuestionDetail(id) {
const index = this.dataList.findIndex(item => { return item.question_id === id })
window.localStorage.myQuestionDetileId = id
this.$router.push({
name: 'questionsDetails',
query: {
type: this.$route.query.type,
questionType: this.$route.query.questionType,
page: parseInt(index / 30) + 1
}
})
},
initData() {
Toast.loading({
message: '加载中...',
duration: 5000,
loadingType: 'spinner'
})
api.getAllQuestion({ type: parseInt(this.$route.query.type) === 3 ? 0 : this.$route.query.type, question_type: this.$route.query.questionType })
.then(res => {
this.dataList = res.list
this.unDo = res.un_do
Toast.clear()
})
.catch(() => {
this.dataList = []
})
}
}
}
</script>
<style lang="scss" scoped>
.exam_submit{
position: fixed;
top: 0;
left: 0;
z-index: 999999;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.6);
.pop{
width: 5.9rem;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%,-50%);
background:rgba(255,255,255,1);
border-radius:.12rem;
padding: 0.4rem 0;
.tit{
font-weight:bold;
color:rgba(34,34,34,1);
font-size:.3rem;
text-align: center;
line-height: 100%;
}
.txt{
color:rgba(34,34,34,1);
font-size:.3rem;
text-align: center;
line-height: 100%;
margin-top: .8rem;
}
.btn_box{
padding:0 0.2rem;
display: flex;
margin-top: .8rem;
.btn{
width:2.6rem;
height:.7rem;
background:#C62245;
border-radius:.12rem;
text-align: center;
line-height: .7rem;
color: #fff;
font-size: .3rem;
}
.btn2{
margin-left: auto;
}
}
}
}
.card_box{
width: 100%;
height: 100%;
background: #fff;
.card_con{
padding: 0 .4rem;
overflow-y: scroll;
.flag{
border-bottom: 0.01rem solid #EEEEEE;
ul{
list-style: none;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
li{
margin: 0 .4rem 0.1rem .4rem;
text-align: center;
.circle{
width: .6rem;
height: .6rem;
border-radius: 50%;
font-size: .26rem;
text-align: center;
line-height: .6rem;
color: #fff;
}
.active1{
background: #67C23A;
}
.active2{
background:#FA5555;
}
.active3{
background:rgba(204,204,204,1);
}
.txt{
color: #222222;
font-size: .26rem;
margin-top: 0.1rem;
}
}
}
}
.question{
.tips{
margin-top: .4rem;
font-size: .26rem;
color:rgba(51,51,51,1);
margin-left: .6rem;
}
.title{
font-size: .3rem;
color: #333333;
margin-top: .1rem;
margin-bottom: .4rem;
}
ul{
list-style: none;
margin-top: .5rem;
padding: 0 0.6rem;
border-bottom: 0.01rem solid #EEEEEE;
display: flex;
flex-wrap: wrap;
li{
position: relative;
width: .6rem;
height: .6rem;
text-align: center;
margin-right: .6rem;
margin-bottom: .4rem;
padding-bottom: .38rem;
.circle{
width: .6rem;
height: .6rem;
border-radius: 50%;
font-size: .26rem;
line-height: .6rem;
color: #fff;
}
.txt{
position: absolute;
bottom: 0;
left: 50%;
-webkit-transform: translateX(-50%);
font-size: .2rem;
color: #333;
margin-top: .1rem;
line-height: 100%;
white-space:nowrap
}
}
:nth-child(5n+5){
margin: 0;
}
.active1{
.circle{
background: #67C23A;
}
}
.active2{
.circle{
background:#FA5555;
}
}
.active3{
.circle{
background:rgba(204,204,204,1);
}
}
}
}
}
}
.head{
color: #222;
display: flex;
padding: .4rem 0;
align-items: center;
i{
font-size: .35rem;
margin-left: .28rem;
}
.title{
margin-left: .03rem;
font-size: .3rem;
}
}
#bottom-view2{
overflow: scroll;
}
.card_box{
padding-bottom: .9rem;
}
.clear-btn{
position: fixed;
bottom: 0;
left: 0;
width:100%;
height:1rem;
background:rgba(255,255,255,1);
box-shadow:0rem 0rem .06rem 0rem rgba(0,0,0,0.05);
.btn{
width:6.7rem;
height:.7rem;
background:rgba(198,34,69,1);
border-radius:.12rem;
font-size:.3rem;
text-align: center;
line-height: .7rem;
color: #fff;
margin: .15rem auto;
}
}
</style>
差异被折叠。
<template>
<app-container> </app-container>
</template>
<script>
import AppContainer from '@/components/AppContainer'
export default {
components: { AppContainer }
}
</script>
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论