Browse Source

准备对接防真

master
unknown 1 week ago
parent
commit
554b7546fc
  1. 2
      manifest.json
  2. 16
      pages/exercises/beforeExam/beforeExam.vue
  3. 2
      pages/exercises/brushQuestions/brushQuestions.vue
  4. 234
      pages/exercises/brushQuestions/examQuestions.vue
  5. 148
      pages/exercises/exam/exam.vue
  6. 16
      pages/exercises/examSubjiect1/examSubjiect1.vue
  7. 6
      pages/exercises/theoryStudy/theoryStudy.vue
  8. BIN
      static/images/bigImg/addImg.png

2
manifest.json

@ -75,7 +75,7 @@
"disableHostCheck" : true,
"proxy" : {
"/api" : {
"target" : "http://192.168.1.202:8081/",
"target" : "http://192.168.1.210:8081/",
// "target" : "http://192.168.1.40:8099/",
"changeOrigin" : true,
"secure" : true,

16
pages/exercises/beforeExam/beforeExam.vue

@ -23,10 +23,10 @@
</view>
</view>
<view class="box">
<view class="h6">理论考试01号考台</view>
<view class="redt">身份证号123456789123456789</view>
<view class="redt">考生姓名驾考学员</view>
<view class="btn" @click="$goPage('/pages/exercises/exam/exam')">开始考试</view>
<view class="h6">理论考试0{{ randomNumber }}号考台</view>
<!-- <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="text">操作提示每题考试答案确定后点击下一题电脑立即判定所选答案如选择错误系统将提示正确答案提示后不允许修改答案</view>
</view>
@ -39,7 +39,7 @@
<script setup>
import { detectOrient } from '@/utils/utils.js'
import { ref, onMounted, nextTick } from 'vue'
let phone = uni.getStorageSync('loginInfo')?.phone
onMounted(()=>{
detectOrient('#beforeExam')
})
@ -48,6 +48,12 @@
uni.navigateBack()
}
function getRandomNumber(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
let randomNumber = getRandomNumber(1, 9);
</script>
<style lang="scss" scoped>

2
pages/exercises/brushQuestions/brushQuestions.vue

@ -27,7 +27,7 @@
<view class="text"><text >{{item.key}}</text> {{item.text}}</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>
<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>

234
pages/exercises/brushQuestions/examQuestions.vue

@ -4,7 +4,7 @@
<template #center>
<view class="flex">
<view class="lastText">剩余时间</view>
<view class="lastText" style="margin-left: 8rpx;">4400</view>
<view class="lastText" style="margin: 8rpx 0 0 8rpx"><up-count-down :time="totalExamTime * 60 * 1000" format="mm:ss" @finish="finishFn" ref="countDownRef"></up-count-down></view>
</view>
</template>
</up-navbar>
@ -19,7 +19,7 @@
<view class="count">{{ noNum }}</view>
</view>
<view class="mr">
<view class="count">{{currentIndex}}/<text>{{questionBankList.length}}</text></view>
<view class="count">{{currentIndex+1}}/<text>{{questionBankList.length}}</text></view>
</view>
</view>
@ -64,8 +64,8 @@
<view class="btn_row flex-b">
<!-- @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 bg" @click="debounce(nextQuestion(1), 500)" :class="{disable: currentIndex>=questionBankList.length}" :disabled="currentIndex>=questionBankList.length">下一题</button>
<button class="btn border" @click="debounce(nextQuestion(-1), 500)" :class="{disable: currentIndex==0}" :disabled="currentIndex==0">上一题</button>
<button class="btn bg" @click="debounce(nextQuestion(1), 500)" :class="{disable: currentIndex>=questionBankList.length-1}" :disabled="currentIndex>=questionBankList.length-1">下一题</button>
</view>
<view class="analysis" v-if="currentNav==2||(curOption.answer&&curOption.answer!=questionBank.answer)">
<view class="tit">题目解析</view>
@ -109,7 +109,7 @@
<view class="text">收藏</view>
</view>
</view>
<view class="submitBtn">交卷</view>
<view class="submitBtn" @click="handApaper">交卷</view>
</view>
</view>
@ -127,14 +127,14 @@
<view class="text">答错</view>
</view>
<view class="li" style="margin-left: auto;">
<view class="icon">{{currentIndex}}/<text style="color: #999; font-size: 24rpx;">{{quesIdList.length}}</text></view>
<view class="icon">{{currentIndex+1}}/<text style="color: #999; font-size: 24rpx;">{{questionBankList.length}}</text></view>
<view class="text">题目</view>
</view>
</view>
</view>
<view class="ul2">
<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="{yes: item.yes==1, no: item.yes==0}">{{ index+1 }} <text v-if="index==currentIndex">当前</text> </view>
</view>
</view>
</view>
@ -143,7 +143,39 @@
<up-popup :show="showCommt" @close="showCommtClose" mode="bottom" round="20rpx" closeable>
<view class="commtCon" style="padding: 30rpx">
<up-textarea v-model.trim="contentStr" placeholder="请输入反馈内容" style="margin-top: 50rpx;" maxlength="300"></up-textarea>
<up-button text="提 交" style="margin-top: 20rpx;" type="primary" @click="submitCommt"></up-button>
<up-button text="提 交" style="margin-top: 20rpx;" type="primary" @click="submitClick"></up-button>
</view>
</up-popup>
<up-popup :show="showCommit" @close="closeCommitPopup" mode="center" round="20rpx" closeable >
<view class="commitCon">
<view class="tit" v-if="remaining">当前考试进度</view>
<view class="tit" style="color: red;" v-else-if="passScore.value*1>yesNum.value">成绩不合格</view>
<view class="flex">
<view class="commitItem">
<view class="num">{{ remaining }}</view>
<view class="lab">未答题数</view>
</view>
<view class="commitItem">
<view class="num">{{ questionBankList.length - remaining}}</view>
<view class="lab">已答题数</view>
</view>
<view class="commitItem">
<view class="num"><up-count-down :time="totalExamTime * 60 * 60 * 1000" format="HH:mm" ref="countDownRef"/></view>
<view class="lab">剩余时间</view>
</view>
</view>
<view class="imgAdd">
<image src="@/static/images/bigImg/addImg.png" mode="widthFix"></image>
</view>
<view class="btn_commit_row flex-b" v-if="remaining">
<view class="border btn" @click="goBack" >放弃考试</view>
<view class="btn" @click="closeCommitPopup">继续考试</view>
</view>
<view class="btn_commit_row flex-b" v-else>
<view class="border btn" @click="closeCommitPopup" >继续答题</view>
<view class="btn" @click="submitBtnFn">现在交卷</view>
</view>
</view>
</up-popup>
@ -156,12 +188,13 @@
window.speechSynthesis.speak(speech); //
}
import { startExam, submitAnswerResultApi, getQuestionApi, questionCommentAdd, startExamDo, questionWrongColle } from '@/config/api.js'
import { startExam, getQuestionApi, questionCommentAdd, startExamDo, questionWrongColle } from '@/config/api.js'
import { debounce } from '@/uni_modules/uview-plus';
import {
ref,
reactive,
watch
watch,
nextTick,
} from 'vue';
const currentNav = ref('1')
const types = ref([
@ -172,7 +205,7 @@
const yesNum = ref(0)
const noNum = ref(0)
let showCommit = ref(false)
import carStore from '@/store/modules/car.js'
let usecarStore = carStore()
@ -181,6 +214,13 @@
onLoad,
onReady
} from "@dcloudio/uni-app"
let totalExamTime = ref(45)
let passScore = ref(90)
onLoad((options)=>{
totalExamTime.value = options.totalExamTime
passScore.value = options.score
})
// 123
function changeNav(val) {
console.log(window)
@ -231,8 +271,8 @@
//
const questionBank = ref({})
const questionBankList = ref([])
let quesIdList = ref([])
let currentIndex = ref(1)
let examInfo = ref([])
let currentIndex = ref(0)
async function startQuestionFn() {
try{
uni.showLoading({
@ -248,7 +288,7 @@
questionBank.value = res.questionBank[0]
questionBankList.value = res.questionBank
initOptionArr()
quesIdList.value = res.quesIdList
examInfo.value = res
}catch(e){
uni.hideLoading()
}
@ -298,12 +338,14 @@
//
if(!curOption.value.answer) {
curOption.value.answer = curOption.value.ans
await submitAnswerResultFn()
}
// ,
if(questionBank.value.answer != curOption.value.ans&&curOption.value.isNext != 'next') {
curOption.value.isNext = 'next'
questionBank.value.yes = 0
return false
}else if(questionBank.value.answer == curOption.value.ans) {
questionBank.value.yes = 1
}
}
curOption.value = {}
@ -324,12 +366,13 @@
// }
// const {data: res} = await getQuestionApi(obj)
questionBank.value = questionBankList.value[currentIndex.value]
curOption.value = {}
curOption.value.isNext = ''
initOptionArr()
}
async function quesIdListClick(id, index) {
curOption.value = {}
currentIndex.value = index + 1
currentIndex.value = index
getQuestionFn()
show.value = false
}
@ -355,8 +398,10 @@
if(questionBank.value.answer==item.key) {
questionBank.value.yes = 1
currentIndex.value = currentIndex.value + 1
curOption.value = {}
getQuestionFn()
curOption.value = item
setTimeout(()=>{
getQuestionFn()
},500)
}else {
item.answer = item.key
curOption.value = item
@ -373,27 +418,62 @@
// console.log(curOption.value.ans)
}
}
//
async function submitAnswerResultFn() {
let obj = {
answer: curOption.value.answer,
carType: 'car',
questionId: questionBank.value.id,
result: '0',
stepType: 1,
tempId: questionBank.value.questionDoTemp.id
}
const res = await submitAnswerResultApi(obj)
if(res.errorcode!=0) return
if(curOption.value.answer==questionBank.value.answer) {
console.log('答对了')
curOption.value = {}
yesNum.value ++
nextQuestion(1)
//
let remaining = ref(0)
let countDownRef = ref(null)
function handApaper() {
let arr = questionBankList.value.filter(item=>item.yes==undefined)
//
if(arr.length || passScore.value*1>yesNum.value) {
remaining.value = arr.length
showCommit.value = true
if (countDownRef.value) {
countDownRef.value.pause();
}
}else {
noNum.value ++
submitBtnFn()
}
}
//
function closeCommitPopup() {
showCommit.value = false
if (countDownRef.value) {
countDownRef.value.start();
}
}
//
async function submitBtnFn() {
let wrongArr = questionBankList.value.filter(item=>item.yes!=1)
let worngId = wrongArr.map(item=>item.id).join(',')
let obj = {
"answer": null,
"carType": usecarStore.carInfo.carType,
"examId": examInfo.value.id,
"examType": 1,
"grade": questionBankList.value.length - wrongArr.length,
"isEnd": 1,
"pass": 1,
"sort": examInfo.value.sort,
"stepType": usecarStore.carInfo.stepType,
"userId": examInfo.value.userId,
"wrongQuestionIds": worngId
}
// console.log(res)
const res = await startExamDo(obj)
console.log(res)
uni.$u.toast('已交卷')
setTimeout(()=>{
uni.navigateBack()
},1500)
}
function finishFn() {
uni.$u.toast('考试时间已到,准备自动为您交卷')
setTimeout(()=>{
submitBtnFn()
},1500)
}
//
function goBack() {
uni.navigateBack()
}
</script>
@ -644,13 +724,91 @@
font-size: 32rpx;
line-height: 100rpx;
text-align: center;
&.active {
position: relative;
text {
width: 68rpx;
height: 34rpx;
background: #3776FF;
border-radius: 17rpx;
display: block;
font-weight: 400;
font-size: 24rpx;
color: #FFFFFF;
text-align: center;
line-height: 34rpx;
position: absolute;
bottom: -14rpx;
left: 16rpx;
}
&.yes {
border: 1px solid #63C168;
background: rgba(99,193,104,0.1);
color: #63C168;
}
&.no {
border: 1px solid #FF3333;
background: rgba(255,51,51,0.1);
color: #FF3333;
}
}
}
}
}
.commitCon {
width: calc(100vw - 100rpx);
padding: 30rpx;
.tit {
font-weight: 500;
font-size: 36rpx;
color: #333333;
text-align: center;
}
.flex {
.commitItem {
flex: 1;
text-align: center;
padding: 50rpx 0 40rpx 0;
.lab {
font-size: 28rpx;
color: #CCCCCC;
margin-top: 10rpx;
}
.num {
font-weight: bold;
font-size: 36rpx;
color: #333333;
}
}
}
.imgAdd {
width: 100%;
img {
}
}
.btn_commit_row {
padding-top: 40rpx;
.border.btn {
border: 1rpx solid #CCCCCC;
color: #CCCCCC;
background: none;
}
.btn {
width: 46%;
height: 77rpx;
text-align: center;
line-height: 77rpx;
background: #3776FF;
border-radius: 39rpx;
font-size: 28rpx;
color: #FFFFFF;
}
}
}
</style>

148
pages/exercises/exam/exam.vue

@ -4,7 +4,7 @@
<view class="userInfoBox">
<view class="examNo">
<view class="h3">洛阳学车</view>
<view class="card">第01号台</view>
<view class="card">第0{{ randomNumber }}号台</view>
<view class="back" @click="goBack">
<u-icon name="arrow-left" size="16"></u-icon>
</view>
@ -13,12 +13,12 @@
<view class="card">
<view class="h3">考生信息</view>
<view class="avatar">
<image src="@/static/logo.png" mode=""></image>
<image src="@/static/images/avatarbg.png" mode=""></image>
</view>
<view class="txt">姓名大乔</view>
<view class="txt">性别</view>
<view class="txt">类型小车</view>
<view class="txt">科目科目一</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>
@ -26,21 +26,17 @@
<view class="leftBox">
<view class="h3">考试题目</view>
<view class="questionTxt">
<view class="txt">32.如图所示驾驶机动车遇到这种情况以下做法正确的是</view>
<view class="txt">A:减速慢行</view>
<view class="txt">B:减速慢行</view>
<view class="txt">C:减速慢行</view>
<view class="txt">D:减速慢行</view>
<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 class="answer flex-b">
<view class="lab">您的答案</view>
<view class="lab">您的答案{{ curOption.answer }}</view>
<view class="rightSelect flex">
<view class="lab">选项</view>
<view class="optio flex">
<view class="optionItem">A</view>
<view class="optionItem">B</view>
<view class="optionItem active">C</view>
<view class="optionItem">D</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>
@ -82,7 +78,7 @@
<view class="picBox">
<view class="h3">考题图片</view>
<view class="imgBox">
<image src="https://lyjp-bucket-main.oss-cn-beijing.aliyuncs.com/adf614ab07f86aebb0b7b3492e8ae500907389f08d238f49665e7ac47efd4bde.jpg" @click="previewImg" mode="aspectFit"></image>
<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">
@ -90,7 +86,7 @@
<u-icon name="close-circle" color="#fff" size="28"></u-icon>
</view> -->
<view class="img">
<image src="https://lyjp-bucket-main.oss-cn-beijing.aliyuncs.com/adf614ab07f86aebb0b7b3492e8ae500907389f08d238f49665e7ac47efd4bde.jpg" mode="aspectFit"></image>
<image :src="questionBank.img" mode="aspectFit"></image>
</view>
</view>
</u-popup>
@ -102,7 +98,21 @@
</template>
<script setup>
import { detectOrient } from '@/utils/utils.js'
import { startExamDo, startExam } from '@/config/api.js'
import { ref, onMounted, nextTick } from 'vue'
import {
onLoad,
} from "@dcloudio/uni-app"
import carStore from '@/store/modules/car.js'
let usecarStore = carStore()
let randomNumber = ''
onLoad((options)=>{
randomNumber = options.randomNumber
})
let phone = uni.getStorageSync('loginInfo')?.phone
const currentNav = ref('1')
const show = ref(false)
onMounted(()=>{
@ -116,6 +126,106 @@
console.log('返回吧')
uni.navigateBack()
}
//
const questionBank = ref({})
const questionBankList = ref([])
let examInfo = ref([])
let currentIndex = ref(0)
async function startQuestionFn() {
try{
uni.showLoading({
title: '正在加载...'
})
let obj = {
carType: usecarStore.carInfo.carType,
stepType: usecarStore.carInfo.stepType,
examType: 2,
}
const {data: res} = await startExam(obj)
uni.hideLoading()
questionBank.value = res.questionBank[0]
questionBankList.value = res.questionBank
initOptionArr()
examInfo.value = res
}catch(e){
uni.hideLoading()
}
}
startQuestionFn()
function initOptionArr() {
questionBank.value.optionArr = []
let abcd = [
'a',
'b',
'c',
'd',
'e',
'f'
]
abcd.forEach((k,i)=>{
let option = 'option'+k
if(questionBank.value[option]) {
let obj = {
key: k.toLocaleUpperCase(),
text: questionBank.value[option],
index: i+1
}
questionBank.value.optionArr.push(obj)
}
})
//
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) {
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, '')
return
}
curOption.value.ans = curOption.value.ans + item.key
// console.log(curOption.value.ans)
}
}
//
async function submitBtnFn() {
let wrongArr = questionBankList.value.filter(item=>item.yes!=1)
let worngId = wrongArr.map(item=>item.id).join(',')
let obj = {
"answer": null,
"carType": usecarStore.carInfo.carType,
"examId": examInfo.value.id,
"examType": 1,
"grade": questionBankList.value.length - wrongArr.length,
"isEnd": 1,
"pass": 1,
"sort": examInfo.value.sort,
"stepType": usecarStore.carInfo.stepType,
"userId": examInfo.value.userId,
"wrongQuestionIds": worngId
}
const res = await startExamDo(obj)
console.log(res)
uni.$u.toast('已交卷')
setTimeout(()=>{
uni.navigateBack()
},1500)
}
</script>
<style lang="scss" scoped>

