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 @@