Browse Source

模拟考试

master
unknown 3 weeks 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, "disableHostCheck" : true,
"proxy" : { "proxy" : {
"/api" : { "/api" : {
"target" : "http://192.168.1.203:8081/",
"target" : "http://192.168.1.202:8081/",
// "target" : "http://192.168.1.40:8099/", // "target" : "http://192.168.1.40:8099/",
"changeOrigin" : true, "changeOrigin" : true,
"secure" : true, "secure" : true,

1
pages.json

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

110
pages/exercises/brushQuestions/examQuestions.vue

@ -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) {
//
if(questionBank.value.answer==item.key) {
questionBank.value.yes = 1
currentIndex.value = currentIndex.value + 1
curOption.value = {}
getQuestionFn()
}else {
item.answer = item.key item.answer = item.key
curOption.value = item curOption.value = item
submitAnswerResultFn()
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;

2
pages/exercises/categoryExercises/categoryExercises.vue

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

24
pages/exercises/examSubjiect1/examSubjiect1.vue

@ -14,20 +14,20 @@
<image src="" mode=""></image> <image src="" mode=""></image>
</view> </view>
<view class="rightBox"> <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>
</view> </view>
<view class="card"> <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>
<view class="btnBox"> <view class="btnBox">
<oneBtn text="开始模拟考试" @click="$goPage('/pages/exercises/brushQuestions/examQuestions')"></oneBtn> <oneBtn text="开始模拟考试" @click="$goPage('/pages/exercises/brushQuestions/examQuestions')"></oneBtn>
@ -37,13 +37,15 @@
</view> </view>
</template> </template>
<script>
<script setup>
import { ref } from 'vue' import { ref } from 'vue'
import { questionExam} from '@/config/api.js' import { questionExam} from '@/config/api.js'
import carStore from '@/store/modules/car.js' import carStore from '@/store/modules/car.js'
let usecarStore = carStore() let usecarStore = carStore()
let phone = uni.getStorageSync('loginInfo')?.phone
// //
let info = ref()
let info = ref({})
async function questionExamFn() { async function questionExamFn() {
const {data:res} = await questionExam({stepType: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType}) const {data:res} = await questionExam({stepType: usecarStore.carInfo.stepType, carType: usecarStore.carInfo.carType})
info.value = res info.value = res

2
pages/exercises/theoryStudy/theoryStudy.vue

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

11
pages/index/index.vue

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

Loading…
Cancel
Save