You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
12 KiB

5 days ago
  1. import{r as e,af as a,ag as l,ah as s,b as t,c as u,w as n,$ as o,a9 as c,a1 as r,ai as f,i,o as d,d as v,e as _,t as m,u as p,f as y,g as w,F as x,z as h,m as k,k as b,y as g,aa as T,v as B,j as I,a6 as C,a7 as M}from"./index-IX2tYR8R.js";import{_ as j}from"./u-icon.sW6sruaF.js";import{o as A,r as F}from"./uni-app.es.Bc5t55A8.js";import{_ as N}from"./u-count-down.Cyww_8Ce.js";import{_ as z}from"./u-popup.CPuol-R0.js";import{c as q}from"./car.C_k88K1b.js";import{_ as E}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./u-status-bar.weuqoXTS.js";const V=E({__name:"exam",setup(E){var V;let Q=q(),S="";A((e=>{S=e.randomNumber}));const $=e(["单选题","多选题","判断题"]);let D=null==(V=a("loginInfo"))?void 0:V.phone;const L=e(!1),O=e(!1),R=e(!1),U=e(!1);function X(){U.value=!0}function G(){g()}l((()=>{s("#brushQuestions")}));const H=e({}),J=e([]);let K=e([]),P=e({}),W=e(0);function Y(){H.value.optionArr=[];["a","b","c","d","e","f"].forEach(((e,a)=>{let l="option"+e;if(H.value[l]){let s={key:e.toLocaleUpperCase(),text:H.value[l],index:a+1};H.value.optionArr.push(s)}}))}!async function(){try{o({title:"正在加载..."});let e={carType:Q.carInfo.carType,stepType:Q.carInfo.stepType,examType:2};const{data:a}=await c(e);r(),H.value=a.questionBank[0],J.value=a.questionBank;let l=1==Q.carInfo.stepType?10:5;K.value=function(e,a){if(0==e.length)return[];let l=[],s=[];return e.forEach(((e,t)=>{0==s.length&&l.push(s),e.index=t,s.push(e),s.length==a&&(s=[])})),l}(J.value,l),Y(),P.value=a}catch(e){r()}}();const Z=e({});async function ee(e){if(Z.value.answer&&(H.value.answerMy=Z.value.answer,3==H.value.types&&(H.value.answerMy="A"==Z.value.answer?"true":"false")),H.value.answerMy&&H.value.answer!=H.value.answerMy&&"next"!=Z.value.isNext)return Z.value.isNext="next",R.value=!0,ue.value&&ue.value.pause(),!1;Z.value={},W.value=W.value+e,ae()}async function ae(){console.log(W.value),H.value=J.value[W.value],Z.value={},Z.value.isNext="",H.value.answerMy&&(Z.value.answer=H.value.answerMy),Y()}let le=e(0);async function se(){Z.value.answer&&(H.value.answerMy=Z.value.answer);let e=J.value.filter((e=>e.answer!=e.answerMy)),a=e.map((e=>e.id)).join(",");le.value=ie.value.funllScore/J.value.length*(J.value.length-e.length);let l={answer:null,carType:Q.carInfo.carType,examId:P.value.id,examType:2,grade:le.value,isEnd:1,pass:1,sort:P.value.sort,stepType:Q.carInfo.stepType,userId:P.value.userId,wrongQuestionIds:a};const s=await T(l);console.log(s),L.value&&(L.value=!1),le.value<ie.value.score?O.value=!0:setTimeout((()=>{g()}),1500)}function te(){uni.$u.toast("考试时间已到,准备自动为您交卷"),setTimeout((()=>{se()}),1500)}const ue=e(null),ne=e(0),oe=e(0);function ce(){Z.value.answer&&(H.value.answerMy=Z.value.answer),ne.value=J.value.filter((e=>e.answer==e.answerMy)).length,oe.value=J.value.filter((e=>null==e.answerMy)).length,console.log(J.value),oe?(L.value=!0,ue.value&&ue.value.pause()):se()}function re(){L.value=!1,ue.value&&ue.value.start()}function fe(){R.value=!1,ue.value&&ue.value.start(),Z.value={},W.value=W.value+1,ae()}let ie=e({});return async function(){const{data:e}=await f({stepType:Q.carInfo.stepType,carType:Q.carInfo.carType});ie.value=e}(),(e,a)=>{const l=i,s=F(t("u-icon"),j),o=B,c=I,r=F(t("up-icon"),j),f=F(t("up-count-down"),N),g=C,T=F(t("u-popup"),z);return d(),u(l,{id:"brushQuestions"},{default:n((()=>[v(l,{class:"content"},{default:n((()=>[v(l,{class:"row row1"},{default:n((()=>[v(l,{class:"userInfoBox"},{default:n((()=>[v(l,{class:"examNo"},{default:n((()=>[v(l,{class:"h3"},{default:n((()=>[_("洛阳学车")])),_:1}),v(l,{class:"card"},{default:n((()=>[_("第0"+m(p(S))+"号台",1)])),_:1}),v(l,{class:"back",onClick:G},{default:n((()=>[v(s,{name:"arrow-left",size:"16"})])),_:1})])),_:1}),v(l,{class:"user"},{default:n((()=>[v(l,{class:"card"},{default:n((()=>[v(l,{class:"h3"},{default:n((()=>[_("考生信息")])),_:1}),v(l,{class:"avatar"},{default:n((()=>[v(o,{src:"/h5/assets/avatarbg-BBkbOXze.png",mode:""})])),_:1}),v(l,{class:"txt"},{default:n((()=>[_("用户: "),v(c,{style:{"margin-top":"10rpx"}},{defau