|
@ -9,6 +9,20 @@ |
|
|
</template> |
|
|
</template> |
|
|
</up-navbar> |
|
|
</up-navbar> |
|
|
|
|
|
|
|
|
|
|
|
<view class="top_row flex"> |
|
|
|
|
|
<view class="itemCount"> |
|
|
|
|
|
<up-icon name="checkmark-circle-fill" color="#55ff7f" size="20" ></up-icon> |
|
|
|
|
|
<view class="count">{{ yesNum }}</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="itemCount"> |
|
|
|
|
|
<up-icon name="close-circle-fill" color="#ff0000" size="20" ></up-icon> |
|
|
|
|
|
<view class="count">{{ noNum }}</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
<view class="mr"> |
|
|
|
|
|
<view class="count">{{currentIndex}}/<text>{{questionBankList.length}}</text></view> |
|
|
|
|
|
</view> |
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view class="con padding"> |
|
|
<view class="con padding"> |
|
|
<view class="h1_row"> |
|
|
<view class="h1_row"> |
|
@ -27,7 +41,7 @@ |
|
|
<view class="text"><text >{{item.key}}</text> {{item.text}}</view> |
|
|
<view class="text"><text >{{item.key}}</text> {{item.text}}</view> |
|
|
</view> |
|
|
</view> |
|
|
<!-- 正常答案 --> |
|
|
<!-- 正常答案 --> |
|
|
<view class="optionItem flex" v-else @click="chooseOption(item)"> |
|
|
|
|
|
|
|
|
<view class="optionItem flex" v-else > |
|
|
<view class="icon" v-if="!curOption.key&&questionBank.types !=2"></view> |
|
|
<view class="icon" v-if="!curOption.key&&questionBank.types !=2"></view> |
|
|
<up-icon name="checkmark-circle-fill" color="#55ff7f" size="20" v-else-if="questionBank.answer.includes(item.key)"></up-icon> |
|
|
<up-icon name="checkmark-circle-fill" color="#55ff7f" size="20" v-else-if="questionBank.answer.includes(item.key)"></up-icon> |
|
|
<up-icon name="close-circle-fill" color="#ff0000" size="20" v-else></up-icon> |
|
|
<up-icon name="close-circle-fill" color="#ff0000" size="20" v-else></up-icon> |
|
@ -36,6 +50,7 @@ |
|
|
<!-- ans --> |
|
|
<!-- ans --> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<view class="answerCss flex" v-if="curOption.answer&&questionBank.answer!=curOption.answer"> |
|
|
<view class="answerCss flex" v-if="curOption.answer&&questionBank.answer!=curOption.answer"> |
|
|
<view class="ans">正确答案是 |
|
|
<view class="ans">正确答案是 |
|
|
<text v-if="questionBank.types==3" >{{ questionBank.answer=='false'?'错误':'正确' }}</text> |
|
|
<text v-if="questionBank.types==3" >{{ questionBank.answer=='false'?'错误':'正确' }}</text> |
|
@ -46,10 +61,11 @@ |
|
|
<text v-else class="red">{{ curOption.answer }}</text> |
|
|
<text v-else class="red">{{ curOption.answer }}</text> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<view class="btn_row flex-b"> |
|
|
<view class="btn_row flex-b"> |
|
|
<!-- @click="$goPage('/pages/exercises/lastPage/lastPage')" --> |
|
|
<!-- @click="$goPage('/pages/exercises/lastPage/lastPage')" --> |
|
|
<button class="btn border" @click="debounce(nextQuestion(-1), 500)" :class="{disable: currentIndex==1}" :disabled="currentIndex==1">上一题</button> |
|
|
<button class="btn border" @click="debounce(nextQuestion(-1), 500)" :class="{disable: currentIndex==1}" :disabled="currentIndex==1">上一题</button> |
|
|
<button class="btn bg" @click="debounce(nextQuestion(1), 500)" :class="{disable: currentIndex>=quesIdList.length}" :disabled="currentIndex>=quesIdList.length">下一题</button> |
|
|
|
|
|
|
|
|
<button class="btn bg" @click="debounce(nextQuestion(1), 500)" :class="{disable: currentIndex>=questionBankList.length}" :disabled="currentIndex>=questionBankList.length">下一题</button> |
|
|
</view> |
|
|
</view> |
|
|
<view class="analysis" v-if="currentNav==2||(curOption.answer&&curOption.answer!=questionBank.answer)"> |
|
|
<view class="analysis" v-if="currentNav==2||(curOption.answer&&curOption.answer!=questionBank.answer)"> |
|
|
<view class="tit">题目解析</view> |
|
|
<view class="tit">题目解析</view> |
|
@ -85,9 +101,10 @@ |
|
|
</view> |
|
|
</view> |
|
|
<view class="text">答题卡</view> |
|
|
<view class="text">答题卡</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="li" @click="$noDoFn"> |
|
|
|
|
|
|
|
|
<view class="li" @click="questionWrongColleFn"> |
|
|
<view class="icon"> |
|
|
<view class="icon"> |
|
|
<image src="@/static/images/theory/sc.png" mode=""></image> |
|
|
|
|
|
|
|
|
<image src="@/static/images/theory/scActive.png" mode="" v-if="questionBank.isCollect=='1'"></image> |
|
|
|
|
|
<image src="@/static/images/theory/sc.png" mode="" v-else></image> |
|
|
</view> |
|
|
</view> |
|
|
<view class="text">收藏</view> |
|
|
<view class="text">收藏</view> |
|
|
</view> |
|
|
</view> |
|
@ -116,7 +133,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
<view class="ul2"> |
|
|
<view class="ul2"> |
|
|
<view class="li2" v-for="(item,index) in quesIdList" :key="index" @click="quesIdListClick(item,index)"> |
|
|
|
|
|
|
|
|
<view class="li2" v-for="(item,index) in questionBankList" :key="index" @click="quesIdListClick(item,index)"> |
|
|
<view class="num" :class="{active: index+1==currentIndex}">{{ index+1 }}</view> |
|
|
<view class="num" :class="{active: index+1==currentIndex}">{{ index+1 }}</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
|
</view> |
|
@ -139,11 +156,12 @@ |
|
|
window.speechSynthesis.speak(speech); // 播报消息 |
|
|
window.speechSynthesis.speak(speech); // 播报消息 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
import { startExam, submitAnswerResultApi, getQuestionApi, questionCommentAdd } from '@/config/api.js' |
|
|
|
|
|
|
|
|
import { startExam, submitAnswerResultApi, getQuestionApi, questionCommentAdd, startExamDo, questionWrongColle } from '@/config/api.js' |
|
|
import { debounce } from '@/uni_modules/uview-plus'; |
|
|
import { debounce } from '@/uni_modules/uview-plus'; |
|
|
import { |
|
|
import { |
|
|
ref, |
|
|
ref, |
|
|
reactive |
|
|
|
|
|
|
|
|
reactive, |
|
|
|
|
|
watch |
|
|
} from 'vue'; |
|
|
} from 'vue'; |
|
|
const currentNav = ref('1') |
|
|
const currentNav = ref('1') |
|
|
const types = ref([ |
|
|
const types = ref([ |
|
@ -154,6 +172,8 @@ |
|
|
const yesNum = ref(0) |
|
|
const yesNum = ref(0) |
|
|
const noNum = ref(0) |
|
|
const noNum = ref(0) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import carStore from '@/store/modules/car.js' |
|
|
import carStore from '@/store/modules/car.js' |
|
|
let usecarStore = carStore() |
|
|
let usecarStore = carStore() |
|
|
|
|
|
|
|
@ -210,6 +230,7 @@ |
|
|
} |
|
|
} |
|
|
// 请求数据 |
|
|
// 请求数据 |
|
|
const questionBank = ref({}) |
|
|
const questionBank = ref({}) |
|
|
|
|
|
const questionBankList = ref([]) |
|
|
let quesIdList = ref([]) |
|
|
let quesIdList = ref([]) |
|
|
let currentIndex = ref(1) |
|
|
let currentIndex = ref(1) |
|
|
async function startQuestionFn() { |
|
|
async function startQuestionFn() { |
|
@ -224,7 +245,8 @@ |
|
|
} |
|
|
} |
|
|
const {data: res} = await startExam(obj) |
|
|
const {data: res} = await startExam(obj) |
|
|
uni.hideLoading() |
|
|
uni.hideLoading() |
|
|
questionBank.value = res.questionBank |
|
|
|
|
|
|
|
|
questionBank.value = res.questionBank[0] |
|
|
|
|
|
questionBankList.value = res.questionBank |
|
|
initOptionArr() |
|
|
initOptionArr() |
|
|
quesIdList.value = res.quesIdList |
|
|
quesIdList.value = res.quesIdList |
|
|
}catch(e){ |
|
|
}catch(e){ |
|
@ -233,6 +255,11 @@ |
|
|
} |
|
|
} |
|
|
startQuestionFn() |
|
|
startQuestionFn() |
|
|
|
|
|
|
|
|
|
|
|
watch(()=>questionBankList, (newVal, oldVal)=>{ |
|
|
|
|
|
yesNum.value = oldVal.value.filter(item=>item.yes).length |
|
|
|
|
|
noNum.value = oldVal.value.filter(item=>item.yes==0).length |
|
|
|
|
|
}, {deep: true}) |
|
|
|
|
|
|
|
|
function initOptionArr() { |
|
|
function initOptionArr() { |
|
|
questionBank.value.optionArr = [] |
|
|
questionBank.value.optionArr = [] |
|
|
let abcd = [ |
|
|
let abcd = [ |
|
@ -287,16 +314,16 @@ |
|
|
// 请求下一题 |
|
|
// 请求下一题 |
|
|
async function getQuestionFn() { |
|
|
async function getQuestionFn() { |
|
|
console.log(currentIndex.value) |
|
|
console.log(currentIndex.value) |
|
|
let questionId = quesIdList.value[currentIndex.value-1] |
|
|
|
|
|
let obj = { |
|
|
|
|
|
"carType": usecarStore.carInfo.carType, |
|
|
|
|
|
"questionId": questionId, |
|
|
|
|
|
"sort": currentIndex.value, |
|
|
|
|
|
"stepType": usecarStore.carInfo.stepType, |
|
|
|
|
|
'tempId': questionBank.value.questionDoTemp.id |
|
|
|
|
|
} |
|
|
|
|
|
const {data: res} = await getQuestionApi(obj) |
|
|
|
|
|
questionBank.value = res |
|
|
|
|
|
|
|
|
// let questionId = quesIdList.value[currentIndex.value-1] |
|
|
|
|
|
// let obj = { |
|
|
|
|
|
// "carType": usecarStore.carInfo.carType, |
|
|
|
|
|
// "questionId": questionId, |
|
|
|
|
|
// "sort": currentIndex.value, |
|
|
|
|
|
// "stepType": usecarStore.carInfo.stepType, |
|
|
|
|
|
// 'tempId': questionBank.value.questionDoTemp.id |
|
|
|
|
|
// } |
|
|
|
|
|
// const {data: res} = await getQuestionApi(obj) |
|
|
|
|
|
questionBank.value = questionBankList.value[currentIndex.value] |
|
|
curOption.value.isNext = '' |
|
|
curOption.value.isNext = '' |
|
|
initOptionArr() |
|
|
initOptionArr() |
|
|
} |
|
|
} |
|
@ -306,16 +333,36 @@ |
|
|
getQuestionFn() |
|
|
getQuestionFn() |
|
|
show.value = false |
|
|
show.value = false |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async function questionWrongColleFn() { |
|
|
|
|
|
let isAdd = questionBank.value.isCollect==1?'0':'1' |
|
|
|
|
|
const obj = { |
|
|
|
|
|
"carType": usecarStore.carInfo.carType, |
|
|
|
|
|
"isAdd": isAdd, |
|
|
|
|
|
"questionId": questionBank.value.id, |
|
|
|
|
|
"stepType": usecarStore.carInfo.stepType |
|
|
|
|
|
} |
|
|
|
|
|
const res = await questionWrongColle(obj) |
|
|
|
|
|
questionBank.value.isCollect = isAdd |
|
|
|
|
|
console.log(questionBank.value.isCollect) |
|
|
|
|
|
} |
|
|
// 选择答案 |
|
|
// 选择答案 |
|
|
const curOption = ref({}) |
|
|
const curOption = ref({}) |
|
|
async function chooseOption(item) { |
|
|
async function chooseOption(item) { |
|
|
// console.log(item) |
|
|
|
|
|
|
|
|
console.log(item) |
|
|
if(curOption.value.answer) return |
|
|
if(curOption.value.answer) return |
|
|
if(questionBank.value.types != 2) { |
|
|
if(questionBank.value.types != 2) { |
|
|
item.answer = item.key |
|
|
|
|
|
curOption.value = item |
|
|
|
|
|
submitAnswerResultFn() |
|
|
|
|
|
|
|
|
// 如果答案正确 下一题 |
|
|
|
|
|
if(questionBank.value.answer==item.key) { |
|
|
|
|
|
questionBank.value.yes = 1 |
|
|
|
|
|
currentIndex.value = currentIndex.value + 1 |
|
|
|
|
|
curOption.value = {} |
|
|
|
|
|
getQuestionFn() |
|
|
|
|
|
}else { |
|
|
|
|
|
item.answer = item.key |
|
|
|
|
|
curOption.value = item |
|
|
|
|
|
questionBank.value.yes = 0 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}else if(questionBank.value.types == 2){ |
|
|
}else if(questionBank.value.types == 2){ |
|
|
if(!curOption.value.ans) curOption.value.ans = '' |
|
|
if(!curOption.value.ans) curOption.value.ans = '' |
|
|
if(curOption.value.ans.includes(item.key)) { |
|
|
if(curOption.value.ans.includes(item.key)) { |
|
@ -351,6 +398,27 @@ |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
<style lang="scss" scoped> |
|
|
|
|
|
.top_row { |
|
|
|
|
|
height: 88rpx; |
|
|
|
|
|
font-weight: 500; |
|
|
|
|
|
font-size: 24rpx; |
|
|
|
|
|
color: #333333; |
|
|
|
|
|
border-bottom: 2rpx solid #F4F4F4; |
|
|
|
|
|
padding: 0 30rpx; |
|
|
|
|
|
margin-bottom: 30rpx; |
|
|
|
|
|
.itemCount { |
|
|
|
|
|
margin-right: 60rpx; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
align-items: center; |
|
|
|
|
|
.count { |
|
|
|
|
|
margin-left: 20rpx; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
.mr { |
|
|
|
|
|
margin-left: auto; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
image {display: block;width: 100%;height: 100%;} |
|
|
image {display: block;width: 100%;height: 100%;} |
|
|
.bottomBar { |
|
|
.bottomBar { |
|
|
position: fixed; |
|
|
position: fixed; |
|
|