16
pages/exercises/examSubjiect1/examSubjiect1.vue

@ -17,20 +17,20 @@
<view class="name">{{ phone }}</view>
<view class="p" v-if="info.highScore">
<text>最高分数{{ info.highScore }}</text>
<text>用时{{ info.useTime }}</text>
<text>用时{{ info.useTimes }} 分钟 </text>
</view>
</view>
</view>
<view class="card">
<view class="text">考试车型{{ usecarStore.carInfo.carTypeName}}</view>
<view class="text">考试时间{{ info.totalExamTime}} {{ info.totalCount }}</view>
<view class="text">考试时间{{ info.totalExamTime}}分钟 {{ info.totalCount }}</view>
<view class="text">合格标准{{ info.score }}分及格满分{{ info.funllScore }}</view>
<view class="text">出题规则{{info.questionRule}}</view>
<view class="text">计分规则{{info.deductPointsRule}}</view>
</view>
<view class="btnBox">
<oneBtn text="开始模拟考试" @click="$goPage('/pages/exercises/brushQuestions/examQuestions')"></oneBtn>
<oneBtn text="开始模拟考试" @click="$goPage(`/pages/exercises/brushQuestions/examQuestions?totalExamTime=${info.totalExamTime}&score=${info.score}`)"></oneBtn>
</view>
</view>
@ -43,14 +43,22 @@
import carStore from '@/store/modules/car.js'
let usecarStore = carStore()
import {
onShow,
} 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})
let arr = res.useTime.split(':')
res.useTimes =arr[0] +':'+ arr[1].substring(0, 2)
info.value = res
}
questionExamFn()
onShow(()=>{
questionExamFn()
})
</script>
<style lang="scss" scoped>

6
pages/exercises/theoryStudy/theoryStudy.vue

@ -45,8 +45,8 @@
</view>
</view>
<view class="iconComl">
<!-- @click="$goPage(item.url)" -->
<view class="item" v-for="(item,index) in rightItem" :key="index" @click="$noDoFn">
<!-- @click="$goPage(item.url)" $noDoFn -->
<view class="item" v-for="(item,index) in rightItem" :key="index" @click="$goPage(item.url)">
<view class="icon">
<image :src="item.icon" mode=""></image>
</view>
@ -57,7 +57,7 @@
<view class="simulatedExam flex-b">
<view class="leftTxt">
<view class="h8">科一模拟考试</view>
<view class="h8">{{ usecarStore.carInfo.stepType==1? '': '四'}}模拟考试</view>
<view class="text">考试次数1</view>
<view class="text">预测通过率10%</view>
<view class="btnBox flex">

BIN
static/images/bigImg/addImg.png

After

Width: 1180  |  Height: 378  |  Size: 185 KiB

Loading…
Cancel
Save