From c59ce7c91f04a3414d25df656e26ae7d59064273 Mon Sep 17 00:00:00 2001
From: unknown <331404948@qq.com>
Date: Mon, 4 Nov 2024 18:51:53 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E8=80=83=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
manifest.json | 2 +-
pages.json | 1 +
pages/exercises/brushQuestions/examQuestions.vue | 114 ++++++++++++++++-----
.../categoryExercises/categoryExercises.vue | 2 +-
pages/exercises/examSubjiect1/examSubjiect1.vue | 24 +++--
pages/exercises/theoryStudy/theoryStudy.vue | 2 +-
pages/index/index.vue | 11 +-
7 files changed, 118 insertions(+), 38 deletions(-)
diff --git a/manifest.json b/manifest.json
index fa3aaa9..5ce35b7 100644
--- a/manifest.json
+++ b/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,
diff --git a/pages.json b/pages.json
index d2bdb6a..aca334c 100644
--- a/pages.json
+++ b/pages.json
@@ -4,6 +4,7 @@
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "",
+ "enablePullDownRefresh": true,
"navigationStyle": "custom"
}
}
diff --git a/pages/exercises/brushQuestions/examQuestions.vue b/pages/exercises/brushQuestions/examQuestions.vue
index 8eede0a..42deac5 100644
--- a/pages/exercises/brushQuestions/examQuestions.vue
+++ b/pages/exercises/brushQuestions/examQuestions.vue
@@ -9,6 +9,20 @@
+
+
+
+ {{ yesNum }}
+
+
+
+ {{ noNum }}
+
+
+ {{currentIndex}}/{{questionBankList.length}}
+
+
+
@@ -27,7 +41,7 @@
{{item.key}} {{item.text}}
-
+
@@ -36,6 +50,7 @@
+
正确答案是
{{ questionBank.answer=='false'?'错误':'正确' }}
@@ -46,10 +61,11 @@
{{ curOption.answer }}
+
-
+
题目解析
@@ -85,9 +101,10 @@
答题卡
-
+
-
+
+
收藏
@@ -116,7 +133,7 @@
-
+
{{ index+1 }}
@@ -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) {
- 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){
if(!curOption.value.ans) curOption.value.ans = ''
if(curOption.value.ans.includes(item.key)) {
@@ -351,6 +398,27 @@