提交 92279b93 authored 作者: lihuihui's avatar lihuihui

答题安卓机卡优化

上级 cb75452d
......@@ -18,7 +18,8 @@
:key="dIndex+dItem.id"
:data-dId="dItem.id"
:data-cId="item.id"
:indexs="dItem.num">
v-if="dItem.num <= countPage.currentPage * countPage.showQuestionNum && dItem.num >= countPage.currentPage * countPage.showQuestionNum - 20"
:data-num="dItem.num">
<!-- v-if="dItem.num <= countPage.currentPage * countPage.showQuestionNum && dItem.num >= countPage.currentPage * countPage.showQuestionNum - 20" -->
<div class="title">
<div class="type" v-if="item.type == 1">单选题</div>
......@@ -242,43 +243,49 @@ export default {
}, 500)
},
slideChangeTransitionStart: function() {
const dataNum = this.slides[this.activeIndex].attributes['data-num']
_this.sildesHeightCount()
_this.setCurrentCollect()
_this.getIsSign()
if (this.activeIndex === _this.questionsData.sheet.question_count) {
if (!dataNum) {
_this.topicCard.isShow = true
} else {
_this.topicCard.isShow = false
}
document.getElementById('bottom-view').scrollTop = 0
_this.isAnalysis = false
_this.currentNum = this.activeIndex + 1
dataNum && (_this.currentNum = parseInt(dataNum.nodeValue))
_this.currentNum === _this.questionsData.sheet.question_count ? _this.nextBtnShow = false : _this.nextBtnShow = true
_this.requestData.answerPage = this.activeIndex
dataNum && (_this.requestData.answerPage = parseInt(dataNum.nodeValue))
},
slidePrevTransitionEnd: function() {
// if (this.activeIndex === 0) {
// _this.prevQuestionLoading()
// }
if (this.activeIndex === _this.questionsData.sheet.question_count - 1) {
this.slideTo(_this.swiperSign, 0, false)
_this.currentNum = this.activeIndex + 1
if (this.activeIndex === this.slides.length - 2) {
for (let i = 0; i < this.slides.length; i++) {
if (this.slides[i].attributes['data-num']) {
if (parseInt(this.slides[i].attributes['data-num'].nodeValue) === parseInt(_this.swiperSign)) {
this.slideTo(i, 0, false)
}
}
}
_this.currentNum = parseInt(this.slides[this.activeIndex].attributes['data-num'].nodeValue)
_this.currentNum === _this.questionsData.sheet.question_count ? _this.nextBtnShow = false : _this.nextBtnShow = true
_this.sildesHeightCount()
_this.setCurrentCollect()
_this.getIsSign()
} else {
if (this.activeIndex === 0 && parseInt(this.slides[this.activeIndex].attributes['data-num'].nodeValue !== 1)) {
_this.prevQuestionLoading()
}
}
},
slideNextTransitionEnd: function() {
// if (this.activeIndex === this.slides.length - 2) {
// _this.nextQuestionLoading()
// }
if (this.activeIndex === _this.questionsData.sheet.question_count - 1) {
_this.swiperSign = _this.questionsData.sheet.question_count - 1
}
if (this.activeIndex === _this.questionsData.sheet.question_count) {
const dataNum = this.slides[this.activeIndex].attributes['data-num']
if (!dataNum) {
_this.clickStatus = Date.parse(new Date())
_this.requestData.answerPage = _this.questionsData.sheet.question_count - 1
} else {
if (this.activeIndex === this.slides.length - 2 && parseInt(dataNum.nodeValue) !== parseInt(_this.questionsData.sheet.question_count)) {
_this.nextQuestionLoading()
}
}
}
}
......@@ -334,15 +341,23 @@ export default {
},
methods: {
prevQuestionLoading() {
Toast.loading({
message: '加载中...',
duration: 1000,
loadingType: 'spinner'
})
const dId = this.swiper.slides[this.swiper.activeIndex].attributes['data-dId'].nodeValue
this.countPage.currentPage--
if (this.countPage.currentPage !== 1) {
this.countPage.currentPage--
}
this.$nextTick(() => {
for (let i = 0; i < this.swiper.slides.length; i++) {
if (this.swiper.slides[i].attributes['data-dId']) {
this.swiper.slides[i].attributes['data-dId'].nodeValue === dId && (this.swiper.slideTo(i, 0, false))
}
this.currentNum = this.swiper.activeIndex
}
this.currentNum = parseInt(this.slides[this.activeIndex].attributes['data-num'].nodeValue)
Toast.clear()
})
},
nextQuestionLoading() {
......@@ -492,38 +507,44 @@ export default {
},
// 答题卡点击跳题
cardChange(data) {
Toast.loading({
message: '加载中...',
duration: 3000,
loadingType: 'spinner'
})
const e = data.id
this.countPage.currentPage = data.num
for (let i = 0; i < this.questionsData.sheet.question_count; i++) {
if (this.swiper.slides[i].attributes['data-dId'].nodeValue === e) {
setTimeout(() => {
document.getElementById('bottom-view').scrollTop = 0
this.swiper.slideTo(i, 0, false)
this.topicCard.isShow = false
setTimeout(() => {
this.requestData.answerPage = this.swiper.activeIndex
this.currentNum = this.swiper.activeIndex + 1
this.currentNum === this.questionsData.sheet.question_count
? this.nextBtnShow = false
: this.nextBtnShow = true
this.setCurrentCollect()
}, 100)
this.getIsSign()
}, 200)
this.countPage.currentPage = data.num + 1
this.$nextTick(() => {
for (let i = 0; i < this.swiper.slides.length; i++) {
if (this.swiper.slides[i].attributes['data-dId']) {
if (this.swiper.slides[i].attributes['data-dId'].nodeValue === e) {
setTimeout(() => {
document.getElementById('bottom-view').scrollTop = 0
this.swiper.slideTo(i, 0, false)
this.topicCard.isShow = false
setTimeout(() => {
this.requestData.answerPage = this.swiper.slides[i].attributes['data-num'].nodeValue
this.currentNum = parseInt(this.swiper.slides[i].attributes['data-num'].nodeValue)
this.currentNum === this.questionsData.sheet.question_count
? this.nextBtnShow = false
: this.nextBtnShow = true
this.setCurrentCollect()
}, 100)
this.getIsSign()
}, 200)
}
}
}
}
})
},
showCard() {
this.requestData.answerPage = this.swiper.activeIndex
const dataNum = parseInt(this.swiper.slides[this.swiper.activeIndex].attributes['data-num'].nodeValue)
this.requestData.answerPage = dataNum
this.swiperSign = dataNum
this.clickStatus = Date.parse(new Date())
if (this.swiper.activeIndex !== this.questionsData.sheet.question_count) {
this.swiperSign = this.swiper.activeIndex
} else {
this.swiperSign = this.swiper.activeIndex - 1
}
document.getElementById('bottom-view').scrollTop = 0
this.topicCard.isShow = true
this.swiper.slideTo(this.questionsData.sheet.question_count, 0, false)
this.swiper.slideTo(this.swiper.slides.length - 1, 0, false)
},
// 标记
signQuestion() {
......@@ -722,11 +743,16 @@ export default {
: this.nextBtnShow = true
if (res.answers !== null) {
if (res.answers.answerPage !== undefined && this.$route.query.id === undefined && res.answers.answerPage !== this.questionsData.sheet.question_count) {
setTimeout(() => {
this.currentNum = res.answers.answerPage + 1
this.swiper.slideTo(res.answers.answerPage, 0, false)
this.countPage.currentPage = parseInt(res.answers.answerPage / 10) + 1
this.$nextTick(() => {
for (let i = 0; i < this.swiper.slides.length; i++) {
if (this.swiper.slides[i].attributes['data-num']) {
parseInt(this.swiper.slides[i].attributes['data-num'].nodeValue) === parseInt(res.answers.answerPage) && (this.swiper.slideTo(i, 0, false))
}
}
this.currentNum = res.answers.answerPage
this.currentNum === this.questionsData.sheet.question_count ? this.nextBtnShow = false : this.nextBtnShow = true
}, 100)
})
}
const datas = res.answers
if (datas.length === 0) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论