提交 74d520c4 authored 作者: lihuihui's avatar lihuihui

错题添加答题卡,能力自测页面拆分,答题页面样式更改

上级 f04204de
......@@ -45,7 +45,8 @@ if ($GLOBAL.isDev === 'development') {
followRedirects: true,
logLevel: 'info',
headers: {
'Referer': $GLOBAL.webConf.url
'Referer': $GLOBAL.webConf.url,
'Connection': 'keep-alive'
},
pathRewrite: {
'^/api': '/'
......
......@@ -18,6 +18,13 @@ export function getMyQuestionDetail(data) {
return httpRequest.get('/zy/v2/examination/question/detail', data)
}
/**
* 获取我的所有试题
*/
export function getAllQuestion(data) {
return httpRequest.get('/zy/v2/examination/my-question-all', data)
}
/* 删除试题 */
export function deleteQuestion(data) {
return httpRequest.post('/zy/v2/examination/delete-my-question', data, {
......@@ -32,6 +39,13 @@ export function collectQuestion(data) {
})
}
/* 缓存试题 */
export function cacheQuestion(data) {
return httpRequest.post('/zy/v2/examination/cache-question', data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
/* 意见反馈 */
export function submitFeedback(data) {
return httpRequest.post('/zy/v2/feedback/commit', data, {
......
src/assets/images/radio2.png

692 Bytes | W: | H:

src/assets/images/radio2.png

708 Bytes | W: | H:

src/assets/images/radio2.png
src/assets/images/radio2.png
src/assets/images/radio2.png
src/assets/images/radio2.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -479,7 +479,7 @@ export default {
padding-bottom: env(safe-area-inset-bottom);
.btn{width:3rem;
height:.7rem;
background:rgba(43,124,233,1);
background:#C62245;
border-radius:.12rem;
color: #fff;
font-size: .3rem;
......
......@@ -77,7 +77,7 @@
<div class="btn-box">
<div class="padd" v-if="!topicCard.isShow">
<!-- {{ swiper.slides[swiper.activeIndex].attributes['data-dId'].nodeValue }} -->
<div :class="collect.currentPages ? 'icon1 active' : 'icon1'" @click="collectQuestion()"></div>
<div v-if="nextBtnShow" :class="collect.currentPages ? 'icon1 active' : 'icon1'" @click="collectQuestion()"></div>
<div class="analysis" @click="analyShow" v-if="$route.query.id == undefined && ($route.query.course_id || $route.query.tag_id)">查看解析</div>
<div class="btn left" @click="switchQuestions('left')" v-show="currentNum !== 1">上一题</div>
<div class="btn right" @click="switchQuestions('right')" v-show="nextBtnShow">下一题</div>
......@@ -93,7 +93,7 @@
<div class="btn-box" v-if="questionCount != 1">
<div class="padd" v-if="!topicCard.isShow">
<!-- {{ swiper.slides[swiper.activeIndex].attributes['data-dId'].nodeValue }} -->
<div :class="collect.currentPages ? 'icon1 active' : 'icon1'" @click="collectQuestion()"></div>
<div v-if="nextBtnShow" :class="collect.currentPages ? 'icon1 active' : 'icon1'" @click="collectQuestion()"></div>
<div class="analysis" @click="analyShow" v-if="$route.query.id == undefined && ($route.query.course_id || $route.query.tag_id)">查看解析</div>
<div class="btn left" @click="switchQuestions('left')" v-show="currentNum !== 1">上一题</div>
<div class="btn right" @click="switchQuestions('right')" v-show="nextBtnShow">下一题</div>
......@@ -678,6 +678,9 @@ export default {
})
},
setCurrentCollect() {
if (!this.nextBtnShow) {
return false
}
const itemDid = this.swiper.slides[this.swiper.activeIndex].attributes['data-dId'].nodeValue
const itemCid = this.swiper.slides[this.swiper.activeIndex].attributes['data-cId'].nodeValue
this.questionsData.questions.find(item => {
......@@ -791,7 +794,7 @@ export default {
padding: .1rem .2rem;
font-size: .2rem;
color: #fff;
background: #67A8FF;
background: #F47885;
border-radius: .25rem;
margin-left: .2rem;
}
......@@ -855,8 +858,8 @@ export default {
word-wrap:break-word;
}
.active{
color: #fff;
background:#67A8FF;
color: #5F95DE;
background:#DDF1FF;
}
.active2{
color: #fff;
......@@ -935,7 +938,7 @@ export default {
.btn{
width:1.97rem;
height:.7rem;
background:rgba(43,124,233,1);
background:#C62245;
border-radius:.12rem;
text-align: center;
line-height: .7rem;
......@@ -987,7 +990,7 @@ export default {
.btn{
width:2.6rem;
height:.7rem;
background:rgba(43,124,233,1);
background:#C62245;
border-radius:.12rem;
text-align: center;
line-height: .7rem;
......@@ -1039,7 +1042,7 @@ export default {
margin: .4rem auto 0 auto;
width:5.5rem;
height:.7rem;
background:rgba(255,103,103,1);
background:#C62245;
border-radius:.12rem;
text-align: center;
line-height: .7rem;
......
<template>
<div>
<div class="tab1">
<!-- <div class="title">能力自测 测试说明</div> -->
<img src="../../assets/images/tab1bg.png" alt="">
<p class="ti">自测考试时间20分钟</p>
<p class="tx">考试题目共33题,分四部分</p>
<p class="tx">单选题共15题</p>
<p class="tx">多选题共10题</p>
<p class="tx">判断题共5题</p>
<p class="tx">案例题共1题</p>
<p class="ti2">了解自己知识掌握情况</p>
<p class="ti2">成绩报告准确分析定位</p>
<div class="comp">
<div class="btn" @click="abilityExam">开始测试</div>
</div>
</div>
<div class="exam_submit" v-if="isExamPop">
<div class="pop">
<div class="tit">能力自测</div>
<div class="txt">您上次未做完试题</div>
<div class="btn_box">
<div class="btn" @click="goAbilityExam(1)">重新答题</div>
<div class="btn btn2" @click="goAbilityExam(0)">继续答题</div>
</div>
</div>
</div>
<div class="exam_submit" v-if="isExamPopTo">
<div class="pop">
<div class="tit">能力自测</div>
<div class="txt">考试还未结束确定退出考试?</div>
<div class="btn_box">
<div class="btn" @click="isExamPopTo = false">退出考试</div>
<div class="btn btn2" @click="goAbilityExam(0)">继续考试</div>
</div>
</div>
</div>
</div>
</template>
<script>
import * as api from '@/api/courseExam.js'
export default {
data() {
return {
isExamPop: false,
isExamPopTo: false
}
},
mounted() {
if (window.localStorage.isExamEnd === 'true' || window.localStorage.isExamEnd === true) {
this.init()
}
},
methods: {
async abilityExam() {
const isLogin = await this.$store.dispatch('checkLogin')
if (!isLogin) {
this.goAbilityExam(1)
return false
}
const param = {
type: 1
}
api.getExamStatus(param).then(res => {
if (parseInt(res.status) === 0 || parseInt(res.status) === 3) {
this.isExamPop = true
} else {
this.goAbilityExam(1)
}
})
},
goAbilityExam(n) {
window.localStorage.isExamEnd = true
window.localStorage.examTab = 0
this.$router.push({
path: '/exam/answer',
query: {
type: 1,
is_create: n,
papersUrl: 'zy/v2/examination/examination-papers'
}
})
},
async init() {
const param = {
type: 1
}
const isLogin = await this.$store.dispatch('checkLogin')
if (isLogin) {
api.getExamStatus(param).then(res => {
if (parseInt(res.status) === 0 || parseInt(res.status) === 3) {
this.isExamPopTo = true
}
})
}
}
}
}
</script>
<style lang="scss" scoped>
.tab1{
// padding-top: .2rem;
padding: .8rem .4rem 1rem .4rem;
.txt{
font-size: .26rem;
color: #222;
line-height: .26ren;
}
.comp{
position: fixed;
bottom: .15rem;
left: 50%;
-webkit-transform: translateX(-50%);
padding-bottom: env(safe-area-inset-bottom);
}
.btn{
width:6.7rem;
height:.7rem;
background:#C62245;
border-radius:.12rem;
text-align: center;
line-height: .7rem;
color: #fff;
font-size: .3rem;
}
.title{
font-size:.4rem;
font-weight:bold;
color:rgba(255,103,103,1);
line-height: 100%;
padding-top: .2rem;
text-align: center;
}
img{
width: 5.01rem;
height: 3.98rem;
display: block;
margin: 0.2rem auto 0 auto;
}
p{
line-height: 100%;
font-size: .26rem;
color: #222;
text-align: center;
}
.tx{
margin-top: .2rem;
}
.ti{
font-size: .3rem;
margin: .4rem 0 .2rem 0;
font-weight: bold;
}
.ti2{
font-size: .3rem;
font-weight: bold;
margin-top: .4rem;
}
}
.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;
}
}
}
}
</style>
......@@ -14,7 +14,7 @@
</ul>
</div>
<div class="tab-con" id="bottom-view">
<div v-show="tabNav.navIndex == 0" class="tab1">
<!-- <div v-show="tabNav.navIndex == 0" class="tab1">
<div class="title">能力自测 测试说明</div>
<img src="../../assets/images/tab1bg.png" alt="">
<p class="ti">自测考试时间20分钟</p>
......@@ -28,8 +28,8 @@
<div class="comp">
<div class="btn" @click="abilityExam">开始测试</div>
</div>
</div>
<div v-show="tabNav.navIndex == 1" class="tab2">
</div> -->
<div v-show="tabNav.navIndex == 0" class="tab2">
<ul class="ul">
<template v-for="(item, index) in CourseChapter">
<li @click="listFold(item)" :key="index">
......@@ -64,7 +64,7 @@
</template>
</ul>
</div>
<div v-show="tabNav.navIndex == 2" class="tab3">
<div v-show="tabNav.navIndex == 1" class="tab3">
<ul>
<template v-for="(item, index) in courseList">
<li :key="index" @click="courseNodeDetail(item.course_id)">
......@@ -113,7 +113,7 @@ export default {
isExamPop: false,
isExamPopTo: false,
tabNav: {
navText: ['能力自测', '随堂小测', '知识点小测'],
navText: ['随堂小测', '知识点小测'],
navIndex: 0
},
CourseChapter: [],
......@@ -139,15 +139,15 @@ export default {
}
},
mounted() {
if (window.localStorage.examTab === '1' || window.localStorage.examTab === 1) {
this.getCourseChapterList()
this.tabNav.navIndex = 1
} else {
if (window.localStorage.isExamEnd === 'true' || window.localStorage.isExamEnd === true) {
this.init()
}
this.tabNav.navIndex = 0
}
this.getCourseChapterList()
// if (window.localStorage.examTab === '1' || window.localStorage.examTab === 1) {
// this.tabNav.navIndex = 1
// } else {
// // if (window.localStorage.isExamEnd === 'true' || window.localStorage.isExamEnd === true) {
// // this.init()
// // }
// // this.tabNav.navIndex = 0
// }
// this.getCourseChapterList()
this.scrollDom()
},
......@@ -285,7 +285,7 @@ export default {
},
async tab(e) {
const isLogin = await this.$store.dispatch('checkLogin')
if (e === 1 || e === 2) {
if (e === 0 || e === 1) {
if (!isLogin) {
if (this.isWeapp) {
// 小程序
......@@ -304,7 +304,7 @@ export default {
forbidClick: true,
duration: 1000
})
if (e === 1) {
if (e === 0) {
window.localStorage.examTab = e
this.getCourseChapterList()
} else {
......@@ -353,6 +353,8 @@ export default {
line-height: 1.1rem;
font-size: .3rem;
color:#999999;
flex: 1;
text-align: center;
}
li.active{
color: #222;
......
......@@ -222,7 +222,7 @@ export default {
.btn{
width: 1.76rem;
height: .8rem;
border: 0.01rem solid #3a7be6;
border: 0.01rem solid #F47885;
display: flex;
justify-content: center;
border-radius: .1rem;
......@@ -241,7 +241,7 @@ export default {
}
}
.btn.active{
background:#3a7be6;
background:#F47885;
.txt{
color: #fff;
}
......@@ -263,7 +263,7 @@ export default {
.b{
width:6.7rem;
height:.7rem;
background:#FF6767;
background:#C62245;
border-radius:.12rem;
margin: .15rem auto;
text-align: center;
......
<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 style="width:.5rem">
</li>
<li>
<div class="circle active3"></div>
<div class="txt">未答</div>
</li>
</ul>
</div>
<div class="question">
<div class="tips">按答题时间排序,最新错题在前面</div>
<ul>
<template v-for="(item, index) in dataList">
<li @click="goQuestionDetail(item.question_id)" :class="item.answer.length ? 'active1' : 'active3'" :key="index">
<div class="circle">{{ index + 1 }}</div>
<div class="txt">{{ questionType[item.question_type] }}</div>
</li>
</template>
</ul>
</div>
</div>
</div>
<div class="clear-btn">
<div class="btn" @click="clearQuestion">清空记录,重新答题</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 {
questionType: {
1: '单选题',
2: '多选题',
5: '案例题',
6: '判断题'
},
dataList: []
}
},
methods: {
clearQuestion() {
const param = {
type: this.$route.query.type,
question_type: this.$route.query.questionType,
clear: 1
}
api.cacheQuestion(param).then(res => {
Toast('清空成功')
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() {
api.getAllQuestion({ type: this.$route.query.type, question_type: this.$route.query.questionType }).then(res => {
this.dataList = res
})
// $.ajax({
// url: 'https://zy-teaching2.ezijing.com/v2/examination/my-question-all?type=1',
// type: 'GET',
// data: {},
// xhrFields: { withCredentials: true },
// success: function (data) {
// // for(let i = 0; i< data.length; ++i) {console.log(data[i]);}
// }
// })
}
}
}
</script>
<style lang="scss" scoped>
.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:rgba(255,128,0,1);
}
.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);
}
.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:rgba(255,128,0,1);
}
}
.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>
......@@ -122,10 +122,10 @@ export default {
const pageCount = (index / 50).toString()
let num = 1
pageCount.indexOf('.') === -1 ? num = pageCount : num = parseInt(pageCount) + 1
window.localStorage.myQuestionDetileId = id
this.$router.push({
path: '/my/questionsDetails',
query: {
id: id,
page: parseInt(num) === 0 ? 1 : num,
type: 2
}
......@@ -158,12 +158,6 @@ export default {
this.initData()
}
},
// scrollDom() {
// const topViewH = document.getElementById('top-view').offsetHeight
// const clientHeight = document.documentElement.clientHeight
// const bottomView = document.getElementById('bottom-view')
// bottomView.style.height = (clientHeight - topViewH) + 'px'
// },
del(ids) {
const idGroup = Array.isArray(ids) ? ids : [ids]
const param = {
......
......@@ -3,12 +3,15 @@
<div class="exam-box">
<div class="topic-box">
<swiper ref="mySwiper" :options="swiperOptions">
<template v-for="item in questionData.list">
<swiper-slide :key="item.id" :data-id="item.question_id">
<template v-for="(item, index) in questionData.list">
<swiper-slide :key="index" :data-id="item.question_id">
<div id="top-view">
<div class="tool-box">
<div class="time">{{ item.sheet_time }}</div>
<div class="tool-all">
<div class="tag-box" @click="goAnswerCard">
<span style="margin-right:.4rem">答题卡</span>
</div>
<div v-if="$route.query.type != 2" :class="item.is_collection ? 'icon1 active' : 'icon1'" @click="collectQuestion(item.question_id)"></div>
<div class="icon2" @click="delQuestion(item.question_id)"></div>
</div>
......@@ -23,9 +26,20 @@
<ul class="option">
<template v-for="opt in item.question_options">
<li
v-if="$route.query.type != 3"
:key="opt.id"
@click="selectOptions(item, opt)"
:class="isAnalysis && item.question_answer.find(id => { return id === opt.id })
:class="item.user_answer.length != 0 && item.question_answer.find(id => { return id === opt.id })
? 'active2'
: item.user_answer.find(id => { return id === opt.id })
? 'active'
: ''"
>{{ opt.option }}</li>
<li
v-else
:key="opt.id+'=-='"
@click="selectOptions(item, opt)"
:class="item.question_answer.find(id => { return id === opt.id })
? 'active2'
: item.user_answer.find(id => { return id === opt.id })
? 'active'
......@@ -33,7 +47,7 @@
>{{ opt.option }}</li>
</template>
</ul>
<div class="analy" v-show="isAnalysis">
<div class="analy" v-show="isAnalysis || item.user_answer.length != 0">
<div class="tit">答案解析</div>
<div class="txt">正确答案:
<span>
......@@ -65,15 +79,15 @@
<template>
<div class="btn-box">
<div class="padd" v-if="$route.query.type != 2">
<div class="analysis" @click="isAnalysis = !isAnalysis" v-if="$route.query.type == 1 || $route.query.type == 2">查看解析</div>
<div class="btn left" @click="switchQuestions('left')">上一题</div>
<div class="btn right" @click="switchQuestions('right')" >下一题</div>
<!-- <div class="analysis" @click="isAnalysis = !isAnalysis" v-if="$route.query.type == 1 || $route.query.type == 2">查看解析</div> -->
<div class="btn left" @click="switchQuestions('left')" v-if="isBtnShow.currentPage != 1">上一题</div>
<div class="btn right" @click="switchQuestions('right')" v-if="isBtnShow.currentPage != isBtnShow.pageCount">下一题</div>
</div>
<div class="padd new" v-else>
<div class="ysc">已收藏</div>
<div class="analysis" @click="isAnalysis = !isAnalysis" v-if="$route.query.type == 1 || $route.query.type == 2">查看解析</div>
<div class="btn left" @click="switchQuestions('left')">上一题</div>
<div class="btn right" @click="switchQuestions('right')" >下一题</div>
<!-- <div class="analysis" @click="isAnalysis = !isAnalysis" v-if="$route.query.type == 1 || $route.query.type == 2">查看解析</div> -->
<div class="btn left" @click="switchQuestions('left')" v-if="isBtnShow.currentPage != 1">上一题</div>
<div class="btn right" @click="switchQuestions('right')" v-if="isBtnShow.currentPage != isBtnShow.pageCount">下一题</div>
</div>
</div>
</template>
......@@ -85,6 +99,7 @@
import * as api from '@/api/my.js'
import { Toast, Dialog } from 'vant'
import { Swiper, SwiperSlide, directive } from 'vue-awesome-swiper'
// import card from '../../components/answerCard.vue'
import 'swiper/css/swiper.css'
export default {
metaInfo: {
......@@ -102,6 +117,13 @@ export default {
data() {
const _this = this
return {
isBtnShow: {
currentPage: 1,
pageCount: 1
},
cacheTime: null,
cacheList: {},
prevQuestionId: '',
pages: 0,
isMove: true,
other: {
......@@ -119,34 +141,35 @@ export default {
isAnalysis: false,
swiperOptions: {
observer: true,
observeParents: true,
notNextTick: true,
autoHeight: true,
on: {
// slideChangeTransitionStart: function() {
// console.log(11111)
// const qId = this.slides[this.activeIndex].attributes['data-id'].nodeValue
// const item = _this.questionData.list.find(item => { return item.question_id === qId })
// const totalNum = parseInt(_this.$route.query.type) === 1 ? _this.questionData.error_total : _this.questionData.total
// if (this.activeIndex === this.slides.length - 1) {
// if (item.num < totalNum) {
// _this.pages++
// _this.initData(_this.pages)
// }
// }
// if (this.activeIndex === 0) {
// if (item.num > 5) {
// _this.pages--
// _this.initData(_this.pages, 1)
// }
// }
// _this.switchPages()
// },
init() {
setTimeout(() => {
const qId = _this.swiper.slides[_this.swiper.activeIndex].attributes['data-id'].nodeValue
const item = _this.questionData.list.find(item => { return item.question_id === qId })
if (item.num % 30 === 0) {
_this.nextQuestionLoading()
}
if ((item.num - 1) % 30 === 0) {
_this.prevQuestionLoading()
}
_this.isBtnShow.currentPage = item.num
}, 500)
},
slideChangeTransitionStart: function() {
_this.switchPages()
},
slidePrevTransitionEnd: function() {
if (this.activeIndex === 1) {
_this.initData()
if (this.activeIndex === 0) {
_this.prevQuestionLoading()
}
},
slideNextTransitionEnd: function() {
console.log(3)
if (this.activeIndex === this.slides.length - 1) {
_this.nextQuestionLoading()
}
}
}
}
......@@ -165,6 +188,50 @@ export default {
}
},
methods: {
// 缓存试题
cacheQuestion() {
const param = {
type: this.$route.query.type,
question_type: this.$route.query.questionType,
answer: JSON.stringify(this.cacheList)
}
api.cacheQuestion(param).then(res => {})
},
// init到最后一题加载
nextQuestionLoading() {
Toast.loading({
message: '加载中...',
duration: 1000,
loadingType: 'spinner'
})
const qId = this.swiper.slides[this.swiper.activeIndex].attributes['data-id'].nodeValue
const item = this.questionData.list.find(item => { return item.question_id === qId })
this.prevQuestionId = item.question_id
this.initData(parseInt(item.num / 30) + 1)
},
// init到第一题加载
prevQuestionLoading() {
Toast.loading({
message: '加载中...',
duration: 1000,
loadingType: 'spinner'
})
const qId = this.swiper.slides[this.swiper.activeIndex].attributes['data-id'].nodeValue
const item = this.questionData.list.find(item => { return item.question_id === qId })
this.prevQuestionId = item.question_id
this.initData(parseInt(item.num / 30), true)
},
// 跳转答题卡
goAnswerCard() {
this.$router.push({
name: 'answerCard',
query: {
type: this.$route.query.type ? this.$route.query.type : 1,
questionType: this.$route.query.questionType
}
})
},
// 收藏试题
collectQuestion(queId) {
const queIds = Array.isArray(queId) ? queId : [queId]
queIds.map(id => {
......@@ -192,6 +259,7 @@ export default {
}
})
},
// 删除试题
delQuestion(ids) {
const idGroup = Array.isArray(ids) ? ids : [ids]
const param = {
......@@ -213,6 +281,7 @@ export default {
}
})
},
// 切换上一题下一题
switchQuestions(e) {
if (e === 'left') {
this.swiper.slidePrev()
......@@ -221,64 +290,92 @@ export default {
}
},
switchPages() {
const qId = this.swiper.slides[this.swiper.activeIndex].attributes['data-id'].nodeValue
window.localStorage.myQuestionDetileId = qId
const itemNum = this.questionData.list.find(item => { return item.question_id === qId })
this.isBtnShow.currentPage = itemNum.num
parseInt(this.$route.query.type) === 3 ? this.isAnalysis = true : this.isAnalysis = false
},
// 选择选项
selectOptions(item, opt) {
if (parseInt(item.question_type) === 1 || parseInt(item.question_type) === 6 || (parseInt(item.question_type) === 5 && item.answer_count === 1)) {
item.user_answer = [opt.id]
} else {
const fIndex = item.user_answer.findIndex(id => { return id === opt.id })
fIndex === -1 ? item.user_answer.push(opt.id) : item.user_answer.splice(fIndex, 1)
if (parseInt(this.$route.query.type) !== 3) {
this.isAnalysis = true
if (parseInt(item.question_type) === 1 || parseInt(item.question_type) === 6 || (parseInt(item.question_type) === 5 && item.answer_count === 1)) {
item.user_answer = [opt.id]
} else {
const fIndex = item.user_answer.findIndex(id => { return id === opt.id })
fIndex === -1 ? item.user_answer.push(opt.id) : item.user_answer.splice(fIndex, 1)
}
this.cacheList[item.question_id] = item.user_answer
}
},
// 初始化数据 || 翻页请求数据
initData(pages, isPush) {
const params = {
type: this.$route.query.type,
type: this.$route.query.type ? this.$route.query.type : 1,
question_type: this.$route.query.questionType,
page: pages,
page_size: 50
page_size: 30
}
api.getMyQuestion(params).then(res => {
this.questionData.error_total = res.error_total
this.questionData.total = res.total
this.questionData.collection_total = res.collection_total
parseInt(this.$route.query.type) === 1
? this.isBtnShow.pageCount = res.error_total
: parseInt(this.$route.query.type) === 2
? this.isBtnShow.pageCount = res.collection_total
: this.isBtnShow.pageCount = res.total
const list = []
res.list.map(item => {
const isCf = this.questionData.list.findIndex(i => { return i.question_id === item.question_id })
isCf === -1 && list.push(item)
})
this.questionData.list = [...this.questionData.list, ...res.list]
console.log(this.questionData.list)
// if (!isPush) {
// if (this.swiper.slides.length !== 0) {
// this.questionData.list = [...this.questionData.list, ...list]
// this.swiper.slideTo(0, 0, false)
// } else {
// this.questionData.list = [...this.questionData.list, ...list]
// }
// if (this.questionData.list.length > 90) {
// for (let i = 0; i < 50; i++) {
// this.questionData.list.splice(0, 1)
// }
// }
// } else {
// if (this.swiper.slides.length !== 0) {
// this.questionData.list = [...list, ...this.questionData.list]
// this.swiper.slideTo(this.questionData.list.length - 1, 0, false)
// } else {
// this.questionData.list = [...list, ...this.questionData.list]
// }
// if (this.questionData.list.length > 90) {
// for (let i = 0; i < 50; i++) {
// this.questionData.list.splice(this.questionData.list.length - 1, 1)
// }
// }
// }
if (this.isMove) {
this.isMove = false
const goIndex = this.questionData.list.findIndex(item => { return item.question_id === this.$route.query.id })
this.swiper.slideTo(goIndex, 0, false)
this.moveLoading(list, isPush)
this.$nextTick(() => {
if (this.isMove) {
this.isMove = false
const goIndex = this.questionData.list.findIndex(item => { return item.question_id === window.localStorage.myQuestionDetileId })
this.swiper.slideTo(goIndex, 0, false)
}
})
if (this.$route.query.type !== 3) {
clearInterval(this.cacheTime)
this.cacheTime = setInterval(() => {
this.cacheQuestion()
}, 3000)
}
})
},
// 请求回来试题后删除多余的试题
moveLoading(list, isPush) {
if (isPush) {
this.questionData.list = [...list, ...this.questionData.list]
if (this.questionData.list.length >= 90) {
for (let i = 0; i < 30; i++) {
this.questionData.list.splice(this.questionData.list.length - 1, 1)
}
}
const goIndex = this.questionData.list.findIndex(i => { return i.question_id === this.prevQuestionId })
if (!this.isMove) {
setTimeout(() => {
this.swiper.slideTo(goIndex, 0, false)
}, 500)
}
} else {
this.questionData.list = [...this.questionData.list, ...list]
if (this.questionData.list.length >= 90) {
for (let i = 0; i < 30; i++) {
this.questionData.list.splice(0, 1)
}
}
const goIndex = this.questionData.list.findIndex(i => { return i.question_id === this.prevQuestionId })
if (!this.isMove) {
setTimeout(() => {
this.swiper.slideTo(goIndex, 0, false)
}, 500)
}
}
}
}
}
......@@ -491,6 +588,7 @@ export default {
}
.ysc{
color: #ccc;
margin-right: .4rem;
}
.analysis{
margin-left: .4rem;
......
......@@ -135,12 +135,13 @@ export default {
const pageCount = (index / 50).toString()
let num = 1
pageCount.indexOf('.') === -1 ? num = pageCount : num = parseInt(pageCount) + 1
window.localStorage.myQuestionDetileId = id
this.$router.push({
path: '/my/questionsDetails',
query: {
id: id,
page: parseInt(num) === 0 ? 1 : num,
type: this.activeClass === '0' ? 1 : 3
type: this.activeClass === '0' ? 1 : 3,
questionType: this.screen.screenVal
}
})
},
......@@ -251,8 +252,8 @@ export default {
0: 0,
1: 1,
2: 2,
3: 5,
4: 6
3: 6,
4: 5
}
this.params = {
type: this.activeClass === '0' ? 1 : 3,
......@@ -260,6 +261,7 @@ export default {
page: 1,
page_size: 50
}
this.screen.screenVal = n[index]
this.screen.checkedText = value
this.clear()
this.screen.isShow = false
......@@ -312,7 +314,7 @@ export default {
.w-btn{
width:3rem;
height:.7rem;
background:rgba(43,124,233,1);
background:#C62245;
border-radius:.12rem;
font-size:.3rem;
text-align: center;
......@@ -323,7 +325,7 @@ export default {
.z-btn{
width:2.1rem;
height:.7rem;
background:rgba(43,124,233,1);
background:#C62245;
border-radius:.12rem;
font-size: .3rem;
text-align: center;
......
......@@ -3,6 +3,12 @@ export default [
/* 测试页面 */
{ path: '/test', name: 'test', component: () => import('../pages/test.vue') },
/* 课程检测 */
{
path: '/exam/abilityAnswer',
name: 'abilityAnswer',
component: () => import('../pages/courseExam/abilityAnswer.vue')
},
/* 能力自测首页 */
{
path: '/exam/index',
name: 'examIndex',
......@@ -124,6 +130,13 @@ export default [
component: () => import('../pages/my/questionsDetails.vue'),
meta: { requiredLogin: true }
},
// 我的-试题详情-答题卡
{
path: '/my/answerCard',
name: 'answerCard',
component: () => import('../pages/my/answerCard.vue'),
meta: { requiredLogin: true }
},
// 我的-收藏试题
{
path: '/my/collectQuestions',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论