Browse Source

防真考试

master
unknown 1 week ago
parent
commit
b3fb0e095c
  1. 3
      config/api.js
  2. 6
      pages/exercises/beforeExam/beforeExam.vue
  3. 2
      pages/exercises/brushQuestions/brushQuestions.vue
  4. 2
      pages/exercises/brushQuestions/examQuestions.vue
  5. 500
      pages/exercises/exam/exam.vue
  6. 1
      pages/exercises/examSubjiect1/examSubjiect1.vue
  7. 17
      pages/exercises/theoryStudy/theoryStudy.vue

3
config/api.js

@ -60,6 +60,8 @@ export const logOut = (data={}) => http.post('member/auth/logout', data, {custom
export const startExamDo = (data) => http.post('questionExam/saveExam.do', data,)
// 考试结果页
export const examId = (data) => http.post(`questionExam/result-${examId}`, data,)
// 模拟考试次数、通过率
export const idexExam = (data) => http.get(`idex/exam-${data.stepType}-${data.carType}`, )
@ -67,7 +69,6 @@ export const logOut = (data={}) => http.post('member/auth/logout', data, {custom

6
pages/exercises/beforeExam/beforeExam.vue

@ -4,7 +4,7 @@
<view class="backIcon" @click="goBack">
<image src="@/static/images/backIcon.png" mode="aspectFill"></image>
</view>
<view class="txt">驾驶人科目一考试系统</view>
<view class="txt">驾驶人科目{{ usecarStore.carInfo.stepType==1?'': '四'}}考试系统</view>
</view>
<view class="con">
@ -27,7 +27,7 @@
<!-- <view class="redt">身份证号123456789123456789</view> -->
<view class="redt">考生{{ phone }}</view>
<view class="btn" @click="$goPage('/pages/exercises/exam/exam?randomNumber='+ randomNumber)">开始考试</view>
<view class="redt">点击确认按钮开始考试!</view>
<view class="redt">点击开始考试按钮开始考试!</view>
<view class="text">操作提示每题考试答案确定后点击下一题电脑立即判定所选答案如选择错误系统将提示正确答案提示后不允许修改答案</view>
</view>
</view>
@ -39,6 +39,8 @@
<script setup>
import { detectOrient } from '@/utils/utils.js'
import { ref, onMounted, nextTick } from 'vue'
import carStore from '@/store/modules/car.js'
let usecarStore = carStore()
let phone = uni.getStorageSync('loginInfo')?.phone
onMounted(()=>{
detectOrient('#beforeExam')

2
pages/exercises/brushQuestions/brushQuestions.vue

@ -325,7 +325,7 @@
curOption.value.ans = curOption.value.ans.replace(item.key, '')
return
}
curOption.value.ans = curOption.value.ans + item.key
curOption.value.ans = (curOption.value.ans + item.key).split('').sort().join('')
// console.log(curOption.value.ans)
}
}

2
pages/exercises/brushQuestions/examQuestions.vue

@ -414,7 +414,7 @@
curOption.value.ans = curOption.value.ans.replace(item.key, '')
return
}
curOption.value.ans = curOption.value.ans + item.key
curOption.value.ans = (curOption.value.ans + item.key).split('').sort().join('')
// console.log(curOption.value.ans)
}
}

500
pages/exercises/exam/exam.vue

