|
|
@ -15,6 +15,7 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="flex m14lr ai-c mt20" v-for="(item,index) in quesItem.optionList" |
|
|
|
<view class="flex m14lr ai-c mt20" v-for="(item,index) in quesItem.optionList" |
|
|
|
:key="item.op" @tap="answerQues(item.opValue,index)"> |
|
|
|
:key="item.op" @tap="answerQues(item.opValue,index)"> |
|
|
|
|
|
|
|
<template v-if="item.opDesc"> |
|
|
|
<template |
|
|
|
<template |
|
|
|
v-if="quesItem.clickAnswer&&quesItem.trueAnswer.includes(item.opValue)"> |
|
|
|
v-if="quesItem.clickAnswer&&quesItem.trueAnswer.includes(item.opValue)"> |
|
|
|
<u-icon class="mr15" name="checkmark-circle-fill" color="#05C341" size="32"></u-icon> |
|
|
|
<u-icon class="mr15" name="checkmark-circle-fill" color="#05C341" size="32"></u-icon> |
|
|
@ -27,6 +28,7 @@ |
|
|
|
<view class="option_item">{{item.op}}</view> |
|
|
|
<view class="option_item">{{item.op}}</view> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
<text class="fs18">{{item.opDesc}}</text> |
|
|
|
<text class="fs18">{{item.opDesc}}</text> |
|
|
|
|
|
|
|
</template> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="m14lr mt30" |
|
|
|
<view class="m14lr mt30" |
|
|
|
v-if="quesItem.clickAnswer&&!quesItem.trueAnswer.includes(quesItem.clickAnswer) || tCurrent===1"> |
|
|
|
v-if="quesItem.clickAnswer&&!quesItem.trueAnswer.includes(quesItem.clickAnswer) || tCurrent===1"> |
|
|
@ -43,7 +45,7 @@ |
|
|
|
<view style="width: 220rpx;"> |
|
|
|
<view style="width: 220rpx;"> |
|
|
|
<button v-if="type==='practice'" class="btn">四步学科一</button> |
|
|
|
<button v-if="type==='practice'" class="btn">四步学科一</button> |
|
|
|
<view v-else class="btn" style="text-align: center;" @tap="submitPaper"> |
|
|
|
<view v-else class="btn" style="text-align: center;" @tap="submitPaper"> |
|
|
|
<u-count-down ref="countDown_1" :time="1 * 60 * 60 * 1000" format="HH:mm:ss"></u-count-down> |
|
|
|
<u-count-down ref="countDown_1" :time=" 1*60*60 * 1000" format="HH:mm:ss" @change="timeChange"></u-count-down> |
|
|
|
<text>交卷</text> |
|
|
|
<text>交卷</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -90,7 +92,7 @@ |
|
|
|
<text>确认交卷</text> |
|
|
|
<text>确认交卷</text> |
|
|
|
<view class="mt20 flex ai-c jc-sb"> |
|
|
|
<view class="mt20 flex ai-c jc-sb"> |
|
|
|
<view class="text-center"> |
|
|
|
<view class="text-center"> |
|
|
|
<text style="color:#FF6E02">99</text> |
|
|
|
<text style="color:#FF6E02">{{questionList.length-rightList.length-wrongList.length}}</text> |
|
|
|
<view class="cor-333">未答题数</view> |
|
|
|
<view class="cor-333">未答题数</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="text-center"> |
|
|
|
<view class="text-center"> |
|
|
@ -98,7 +100,7 @@ |
|
|
|
<view>剩余时间</view> |
|
|
|
<view>剩余时间</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="text-center"> |
|
|
|
<view class="text-center"> |
|
|
|
<text style="color:#333">9</text> |
|
|
|
<text style="color:#333">{{(rightList.length/questionList.length * 100).toFixed(0)}}</text> |
|
|
|
<view class="cor-333">考试得分</view> |
|
|
|
<view class="cor-333">考试得分</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -186,7 +188,15 @@ |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
|
|
|
|
import { |
|
|
|
|
|
|
|
mapState, |
|
|
|
|
|
|
|
mapActions |
|
|
|
|
|
|
|
} from 'pinia' //引入映射函数 |
|
|
|
import storage from '@/jtools/storage'; |
|
|
|
import storage from '@/jtools/storage'; |
|
|
|
|
|
|
|
import useQuestionStore from '@/jtools/store/question' //引入store |
|
|
|
|
|
|
|
import { |
|
|
|
|
|
|
|
submitTest |
|
|
|
|
|
|
|
} from '@/jtools/api/question'; |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
props:{ |
|
|
|
props:{ |
|
|
|
tabsList:{ |
|
|
|
tabsList:{ |
|
|
@ -203,6 +213,13 @@ export default { |
|
|
|
isShowAll:{ |
|
|
|
isShowAll:{ |
|
|
|
type:Boolean, |
|
|
|
type:Boolean, |
|
|
|
default:true |
|
|
|
default:true |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
subject:{ |
|
|
|
|
|
|
|
type:[String,Number], |
|
|
|
|
|
|
|
default:1, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
navTitle:{ |
|
|
|
|
|
|
|
type:String |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
data() { |
|
|
|
data() { |
|
|
@ -218,19 +235,34 @@ export default { |
|
|
|
qIndex:0, |
|
|
|
qIndex:0, |
|
|
|
rightList:[], |
|
|
|
rightList:[], |
|
|
|
wrongList:[], |
|
|
|
wrongList:[], |
|
|
|
collectList:storage.get('collectList') || [], |
|
|
|
collectList:storage.get(`collectList_subject${this.subject}`) || [], |
|
|
|
questionList: [{isCollect:true}],//数据源 |
|
|
|
questionList: [{isCollect:true}],//数据源 |
|
|
|
swiperList: [], // 轮播图数据列表 |
|
|
|
swiperList: [], // 轮播图数据列表 |
|
|
|
swiperIndex: 0, // 轮播图当前位置 |
|
|
|
swiperIndex: 0, // 轮播图当前位置 |
|
|
|
isChange: false, // 是否切换 |
|
|
|
isChange: false, // 是否切换 |
|
|
|
topicIndex: 0, // 题目位置 |
|
|
|
topicIndex: 0, // 题目位置 |
|
|
|
duration: 200, // 动画过渡时长 |
|
|
|
duration: 200, // 动画过渡时长 |
|
|
|
|
|
|
|
time:0, |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
|
|
|
|
this.renderSwiper(0) |
|
|
|
computed: { |
|
|
|
|
|
|
|
...mapState(useQuestionStore, ["currentIndex_subject1","currentIndex_subject2"]) //映射函数,取出tagslist |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
|
|
|
|
...mapActions(useQuestionStore,['getCurrentIndex']), |
|
|
|
|
|
|
|
timeChange(e){ |
|
|
|
|
|
|
|
this.time=e |
|
|
|
|
|
|
|
if(e.hours==0&&e.minutes==0&&e.seconds==0&&e.milliseconds==0){ |
|
|
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
|
|
title:"考试结束,将为您自动交卷~", |
|
|
|
|
|
|
|
icon:'none' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
setTimeout(()=>{ |
|
|
|
|
|
|
|
this.toSubmit() |
|
|
|
|
|
|
|
},1000) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
//获取正确选项 |
|
|
|
//获取正确选项 |
|
|
|
getRightOp(val){ |
|
|
|
getRightOp(val){ |
|
|
|
let rightOp='' |
|
|
|
let rightOp='' |
|
|
@ -278,8 +310,20 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
//交卷 |
|
|
|
//交卷 |
|
|
|
toSubmit(){ |
|
|
|
toSubmit(){ |
|
|
|
|
|
|
|
const restTime=this.time.hours*60*60+this.time.minutes*60+this.time.seconds |
|
|
|
|
|
|
|
const score=(this.rightList.length/this.questionList.length * 100).toFixed(0) |
|
|
|
|
|
|
|
submitTest({ |
|
|
|
|
|
|
|
"carTypeId": storage.get('carType') || '1001', |
|
|
|
|
|
|
|
"score": score, |
|
|
|
|
|
|
|
"testTime": 60*60-restTime, |
|
|
|
|
|
|
|
}).then(resp=>{ |
|
|
|
|
|
|
|
const doNotNum=this.questionList.length-this.rightList.length-this.wrongList.length |
|
|
|
|
|
|
|
const list = JSON.stringify(this.wrongList) |
|
|
|
|
|
|
|
if(resp.code==='0000'){ |
|
|
|
uni.navigateTo({ |
|
|
|
uni.navigateTo({ |
|
|
|
url:"/pages/questionBank/examResult" |
|
|
|
url:"/pages/questionBank/examResult?doNotNum="+doNotNum+"&wrongList="+list+"&score="+score+"&subject="+this.subject |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
//查看考试结果 |
|
|
|
//查看考试结果 |
|
|
@ -307,7 +351,7 @@ export default { |
|
|
|
icon:'none' |
|
|
|
icon:'none' |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
storage.set('collectList',this.collectList) |
|
|
|
storage.set(`collectList_subject${this.subject}`,this.collectList) |
|
|
|
}, |
|
|
|
}, |
|
|
|
cancel(){ |
|
|
|
cancel(){ |
|
|
|
this.tipShow=false |
|
|
|
this.tipShow=false |
|
|
@ -360,6 +404,7 @@ export default { |
|
|
|
// 轮播图当前位置小于原来时则表示为上一题 |
|
|
|
// 轮播图当前位置小于原来时则表示为上一题 |
|
|
|
this.topicIndex--; |
|
|
|
this.topicIndex--; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.getCurrentIndex(this.topicIndex,this.subject) |
|
|
|
// 更新轮播图位置数值,为更新时让 Vue 能监听到数据有改变 |
|
|
|
// 更新轮播图位置数值,为更新时让 Vue 能监听到数据有改变 |
|
|
|
this.swiperIndex = e.detail.current; |
|
|
|
this.swiperIndex = e.detail.current; |
|
|
|
}, |
|
|
|
}, |
|
|
@ -385,6 +430,7 @@ export default { |
|
|
|
// 选择题目 |
|
|
|
// 选择题目 |
|
|
|
pickerTopic(index) { |
|
|
|
pickerTopic(index) { |
|
|
|
this.topicIndex = index; |
|
|
|
this.topicIndex = index; |
|
|
|
|
|
|
|
this.getCurrentIndex(this.topicIndex,this.subject) |
|
|
|
this.renderSwiper(index); |
|
|
|
this.renderSwiper(index); |
|
|
|
}, |
|
|
|
}, |
|
|
|
isArrEqual(arr1, arr2){ |
|
|
|
isArrEqual(arr1, arr2){ |
|
|
@ -392,8 +438,8 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
//答题 |
|
|
|
//答题 |
|
|
|
answerQues(op, index) { |
|
|
|
answerQues(op, index) { |
|
|
|
const falseList =storage.get('wrongList') || [] |
|
|
|
const falseList =storage.get(`wrongList_subject${this.subject}`) || [] |
|
|
|
const trueList =storage.get('rightList') || [] |
|
|
|
const trueList =storage.get(`rightList_subject${this.subject}`) || [] |
|
|
|
if (!this.questionList[this.topicIndex].clickAnswer) { |
|
|
|
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].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}` |
|
|
|
this.questionList[this.topicIndex].clickAnswer = `${this.questionList[this.topicIndex].optionList[index].clickAnswer?this.questionList[this.topicIndex].optionList[index].clickAnswer:''}${op}` |
|
|
@ -402,12 +448,14 @@ export default { |
|
|
|
const arr1=this.questionList[this.topicIndex].clickAnswer.split('') |
|
|
|
const arr1=this.questionList[this.topicIndex].clickAnswer.split('') |
|
|
|
const arr2=this.questionList[this.topicIndex].trueAnswer.split('') |
|
|
|
const arr2=this.questionList[this.topicIndex].trueAnswer.split('') |
|
|
|
if(this.isArrEqual(arr1,arr2)){ |
|
|
|
if(this.isArrEqual(arr1,arr2)){ |
|
|
|
|
|
|
|
//判断选择的答案和实际的答案是否相同,如果相同,判断如果该题的ID在不在正确的数组中,不在则Push(存储的的同理) |
|
|
|
|
|
|
|
//如果这道题在错误的数组中则把这道题在错误数组中删掉 |
|
|
|
if(!this.rightList.includes(this.questionList[this.topicIndex].questionId)){ |
|
|
|
if(!this.rightList.includes(this.questionList[this.topicIndex].questionId)){ |
|
|
|
this.rightList.push(this.questionList[this.topicIndex].questionId) |
|
|
|
this.rightList.push(this.questionList[this.topicIndex].questionId) |
|
|
|
} |
|
|
|
} |
|
|
|
if(!trueList.includes(this.questionList[this.topicIndex].questionId)){ |
|
|
|
if(!trueList.includes(this.questionList[this.topicIndex].questionId)){ |
|
|
|
trueList.push(this.questionList[this.topicIndex].questionId) |
|
|
|
trueList.push(this.questionList[this.topicIndex].questionId) |
|
|
|
storage.set('rightList',trueList) |
|
|
|
storage.set(`rightList_subject${this.subject}`,trueList) |
|
|
|
} |
|
|
|
} |
|
|
|
if(this.wrongList.includes(this.questionList[this.topicIndex].questionId)){ |
|
|
|
if(this.wrongList.includes(this.questionList[this.topicIndex].questionId)){ |
|
|
|
const wIndex=this.wrongList.indexOf(this.questionList[this.topicIndex].questionId) |
|
|
|
const wIndex=this.wrongList.indexOf(this.questionList[this.topicIndex].questionId) |
|
|
@ -416,8 +464,9 @@ export default { |
|
|
|
if(falseList.includes(this.questionList[this.topicIndex].questionId)){ |
|
|
|
if(falseList.includes(this.questionList[this.topicIndex].questionId)){ |
|
|
|
const wIndex=falseList.indexOf(this.questionList[this.topicIndex].questionId) |
|
|
|
const wIndex=falseList.indexOf(this.questionList[this.topicIndex].questionId) |
|
|
|
falseList.splice(wIndex,1) |
|
|
|
falseList.splice(wIndex,1) |
|
|
|
storage.set('wrongList',falseList) |
|
|
|
storage.set(`wrongList_subject${this.subject}`,falseList) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//答对题目 如果不是最后一题,跳下一题 |
|
|
|
if(this.topicIndex<this.questionList.length-1){ |
|
|
|
if(this.topicIndex<this.questionList.length-1){ |
|
|
|
this.topicIndex ++; |
|
|
|
this.topicIndex ++; |
|
|
|
this.qIndex=this.topicIndex |
|
|
|
this.qIndex=this.topicIndex |
|
|
@ -443,12 +492,12 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
if(!falseList.includes(this.questionList[this.topicIndex].questionId)){ |
|
|
|
if(!falseList.includes(this.questionList[this.topicIndex].questionId)){ |
|
|
|
falseList.push(this.questionList[this.topicIndex].questionId) |
|
|
|
falseList.push(this.questionList[this.topicIndex].questionId) |
|
|
|
storage.set('wrongList',falseList) |
|
|
|
storage.set(`wrongList_subject${this.subject}`,falseList) |
|
|
|
} |
|
|
|
} |
|
|
|
if(trueList.includes(this.questionList[this.topicIndex].questionId)){ |
|
|
|
if(trueList.includes(this.questionList[this.topicIndex].questionId)){ |
|
|
|
const rIndex=trueList.indexOf(this.questionList[this.topicIndex].questionId) |
|
|
|
const rIndex=trueList.indexOf(this.questionList[this.topicIndex].questionId) |
|
|
|
trueList.splice(rIndex,1) |
|
|
|
trueList.splice(rIndex,1) |
|
|
|
storage.set('wrongList',trueList) |
|
|
|
storage.set(`rightList_subject${this.subject}`,trueList) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -459,17 +508,23 @@ export default { |
|
|
|
this.renderSwiper(0) |
|
|
|
this.renderSwiper(0) |
|
|
|
}, |
|
|
|
}, |
|
|
|
getQuestionList(val) { |
|
|
|
getQuestionList(val) { |
|
|
|
console.log(val); |
|
|
|
const arr = JSON.parse(val) |
|
|
|
this.questionList=val.map(item=>{ |
|
|
|
this.questionList=[] |
|
|
|
|
|
|
|
arr.forEach(item=>{ |
|
|
|
let isCollect=false |
|
|
|
let isCollect=false |
|
|
|
if(this.collectList.includes(item.questionId)){ |
|
|
|
if(this.collectList.includes(item.questionId)){ |
|
|
|
isCollect=true |
|
|
|
isCollect=true |
|
|
|
} |
|
|
|
} |
|
|
|
return { |
|
|
|
this.questionList.push({ |
|
|
|
isCollect:isCollect, |
|
|
|
isCollect:isCollect, |
|
|
|
...item |
|
|
|
...item |
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
if(this.navTitle==='顺序答题'){ |
|
|
|
|
|
|
|
this.pickerTopic(this[`currentIndex_subject${this.subject}`]) |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
this.renderSwiper(0) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|