Browse Source

模拟考试

master
unknown 1 day ago
parent
commit
c59ce7c91f
  1. 2
      manifest.json
  2. 1
      pages.json
  3. 110
      pages/exercises/brushQuestions/examQuestions.vue
  4. 2
      pages/exercises/categoryExercises/categoryExercises.vue
  5. 24
      pages/exercises/examSubjiect1/examSubjiect1.vue
  6. 2
      pages/exercises/theoryStudy/theoryStudy.vue
  7. 11
      pages/index/index.vue

2
manifest.json

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

1
pages.json

@ -4,6 +4,7 @@
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
}

110
pages/exercises/brushQuestions/examQuestions.vue

@ -9,6 +9,20 @@
</template>
</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="h1_row">
@ -27,7 +41,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>
@ -36,6 +50,7 @@
<!-- ans -->
</view>
</view>
<view class="answerCss flex" v-if="curOption.answer&&questionBank.answer!=curOption.answer">
<view class="ans">正确答案是
<text v-if="questionBank.types==3" >{{ questionBank.answer=='false'?'错误':'正确' }}</text>
@ -46,10 +61,11 @@
<text v-else class="red">{{ curOption.answer }}</text>
</view>
</view>
<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>=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 class="analysis" v-if="currentNav==2||(curOption.answer&&curOption.answer!=questionBank.answer)">
<view class="tit">题目解析</view>
@ -85,9 +101,10 @@
</view>
<view class="text">答题卡</view>
</view>
<view class="li" @click="$noDoFn">
<view class="li" @click="questionWrongColleFn">
<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 class="text">收藏</view>
</view>
@ -116,7 +133,7 @@
</view>
</view>
<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>
</view>
@ -139,11 +156,12 @@
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 {
ref,
reactive
reactive,
watch
} from 'vue';
const currentNav = ref('1')
const types = ref([
@ -154,6 +172,8 @@
const yesNum = ref(0)
const noNum = ref(0)
import carStore from '@/store/modules/car.js'
let usecarStore = carStore()
@ -210,6 +230,7 @@
}
//
const questionBank = ref({})
const questionBankList = ref([])
let quesIdList = ref([])
let currentIndex = ref(1)
async function startQuestionFn() {
@ -224,7 +245,8 @@
}
const {data: res} = await startExam(obj)
uni.hideLoading()
questionBank.value = res.questionBank
questionBank.value = res.questionBank[0]
questionBankList.value = res.questionBank
initOptionArr()
quesIdList.value = res.quesIdList
}catch(e){
@ -233,6 +255,11 @@
}
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() {
questionBank.value.optionArr = []
let abcd = [
@ -287,16 +314,16 @@
//
async function getQuestionFn() {
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 = ''
initOptionArr()
}
@ -306,16 +333,36 @@
getQuestionFn()
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({})
async function chooseOption(item) {
// console.log(item)
console.log(item)
if(curOption.value.answer) return
if(questionBank.value.types != 2) {
//
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
submitAnswerResultFn()
questionBank.value.yes = 0
}
}else if(questionBank.value.types == 2){
if(!curOption.value.ans) curOption.value.ans = ''
if(curOption.value.ans.includes(item.key)) {
@ -351,6 +398,27 @@
</script>
<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%;}
.bottomBar {
position: fixed;

2
pages/exercises/categoryExercises/categoryExercises.vue

@ -80,9 +80,9 @@
.icon {
width: 68rpx;
height: 68rpx;
background: #EF8F4C;
// box-shadow: 0px 2rpx 5rpx 0px rgba(239,143,76,0.5);
border-radius: 26rpx;
overflow: hidden;
}
.text {

24
pages/exercises/examSubjiect1/examSubjiect1.vue

@ -14,20 +14,20 @@
<image src="" mode=""></image>
</view>
<view class="rightBox">
<view class="name">用户名</view>
<view class="p">
<text>最高分数85</text>
<text>用时0030</text>
<view class="name">{{ phone }}</view>
<view class="p" v-if="info.highScore">
<text>最高分数{{ info.highScore }}</text>
<text>用时{{ info.useTime }}</text>
</view>
</view>
</view>
<view class="card">
<view class="text">考试车型小车C1</view>
<view class="text">考试时间45分钟100</view>
<view class="text">合格标准90分及格满分100</view>
<view class="text">出题规则根据公安部规定出题规则组卷</view>
<view class="text">计分规则模拟考试下不能修改答案每错1题扣2分累计错题超过5道考试不通过系统自动提醒交卷</view>
<view class="text">考试车型{{ usecarStore.carInfo.carTypeName}}</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>
@ -37,13 +37,15 @@
</view>
</template>
<script>
<script setup>
import { ref } from 'vue'
import { questionExam} from '@/config/api.js'
import carStore from '@/store/modules/car.js'
let usecarStore = carStore()
let phone = uni.getStorageSync('loginInfo')?.phone
//
let info = ref()
let info = ref({})
async function questionExamFn() {
const {data:res} = await questionExam({stepType: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType})
info.value = res

2
pages/exercises/theoryStudy/theoryStudy.vue

@ -193,7 +193,7 @@
indexAd()
//
let adCount = ref()
let adCount = ref({})
async function indexAdCountFn() {
const {data:res} = await indexAdCount({subject: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType})
adCount.value = res

11
pages/index/index.vue

@ -32,7 +32,8 @@
import { loginApi, questbanktypeApi, } from '@/config/api.js'
import {
onLoad,
onReady
onReady,
onPullDownRefresh
} from "@dcloudio/uni-app"
const rightClick = () => {
@ -68,6 +69,7 @@
"username": phone,
})
console.log(res)
res.data.phone = phone
uni.setStorageSync('loginInfo', res.data);
}
//
@ -81,6 +83,13 @@
currentCar.value = res[0]
}
onPullDownRefresh(()=>{
questbanktypeFn().then(()=>{
uni.stopPullDownRefresh()
}).catch(()=>{
uni.stopPullDownRefresh()
})
})
</script>

Loading…
Cancel
Save