@ -1,96 +1,161 @@
<template>
<view class="content" id="brushQuestions">
<view class="row row1">
<view class="userInfoBox">
<view class="examNo">
<view class="h3">洛阳学车</view>
<view class="card">第0{{ randomNumber }}号台</view>
<view class="back" @click="goBack">
<u-icon name="arrow-left" size="16"></u-icon>
<view id="brushQuestions">
<view class="content">
<view class="row row1">
<view class="userInfoBox">
<view class="examNo">
<view class="h3">洛阳学车</view>
<view class="card">第0{{ randomNumber }}号台</view>
<view class="back" @click="goBack">
<u-icon name="arrow-left" size="16"></u-icon>
</view>
</view>
</view>
<view class="user">
<view class="card">
<view class="h3">考生信息</view>
<view class="avatar">
<image src="@/static/images/avatarbg.png" mode=""></image>
<view class="user">
<view class="card">
<view class="h3">考生信息</view>
<view class="avatar">
<image src="@/static/images/avatarbg.png" mode=""></image>
</view>
<view class="txt">用户 <text style="margin-top: 10rpx;">{{ phone }}</text></view>
<!-- <view class="txt">性别</view> -->
<view class="txt">类型{{ usecarStore.carInfo.carTypeName}}</view>
<view class="txt">科目科目{{ usecarStore.carInfo.stepType==1?'一': '四'}}</view>
</view>
<view class="txt">用户{{ phone }}</view>
<!-- <view class="txt">性别</view> -->
<view class="txt">类型{{ usecarStore.carInfo.carTypeName}}</view>
<view class="txt">科目科目{{ usecarStore.carInfo.stepType==1?'一': '四'}}</view>
</view>
</view>
</view>
<view class="examConBox">
<view class="leftBox">
<view class="h3">考试题目</view>
<view class="questionTxt">
<view class="txt">{{currentIndex+1}}.{{ questionBank.title }}</view>
<view class="txt" v-for="(item,index) in questionBank.optionArr">
<view class="text"><text >{{item.key}}</text> {{item.text}}</view>
<view class="examConBox">
<view class="leftBox">
<view class="h3">考试题目</view>
<view class="questionTxt">
<view class="txt">{{currentIndex+1}}.{{ questionBank.title }}</view>
<view class="txt" v-for="(item,index) in questionBank.optionArr">
<view class="text"><text >{{item.key}}</text> {{item.text}}</view>
</view>
</view>
</view>
<view class="answer flex-b">
<view class="lab">您的答案{{ curOption.answer }}</view>
<view class="rightSelect flex">
<view class="lab">选项</view>
<view class="optio flex" v-for="(item,index) in questionBank.optionArr" >
<view class="optionItem" :class="{ active: curOption.answer.includes(item.key)}" @click="chooseOption(item)">{{item.key}}</view>
<view class="answer flex-b">
<view class="lab">您的答案
<text v-if="questionBank.types==3">{{ curOption.answer=='true'?'A':'B'}}</text>
<text v-else>{{ curOption.answer}}</text>
</view>
<view class="rightSelect flex">
<view class="lab">选项</view>
<view class="optio flex" v-for="(item,index) in questionBank.optionArr" >
<view class="optionItem" :class="{ active: curOption.answer?.includes(item.key)}" @click="chooseOption(item)">{{item.key}}</view>
</view>
</view>
</view>
</view>
<view class="rightBox">
<!-- 右边盒子 -->
<table style="width: 100%;height: 100%;" v-if="ansCard.length">
<tr>
<th class="blueItem br">题目</th>
<th v-for="(item,index) in usecarStore.carInfo.stepType==1?10:5" class="blueItem br">{{index+1}}</th>
</tr>
<tr v-for="(item,index) in ansCard">
<td class="blueItem bb">{{index+1}}</td>
<td v-for="(item2,index2) in item" class="ansItem" :class="{green: item2.answer==item2.answerMy}" @click="ansCardClick(item2)">
<text v-if="item2.types==3&&item2.answerMy" class="flex" style="justify-content: center;">
<up-icon name="checkmark" color="#55ff7f" size="18" v-if="item2.answer==item2.answerMy"></up-icon>
<up-icon name="close" color="#ff0000" size="18" v-else></up-icon>
</text>
<text v-else>{{ item2.answerMy }}</text>
</td>
</tr>
</table>
</view>
</view>
<view class="rightBox">
<!-- 右边盒子 -->
<table style="width: 100%;height: 100%;">
<tr>
<th class="blueItem br">题目</th>
<th v-for="(item,index) in 10" class="blueItem br">{{index+1}}</th>
</tr>
<tr v-for="(item,index) in 10">
<td class="blueItem bb">{{index+1}}</td>
<td v-for="(item2,index2) in 10" class="ansItem">{{ item2 }}</td>
</tr>
</table>
</view>
<view class="row row2">
<view class="timeBox">
<view class="h3">考试时间</view>
<view class="time"><up-count-down :time="info.totalExamTime * 60 * 1000" format="mm:ss" @finish="finishFn" ref="countDownRef"></up-count-down></view>
</view>
<view class="leftTpsBox">
<view class="card">
<view class="h3">操作提示</view>
<view class="txt">本题为{{types[questionBank.types-1]}}请在备选答案中选择 {{ questionBank.types==2? '多': '一'}}个你认为正确的答案</view>
</view>
</view>
<view class="rightBtnBox">
<button class="btn hui" @click="debounce(nextQuestion(-1), 500)" :class="{disable: currentIndex==0}" :disabled="currentIndex==0">上一题</button>
<button class="btn hui" @click="debounce(nextQuestion(1), 500)" :class="{disable: currentIndex>=questionBankList.length-1}" :disabled="currentIndex>=questionBankList.length-1">下一题</button>
<view class="btn"@click="handApaper"> </view>
</view>
</view>
<view class="picBox">
<view class="h3">考题图片</view>
<view class="imgBox">
<image :src="questionBank.img" v-if="questionBank.img" @click="previewImg" mode="aspectFit"></image>
</view>
<u-popup :show="show" mode="center" :closeable="true" @close="show=false" bgColor="transparent">
<view class="imgView">
<!-- <view class="closeIcon" @click="show=false">
<u-icon name="close-circle" color="#fff" size="28"></u-icon>
</view> -->
<view class="img">
<image :src="questionBank.img" mode="aspectFit"></image>
</view>
</view>
</u-popup>
</view>
</view>
<view class="row row2">
<view class="timeBox">
<view class="h3">考试时间</view>
<view class="time">1510</view>
</view>
<view class="leftTpsBox">
<view class="card">
<view class="h3">操作提示</view>
<view class="txt">本题为单选题请在备选答案中选择一个你认为正确的答案</view>
<u-popup :show="showCommit" mode="center" :closeable="true" round="10" @close="closeCommitPopup" >
<view class="commitView">
<view class="commitTit">考试确认窗口</view>
<view class="commitTxt">你当前考试答对{{yesNum}}答错{{ questionBankList.length-yesNum-noNum}}未答{{ noNum }} </view>
<view class="commitTxt">1点击确认交卷将提交考试成绩考试结束</view>
<view class="commitTxt">2点击继续考试将关闭本窗口继续考试</view>
<view class="commitBtn">
<view class="btn border" @click="submitBtnFn">确定交卷</view>
<view class="btn" @click="closeCommitPopup">继续考试</view>
</view>
</view>
<view class="rightBtnBox">
<view class="btn hui">上一题</view>
<view class="btn hui">下一题</view>
<view class="btn" @click="$goPage('/pages/exercises/examResults/examResults')">交卷</view>
</view>
</view>
</u-popup>
<view class="picBox">
<view class="h3">考题图片</view>
<view class="imgBox">
<image :src="questionBank.img" v-if="questionBank.img" @click="previewImg" mode="aspectFit"></image>
<u-popup :show="showNoPass" mode="center" :closeable="true" @close="showNoPass=false" round="10" >
<view class="commitView">
<view class="commitTit">考试不合格</view>
<view class="commitTxt">学员您本次成绩为{{grade}}</view>
<view class="commitTxt">考试不合格预祝您下次顺利</view>
<view class="commitBtn">
<view class="btn" @click="goBack">确定</view>
</view>
<view class="djs">
<up-count-down :time="4 * 1000" format="ss" @finish="goBack" style="color: red;"></up-count-down> <view class="djsTxt"> <text style="color: red;"></text></view>
</view>
</view>
<u-popup :show="show" mode="center" :closeable="true" @close="show=false" bgColor="transparent">
<view class="imgView">
<!-- <view class="closeIcon" @click="show=false">
<u-icon name="close-circle" color="#fff" size="28"></u-icon>
</view> -->
<view class="img">
<image :src="questionBank.img" mode="aspectFit"></image>
</u-popup>
<u-popup :show="showWrong" mode="center" :closeable="true" round="10" @close="showWrongClose" >
<view class="commitView">
<view class="commitTit">错题学习</view>
<view class="commitTxt">{{ questionBank.title }}</view>
<view class="commitTxt" v-for="(item,index) in questionBank.optionArr" >
<view class="text"><text >{{item.key}}</text> {{item.text}}</view>
</view>
<view class="rowBg">
<view class="ans">正确答案
<text v-if="questionBank.types==3">{{ questionBank.answer=='true'?'A':'B'}}</text>
<text v-else>{{ questionBank.answer}}</text>
</view>
<view class="ans blue">你的答案
<text v-if="questionBank.types==3">{{ questionBank.answerMy=='true'?'A':'B'}}</text>
<text v-else>{{ questionBank.answerMy}}</text>
</view>
</view>
</u-popup>
</view>
<view class="commitBtn">
<view class="btn" @click="showWrongClose">继续考试</view>
</view>
<view class="djs">
<view class="djsTxt">页面将在</view> <up-count-down :time="6 * 1000" format="ss" style="color: red;" @finish="showWrongClose" ></up-count-down> <view class="djsTxt"> <text style="color: red;"></text> </view>
</view>
</view>
</u-popup>
</view>
@ -98,9 +163,9 @@
</template>
<script setup>
import { detectOrient } from '@/utils/utils.js'
import { startExamDo, startExam } from '@/config/api.js'
import { startExamDo, startExam, questionExam } from '@/config/api.js'
import { ref, onMounted, nextTick } from 'vue'
import { debounce } from '@/uni_modules/uview-plus';
import {
onLoad,
} from "@dcloudio/uni-app"
@ -112,9 +177,19 @@
randomNumber = options.randomNumber
})
const types = ref([
'单选题',
'多选题',
'判断题'
])
let phone = uni.getStorageSync('loginInfo')?.phone
const currentNav = ref('1')
const showCommit = ref(false)
const showNoPass = ref(false)
const showWrong = ref(false)
const show = ref(false)
onMounted(()=>{
detectOrient('#brushQuestions')
})
@ -123,13 +198,13 @@
show.value = true
}
function goBack() {
console.log('返回吧')
uni.navigateBack()
}
//
const questionBank = ref({})
const questionBankList = ref([])
let examInfo = ref([])
let ansCard = ref([])
let examInfo = ref({})
let currentIndex = ref(0)
async function startQuestionFn() {
try{
@ -145,6 +220,8 @@
uni.hideLoading()
questionBank.value = res.questionBank[0]
questionBankList.value = res.questionBank
let size = usecarStore.carInfo.stepType==1?10:5
ansCard.value = chunk(questionBankList.value, size)
initOptionArr()
examInfo.value = res
}catch(e){
@ -153,7 +230,23 @@
}
startQuestionFn()
//
function chunk(arr, size) {
if(arr.length==0) return []
let result = []
let tmp = []
arr.forEach((item,index)=>{
if(tmp.length==0) {
result.push(tmp)
}
item.index = index
tmp.push(item)
if(tmp.length==size) {
tmp = []
}
})
return result
}
function initOptionArr() {
questionBank.value.optionArr = []
let abcd = [
@ -177,40 +270,88 @@
})
//
if(questionBank.value.types==3) {
questionBank.value.optionArr[0].key1 = 'true'
questionBank.value.optionArr[1].key1 = 'false'
}
console.log(questionBank.value.optionArr)
// if(questionBank.value.types==3) {
// questionBank.value.optionArr[0].key1 = 'true'
// questionBank.value.optionArr[1].key1 = 'false'
// }
// console.log(questionBank.value.optionArr)
}
//
const curOption = ref({})
async function chooseOption(item) {
if(questionBank.value.answerMy) return
console.log(item)
if(questionBank.value.types != 2) {
item.answer = item.key
curOption.value = item
}else if(questionBank.value.types == 2){
if(!curOption.value.ans) curOption.value.ans = ''
if(curOption.value.ans.includes(item.key)) {
curOption.value.ans = curOption.value.ans.replace(item.key, '')
if(!curOption.value.answer) curOption.value.answer = ''
if(curOption.value.answer.includes(item.key)) {
curOption.value.answer = curOption.value.answer.replace(item.key, '')
return
}
curOption.value.ans = curOption.value.ans + item.key
curOption.value.answer = (curOption.value.answer + item.key).split('').sort().join('')
// console.log(curOption.value.ans)
}
}
//
async function nextQuestion(num) {
// ,
if(curOption.value.answer) {
questionBank.value.answerMy = curOption.value.answer
if(questionBank.value.types==3) questionBank.value.answerMy = curOption.value.answer=='A'? 'true': 'false'
}
//
if(questionBank.value.answerMy&&questionBank.value.answer != questionBank.value.answerMy&&curOption.value.isNext != 'next') {
curOption.value.isNext = 'next'
showWrong.value = true
if (countDownRef.value) {
countDownRef.value.pause();
}
return false
}
curOption.value = {}
currentIndex.value = currentIndex.value + num
getQuestionFn()
}
//
async function getQuestionFn() {
console.log(currentIndex.value)
questionBank.value = questionBankList.value[currentIndex.value]
curOption.value = {}
curOption.value.isNext = ''
if(questionBank.value.answerMy) curOption.value.answer = questionBank.value.answerMy
initOptionArr()
}
//
function ansCardClick(item) {
currentIndex.value = item.index
getQuestionFn()
}
function goOnExam() {
showWrong.value = false
}
//
let grade = ref(0)
async function submitBtnFn() {
let wrongArr = questionBankList.value.filter(item=>item.yes!=1)
//
if(curOption.value.answer) questionBank.value.answerMy = curOption.value.answer
let wrongArr = questionBankList.value.filter(item=>item.answer!=item.answerMy)
let worngId = wrongArr.map(item=>item.id).join(',')
// grade = 100/ *
grade.value = info.value.funllScore / questionBankList.value.length * (questionBankList.value.length - wrongArr.length)
let obj = {
"answer": null,
"carType": usecarStore.carInfo.carType,
"examId": examInfo.value.id,
"examType": 1,
"grade": questionBankList.value.length - wrongArr.length,
"examType": 2,
"grade": grade.value,
"isEnd": 1,
"pass": 1,
"sort": examInfo.value.sort,
@ -220,12 +361,69 @@
}
const res = await startExamDo(obj)
console.log(res)
uni.$u.toast('已交卷')
// uni.$u.toast('')
if(showCommit.value) showCommit.value = false
if(grade.value<info.value.score) {
showNoPass.value = true
}else {
setTimeout(()=>{
uni.navigateBack()
},1500)
}
}
function finishFn() {
uni.$u.toast('考试时间已到,准备自动为您交卷')
setTimeout(()=>{
uni.navigateBack()
submitBtnFn()
},1500)
}
//
const countDownRef = ref(null)
const yesNum = ref(0)
const noNum = ref(0)
function handApaper() {
//
if(curOption.value.answer) questionBank.value.answerMy = curOption.value.answer
yesNum.value = questionBankList.value.filter(item=>item.answer==item.answerMy).length
noNum.value = questionBankList.value.filter(item=>item.answerMy==undefined).length
console.log(questionBankList.value)
//
if(noNum) {
showCommit.value = true
if (countDownRef.value) {
countDownRef.value.pause();
}
}else {
submitBtnFn()
}
}
//
function closeCommitPopup() {
showCommit.value = false
if (countDownRef.value) {
countDownRef.value.start();
}
}
//
function showWrongClose() {
showWrong.value = false
if (countDownRef.value) {
countDownRef.value.start();
}
curOption.value = {}
currentIndex.value = currentIndex.value + 1
getQuestionFn()
}
//
let info = ref({})
async function questionExamFn() {
const {data:res} = await questionExam({stepType: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType})
info.value = res
}
questionExamFn()
</script>
<style lang="scss" scoped>
@ -428,7 +626,7 @@
}
.rightBox {
flex: 1;
flex: 1.4;
background-color: #fff;
table {
@ -450,9 +648,9 @@
text-align: center;
border-bottom: 1px solid #E1DFDF;
border-right: 1px solid #E1DFDF;
color: green;
color: #ff0000;
&.green {
color: green;
color: #55ff7f;
}
&.red {
color: red;
@ -527,17 +725,25 @@
// justify-content: space-between;
justify-content: flex-end;
.btn {
width: 123rpx;
// padding: 0 24rpx;
margin-left: 20rpx;
width: 133rpx;
margin: 0 0 0 20rpx;
text-align: center;
font-size: 24rpx;
height: 60rpx;
line-height: 60rpx;
background: #F4F4F4;
border: 1px solid #E1DFDF;
background: #3776FF;
line-height: 60rpx;
background: #F4F4F4;
color: #fff;
border: none;
border-radius: 8rpx;
&.disable {
opacity: 0.4;
}
&.hui {
background: #F4F4F4;
color: #333;
// border: 1rpx solid #E1DFDF;
}
}
}
}
@ -547,7 +753,7 @@
.picBox {
width: 100%;
flex: 2;
flex: 1.8;
background-color: #fff;
border: 1px solid #F0F0F0;
padding: 20rpx;
@ -567,5 +773,89 @@
}
}
.commitView {
width: 780rpx;
// height: 400rpx;
background: #FFFFFF;
border-radius: 10rpx;
padding: 40rpx;
.commitTit {
font-weight: bold;
font-size: 32rpx;
color: #333333;
line-height: 40rpx;
margin-bottom: 34rpx;
text-align: center;
}
.commitTxt {
font-family: PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #333333;
line-height: 42rpx;
}
.rowBg {
width: 100%;
height: 64rpx;
background: #F4F4F4;
border-radius: 10rpx;
font-size: 24rpx;
margin-top: 20rpx;
color: #333333;
line-height: 64rpx;
display: flex;
align-items: center;
padding: 0 0 0 20rpx;
.blue {
color: #3776FF;
margin-left: 30rpx;
}
}
.commitBtn {
display: flex;
align-items: center;
justify-content: center;
margin: 50rpx 0 20rpx 0;
.btn.border {
background: none;
color: #3776FF;
border: 1px solid #3776FF;
}
.btn {
width: 180rpx;
height: 60rpx;
background: #3776FF;
border-radius: 10rpx;
font-weight: 500;
font-size: 24rpx;
color: #FFFFFF;
text-align: center;
line-height: 60rpx;
margin: 0 20rpx;
}
}
}
.djs {
display: flex;
align-items: center;
justify-content: center;
margin-top: 6rpx;
.djsTxt {
font-size: 24rpx;
color: #999;
margin: -4rpx 0 0 2rpx;
}
}
</style>
<style lang="scss">
.djs {
:deep .u-count-down__text {
color: red !important;
}
}
</style>

