|
|
import{r as e,ac as a,ad as l,ae as s,b as t,c as u,w as n,Y as o,a6 as c,_ as r,af 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,a7 as T,v as I,j as B,a3 as C,a4 as j}from"./index-DkGewvWo.js";import{_ as M}from"./u-icon.x7ElsZU9.js";import{o as A,r as F}from"./uni-app.es.Bo01BzMV.js";import{_ as N}from"./u-count-down.IX03siaP.js";import{_ as z}from"./u-popup.C1usqomr.js";import{_ as E}from"./avatarbg.CYvUS9Uz.js";import{c as V}from"./car.CcI8AEaV.js";import{_ as q}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./u-status-bar.DDNs5qwz.js";const Q=q({__name:"exam",setup(q){var Q;let S=V(),D="";A((e=>{D=e.randomNumber}));const L=e(["单选题","多选题","判断题"]);let R=null==(Q=a("loginInfo"))?void 0:Q.phone;const U=e(!1),Y=e(!1),$=e(!1),G=e(!1);function H(){G.value=!0}function J(){g()}l((()=>{s("#brushQuestions")}));const K=e({}),O=e([]);let P=e([]),W=e({}),X=e(0);function Z(){K.value.optionArr=[];["a","b","c","d","e","f"].forEach(((e,a)=>{let l="option"+e;if(K.value[l]){let s={key:e.toLocaleUpperCase(),text:K.value[l],index:a+1};K.value.optionArr.push(s)}}))}!async function(){try{o({title:"正在加载..."});let e={carType:S.carInfo.carType,stepType:S.carInfo.stepType,examType:2};const{data:a}=await c(e);r(),K.value=a.questionBank[0],O.value=a.questionBank;let l=1==S.carInfo.stepType?10:5;P.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}(O.value,l),Z(),W.value=a}catch(e){r()}}();const ee=e({});async function ae(e){if(ee.value.answer&&(K.value.answerMy=ee.value.answer,3==K.value.types&&(K.value.answerMy="A"==ee.value.answer?"true":"false")),K.value.answerMy&&K.value.answer!=K.value.answerMy&&"next"!=ee.value.isNext)return ee.value.isNext="next",$.value=!0,ne.value&&ne.value.pause(),!1;ee.value={},X.value=X.value+e,le()}async function le(){console.log(X.value),K.value=O.value[X.value],ee.value={},ee.value.isNext="",K.value.answerMy&&(ee.value.answer=K.value.answerMy),Z()}let se=e(0);async function te(){ee.value.answer&&(K.value.answerMy=ee.value.answer);let e=O.value.filter((e=>e.answer!=e.answerMy)),a=e.map((e=>e.id)).join(",");se.value=de.value.funllScore/O.value.length*(O.value.length-e.length);let l={answer:null,carType:S.carInfo.carType,examId:W.value.id,examType:2,grade:se.value,isEnd:1,pass:1,sort:W.value.sort,stepType:S.carInfo.stepType,userId:W.value.userId,wrongQuestionIds:a};const s=await T(l);console.log(s),U.value&&(U.value=!1),se.value<de.value.score?Y.value=!0:setTimeout((()=>{g()}),1500)}function ue(){uni.$u.toast("考试时间已到,准备自动为您交卷"),setTimeout((()=>{te()}),1500)}const ne=e(null),oe=e(0),ce=e(0);function re(){ee.value.answer&&(K.value.answerMy=ee.value.answer),oe.value=O.value.filter((e=>e.answer==e.answerMy)).length,ce.value=O.value.filter((e=>null==e.answerMy)).length,console.log(O.value),ce?(U.value=!0,ne.value&&ne.value.pause()):te()}function fe(){U.value=!1,ne.value&&ne.value.start()}function ie(){$.value=!1,ne.value&&ne.value.start(),ee.value={},X.value=X.value+1,le()}let de=e({});return async function(){const{data:e}=await f({stepType:S.carInfo.stepType,carType:S.carInfo.carType});de.value=e}(),(e,a)=>{const l=i,s=F(t("u-icon"),M),o=I,c=B,r=F(t("up-icon"),M),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(D))+"号台",1)])),_:1}),v(l,{class:"back",onClick:J},{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:E,mode:""})])),_:1}),v(l,{class:"txt"},{default:n((()=>[_("用户: "),v(c,{style:{"marg
|