提交
This commit is contained in:
@@ -5,23 +5,23 @@
|
||||
<view class="type_item" v-for="(item,index) of tabsList" :key="index" :class="tCurrent==item.value?'checked':'unchecked'" @tap="sectionChange(item.value)">{{item.label}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<swiper class="swiper mt20" :current="swiperIndex" :duration="duration" :autoplay="false" :disable-programmatic-animation="true" @change="onChange" @animationfinish="onAnimationfinish" @touchend="touchEnd" >
|
||||
<swiper class="swiper mt20" :current="swiperIndex" :duration="duration" :autoplay="false" :disable-programmatic-animation="true" @change="onChange" @animationfinish="onAnimationfinish" @touchend="touchEnd" >
|
||||
<swiper-item v-for="(quesItem,quesIndex) in swiperList" :key="quesIndex">
|
||||
<scroll-view scroll-y="true" class="swiper-scroll">
|
||||
<view>
|
||||
<view class="m14lr">
|
||||
<text class="tag_box">{{quesItem.questionTypeDesc}}</text>
|
||||
<text class="fs18">{{quesItem.questionDesc}}</text>
|
||||
<text class="tag_box">{{getQuestType(quesItem.type)}}</text>
|
||||
<text class="fs18">{{quesItem.question}}</text>
|
||||
</view>
|
||||
<view class="flex m14lr ai-c mt20" v-for="(item,index) in quesItem.optionList"
|
||||
:key="item.op" @tap="answerQues(item.op,index)">
|
||||
:key="item.op" @tap="answerQues(item.opValue,index)">
|
||||
<template
|
||||
v-if="quesItem.clickAnswer&&item.op===quesItem.rightOp">
|
||||
<u-icon class="mr15" name="checkmark-circle-fill" color="#05C341" size="30"></u-icon>
|
||||
v-if="quesItem.clickAnswer&&quesItem.trueAnswer.includes(item.opValue)">
|
||||
<u-icon class="mr15" name="checkmark-circle-fill" color="#05C341" size="32"></u-icon>
|
||||
</template>
|
||||
<template
|
||||
v-else-if="quesItem.clickAnswer===item.op&&item.op!==quesItem.rightAnswer">
|
||||
<u-icon class="mr15" name="close-circle-fill" color="red" size="30"></u-icon>
|
||||
v-else-if="quesItem.clickAnswer&&quesItem.clickAnswer.includes(item.opValue)&&!quesItem.trueAnswer.includes(item.opValue)">
|
||||
<u-icon class="mr15" name="close-circle-fill" color="red" size="32"></u-icon>
|
||||
</template>
|
||||
<template v-else-if="!item.chooseOption">
|
||||
<view class="option_item">{{item.op}}</view>
|
||||
@@ -29,17 +29,17 @@
|
||||
<text class="fs18">{{item.opDesc}}</text>
|
||||
</view>
|
||||
<view class="m14lr mt30"
|
||||
v-if="quesItem.clickAnswer&&quesItem.clickAnswer!==quesItem.rightOp || tCurrent===1">
|
||||
v-if="quesItem.clickAnswer&&!quesItem.trueAnswer.includes(quesItem.clickAnswer) || tCurrent===1">
|
||||
<view class="answer_box">
|
||||
<text class="fs18 fw600 cor-000">答案:{{quesItem.rightOp}}</text>
|
||||
<view class="fs18 cor-000" style="text-indent:2em;"> 这里是相关解释文字,这里是相关解释文字相关解释文字</view>
|
||||
<text class="fs18 fw600 cor-000">答案:{{getRightOp(quesItem.trueAnswer)}}</text>
|
||||
<view class="fs18 cor-000" style="text-indent:2em;"> {{quesItem.bestAnswer}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="wp100 flex jc-sb ai-c p14 bc-fff" v-if="isShowAll" style="position: fixed;bottom: 0;left: 0;">
|
||||
<view class="wp100 flex jc-sb ai-c p14 bc-fff" v-if="isShowAll" style="position: fixed;bottom: 0;left: 0;">
|
||||
<view style="width: 220rpx;">
|
||||
<button v-if="type==='practice'" class="btn">四步学科一</button>
|
||||
<view v-else class="btn" style="text-align: center;" @tap="submitPaper">
|
||||
@@ -219,7 +219,7 @@ export default {
|
||||
rightList:[],
|
||||
wrongList:[],
|
||||
collectList:storage.get('collectList') || [],
|
||||
questionList: [],//数据源
|
||||
questionList: [{isCollect:true}],//数据源
|
||||
swiperList: [], // 轮播图数据列表
|
||||
swiperIndex: 0, // 轮播图当前位置
|
||||
isChange: false, // 是否切换
|
||||
@@ -228,10 +228,33 @@ export default {
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getQuestionList()
|
||||
this.renderSwiper(0)
|
||||
},
|
||||
methods: {
|
||||
//获取正确选项
|
||||
getRightOp(val){
|
||||
let rightOp=''
|
||||
this.questionList[this.topicIndex].optionList.forEach(item=>{
|
||||
if(this.questionList[this.topicIndex].trueAnswer.includes(item.opValue)){
|
||||
if(rightOp){
|
||||
rightOp=rightOp+'、'+item.op
|
||||
}else{
|
||||
rightOp=item.op
|
||||
}
|
||||
}
|
||||
})
|
||||
return rightOp
|
||||
},
|
||||
//获取题类型
|
||||
getQuestType(val){
|
||||
if(val=='1'){
|
||||
return '判断'
|
||||
}else if(val=='2'){
|
||||
return '单选'
|
||||
}else if(val=='3'){
|
||||
return '多选'
|
||||
}
|
||||
},
|
||||
//开通VIP
|
||||
toVip(){
|
||||
this.showVip=true
|
||||
@@ -364,22 +387,37 @@ export default {
|
||||
this.topicIndex = index;
|
||||
this.renderSwiper(index);
|
||||
},
|
||||
isArrEqual(arr1, arr2){
|
||||
return arr1.length === arr2.length && arr1.every((ele) => arr2.includes(ele));
|
||||
},
|
||||
//答题
|
||||
answerQues(op, index) {
|
||||
if (!this.questionList[this.topicIndex].clickAnswer) {
|
||||
this.questionList[this.topicIndex].optionList[index].chooseOption = op
|
||||
this.questionList[this.topicIndex].clickAnswer = op
|
||||
}
|
||||
const falseList =storage.get('wrongList') || []
|
||||
const trueList =storage.get('rightList') || []
|
||||
if (!this.questionList[this.topicIndex].clickAnswer) {
|
||||
this.questionList[this.topicIndex].optionList[index].chooseOption =`${this.questionList[this.topicIndex].optionList[index].chooseOption?this.questionList[this.topicIndex].optionList[index].chooseOption:''}${op}`
|
||||
this.questionList[this.topicIndex].clickAnswer = `${this.questionList[this.topicIndex].optionList[index].clickAnswer?this.questionList[this.topicIndex].optionList[index].clickAnswer:''}${op}`
|
||||
}
|
||||
if(this.tCurrent!==1){
|
||||
if(this.questionList[this.topicIndex].clickAnswer===this.questionList[this.topicIndex].rightOp){
|
||||
const arr1=this.questionList[this.topicIndex].clickAnswer.split('')
|
||||
const arr2=this.questionList[this.topicIndex].trueAnswer.split('')
|
||||
if(this.isArrEqual(arr1,arr2)){
|
||||
if(!this.rightList.includes(this.questionList[this.topicIndex].questionId)){
|
||||
this.rightList.push(this.questionList[this.topicIndex].questionId)
|
||||
}
|
||||
console.log(this.rightList);
|
||||
if(!trueList.includes(this.questionList[this.topicIndex].questionId)){
|
||||
trueList.push(this.questionList[this.topicIndex].questionId)
|
||||
storage.set('rightList',trueList)
|
||||
}
|
||||
if(this.wrongList.includes(this.questionList[this.topicIndex].questionId)){
|
||||
const wIndex=this.wrongList.indexOf(this.questionList[this.topicIndex].questionId)
|
||||
this.wrongList.splice(wIndex,1)
|
||||
}
|
||||
if(falseList.includes(this.questionList[this.topicIndex].questionId)){
|
||||
const wIndex=falseList.indexOf(this.questionList[this.topicIndex].questionId)
|
||||
falseList.splice(wIndex,1)
|
||||
storage.set('wrongList',falseList)
|
||||
}
|
||||
if(this.topicIndex<this.questionList.length-1){
|
||||
this.topicIndex ++;
|
||||
this.qIndex=this.topicIndex
|
||||
@@ -403,6 +441,15 @@ export default {
|
||||
if(!this.wrongList.includes(this.questionList[this.topicIndex].questionId)){
|
||||
this.wrongList.push(this.questionList[this.topicIndex].questionId)
|
||||
}
|
||||
if(!falseList.includes(this.questionList[this.topicIndex].questionId)){
|
||||
falseList.push(this.questionList[this.topicIndex].questionId)
|
||||
storage.set('wrongList',falseList)
|
||||
}
|
||||
if(trueList.includes(this.questionList[this.topicIndex].questionId)){
|
||||
const rIndex=trueList.indexOf(this.questionList[this.topicIndex].questionId)
|
||||
trueList.splice(rIndex,1)
|
||||
storage.set('wrongList',trueList)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -411,309 +458,18 @@ export default {
|
||||
this.getQuestionList()
|
||||
this.renderSwiper(0)
|
||||
},
|
||||
getQuestionList() {
|
||||
this.questionList = [{
|
||||
questionId: 0,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第一题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'C',
|
||||
}, {
|
||||
questionId: 1,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第二题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'B',
|
||||
}, {
|
||||
questionId: 2,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第三题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'A',
|
||||
},
|
||||
{
|
||||
questionId: 3,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第四题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'A',
|
||||
}, {
|
||||
questionId: 4,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第5题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'A',
|
||||
},
|
||||
{
|
||||
questionId: 5,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第6题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'A',
|
||||
}, {
|
||||
questionId: 6,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第7题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'A',
|
||||
}, {
|
||||
questionId: 7,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第8题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'A',
|
||||
}, {
|
||||
questionId: 8,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第9题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'C',
|
||||
}, {
|
||||
questionId: 9,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第10题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'B',
|
||||
}, {
|
||||
questionId: 10,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第11题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'A',
|
||||
},
|
||||
{
|
||||
questionId: 11,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第12题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'A',
|
||||
}, {
|
||||
questionId: 12,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第13题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'A',
|
||||
},
|
||||
{
|
||||
questionId: 13,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第14题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'A',
|
||||
}, {
|
||||
questionId: 14,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第15题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'A',
|
||||
}, {
|
||||
questionId: 15,
|
||||
questionTypeDesc: '单选',
|
||||
questionDesc: '第16题,在实习期内驾驶机动车的,应当在车身后部粘贴或者悬挂哪种标志?',
|
||||
optionList: [{
|
||||
op: 'A',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'B',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'C',
|
||||
opDesc: '注意新手标志'
|
||||
}, {
|
||||
op: 'D',
|
||||
opDesc: '注意新手标志'
|
||||
}],
|
||||
rightOp: 'A',
|
||||
}
|
||||
]
|
||||
if(this.tCurrent===1){
|
||||
this.questionList=this.questionList.map(item=>{
|
||||
return{
|
||||
...item,
|
||||
clickAnswer:item.rightOp
|
||||
}
|
||||
})
|
||||
}
|
||||
getQuestionList(val) {
|
||||
console.log(val);
|
||||
this.questionList=val.map(item=>{
|
||||
let isCollect=false
|
||||
if(this.collectList.includes(item.questionId)){
|
||||
isCollect=true
|
||||
}
|
||||
return {
|
||||
isCollect:isCollect,
|
||||
...item
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user