1
pages/exercises/examSubjiect1/examSubjiect1.vue

@ -48,7 +48,6 @@
} from "@dcloudio/uni-app"
let phone = uni.getStorageSync('loginInfo')?.phone
//
let info = ref({})
async function questionExamFn() {
const {data:res} = await questionExam({stepType: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType})

17
pages/exercises/theoryStudy/theoryStudy.vue

@ -58,8 +58,8 @@
<view class="simulatedExam flex-b">
<view class="leftTxt">
<view class="h8">{{ usecarStore.carInfo.stepType==1? '一': '四'}}模拟考试</view>
<view class="text">考试次数1</view>
<view class="text">预测通过率10%</view>
<view class="text">考试次数{{ examInfo.accumulate }}</view>
<view class="text">预测通过率{{ examInfo.exampassRate}}%</view>
<view class="btnBox flex">
<!-- @click="$goPage('/pages/exercises/examSubjiect1/examSubjiect1')" -->
<view class="btnTxt" @click="$goPage('/pages/exercises/examSubjiect1/examSubjiect1')">开始考试</view>
@ -89,7 +89,7 @@
<script setup>
import { ref } from 'vue'
import { questbanktypeApi, indexNoticeApi, indexAdApi, indexAdCount, examProcessInfo} from '@/config/api.js'
import { questbanktypeApi, indexNoticeApi, indexAdApi, indexAdCount, examProcessInfo, idexExam} from '@/config/api.js'
import carStore from '@/store/modules/car.js'
let usecarStore = carStore()
const list1 = [
@ -170,6 +170,7 @@
await indexNotice()
await indexAd()
await indexAdCountFn()
await idexExamFn()
uni.hideLoading()
}
@ -198,8 +199,16 @@
const {data:res} = await indexAdCount({subject: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType})
adCount.value = res
}
indexAdCountFn()
//
let examInfo = ref({})
async function idexExamFn() {
const {data:res} = await idexExam({stepType: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType})
examInfo.value = res
}
idexExamFn()
</script>
<style lang="scss" scoped>

Loading…
Cancel
Save