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 lines
12 KiB

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"}},{default:n((()=>[_(m(p(D)),1)])),_:1})])),_:1}),v(l,{class:"txt"},{default:n((()=>[_("类型:"+m(p(Q).carInfo.carTypeName),1)])),_:1}),v(l,{class:"txt"},{default:n((()=>[_("科目:科目"+m(1==p(Q).carInfo.stepType?"一":"四"),1)])),_:1})])),_:1})])),_:1})])),_:1}),v(l,{class:"examConBox"},{default:n((()=>[v(l,{class:"leftBox"},{default:n((()=>[v(l,{class:"h3"},{default:n((()=>[_("考试题目")])),_:1}),v(l,{class:"questionTxt"},{default:n((()=>[v(l,{class:"txt"},{default:n((()=>[_(m(p(W)+1)+"."+m(H.value.title),1)])),_:1}),(d(!0),y(x,null,w(H.value.optionArr,((e,a)=>(d(),u(l,{class:"txt"},{default:n((()=>[v(l,{class:"text"},{default:n((()=>[v(c,null,{default:n((()=>[_(m(e.key),1)])),_:2},1024),_(" "+m(e.text),1)])),_:2},1024)])),_:2},1024)))),256))])),_:1}),v(l,{class:"answer flex-b"},{default:n((()=>[v(l,{class:"lab"},{default:n((()=>[_("您的答案: "),3==H.value.types?(d(),u(c,{key:0},{default:n((()=>[_(m("true"==Z.value.answer?"A":"B"),1)])),_:1})):(d(),u(c,{key:1},{default:n((()=>[_(m(Z.value.answer),1)])),_:1}))])),_:1}),v(l,{class:"rightSelect flex"},{default:n((()=>[v(l,{class:"lab"},{default:n((()=>[_("选项:")])),_:1}),(d(!0),y(x,null,w(H.value.optionArr,((e,a)=>(d(),u(l,{class:"optio flex"},{default:n((()=>{var a;return[v(l,{class:b(["optionItem",{active:null==(a=Z.value.answer)?void 0:a.includes(e.key)}]),onClick:a=>async function(e){if(!H.value.answerMy)if(console.log(e),2!=H.value.types)e.answer=e.key,Z.value=e;else if(2==H.value.types){if(Z.value.answer||(Z.value.answer=""),Z.value.answer.includes(e.key))return void(Z.value.answer=Z.value.answer.replace(e.key,""));Z.value.answer=(Z.value.answer+e.key).split("").sort().join("")}}(e)},{default:n((()=>[_(m(e.key),1)])),_:2},1032,["class","onClick"])]})),_:2},1024)))),256))])),_:1})])),_:1})])),_:1}),v(l,{class:"rightBox"},{default:n((()=>[p(K).length?(d(),y("table",{key:0,style:{width:"100%",height:"100%"}},[h("tr",null,[h("th",{class:"blueItem br"},"题目"),(d(!0),y(x,null,w(1==p(Q).carInfo.stepType?10:5,((e,a)=>(d(),y("th",{class:"blueItem br"},m(a+1)+"列",1)))),256))]),(d(!0),y(x,null,w(p(K),((e,a)=>(d(),y("tr",null,[h("td",{class:"blueItem bb"},m(a+1)+"行",1),(d(!0),y(x,null,w(e,((e,a)=>(d(),y("td",{class:b(["ansItem",{green:e.answer==e.answerMy}]),onClick:a=>function(e){W.value=e.index,ae()}(e)},[3==e.types&&e.answerMy?(d(),u(c,{key:0,class:"flex",style:{"justify-content":"center"}},{default:n((()=>[e.answer==e.answerMy?(d(),u(r,{key:0,name:"checkmark",color:"#55ff7f",size:"18"})):(d(),u(r,{key:1,name:"close",color:"#ff0000",size:"18"}))])),_:2},1024)):(d(),u(c,{key:1},{default:n((()=>[_(m(e.answerMy),1)])),_:2},1024))],10,["onClick"])))),256))])))),256))])):k("",!0)])),_:1})])),_:1})])),_:1}),v(l,{class:"row row2"},{default:n((()=>[v(l,{class:"timeBox"},{default:n((()=>[v(l,{class:"h3"},{default:n((()=>[_("考试时间")])),_:1}),v(l,{class:"time"},{default:n((()=>[v(f,{time:60*p(ie).totalExamTime*1e3,format:"mm:ss",onFinish:te,ref_key:"countDownRef",ref:ue},null,8,["time"])])),_:1})])),_:1}),v(l,{class:"leftTpsBox"},{default:n((()=>[v(l,{class:"card"},{default:n((()=>[v(l,{class:"h3"},{default:n((()=>[_("操作提示")])),_:1}),v(l,{class:"txt"},{default:n((()=>[_("本题为"+m($.value[H.value.types-1])+",请在备选答案中选择 "+m(2==H.value.types?"多":"一")+"个你认为正确的答案!",1)])),_:1})])),_:1})])),_:1}),v(l,{class:"rightBtnBox"},{default:n((()=>[v(g,{class:b(["btn hui",{disable:0==p(W)}]),onClick:a[0]||(a[0]=e=>p(M)(ee(-1),500)),disabled:0==p(W)},{default:n((()=>[_("上一题")])),_:1},8,["class","disabled"]),v(g,{class:b(["btn hui",{disable:p(W)>=J.value.length-1}]),onClick:a[1]||(a[1]=e=>p(M)(ee(1),500)),disabled:p(W)>=J.value.length-1},{default:n((()=>[_("下一题")])),_:1},8,["class","disabled"]),v(l,{class:"btn",onClick:ce},{default:n((()=>[_("交 卷")])),_:1})])),_:1})])),_:1}),v(l,{class:"picBox"},{default:n((()=>[v(l,{class:"h3"},{default:n((()=>[_("考题图片")])),_:1}),v(l,{class:"imgBox"},{default:n((()=>[H.value.img?(d(),u(o,{key:0,src:H.value.img,onClick:X,mode:"aspectFit"},null,8,["src"])):k("",!0)])),_:1}),v(T,{show:U.value,mode:"center",closeable:!0,onClose:a[2]||(a[2]=e=>U.value=!1),bgColor:"transparent"},{default:n((()=>[v(l,{class:"imgView"},{default:n((()=>[v(l,{class:"img"},{default:n((()=>[v(o,{src:H.value.img,mode:"aspectFit"},null,8,["src"])])),_:1})])),_:1})])),_:1},8,["show"])])),_:1})])),_:1}),v(T,{show:L.value,mode:"center",closeable:!0,round:"10",onClose:re},{default:n((()=>[v(l,{class:"commitView"},{default:n((()=>[v(l,{class:"commitTit"},{default:n((()=>[_("考试确认窗口")])),_:1}),v(l,{class:"commitTxt"},{default:n((()=>[_("你当前考试答对"+m(ne.value)+"题,答错"+m(J.value.length-ne.value-oe.value)+"题,未答"+m(oe.value)+"题。 ",1)])),_:1}),v(l,{class:"commitTxt"},{default:n((()=>[_("1、点击【确认交卷】,将提交考试成绩,考试结束。")])),_:1}),v(l,{class:"commitTxt"},{default:n((()=>[_("2、点击【继续考试】,将关闭本窗口,继续考试。")])),_:1}),v(l,{class:"commitBtn"},{default:n((()=>[v(l,{class:"btn border",onClick:se},{default:n((()=>[_("确定交卷")])),_:1}),v(l,{class:"btn",onClick:re},{default:n((()=>[_("继续考试")])),_:1})])),_:1})])),_:1})])),_:1},8,["show"]),v(T,{show:O.value,mode:"center",closeable:!0,onClose:a[3]||(a[3]=e=>O.value=!1),round:"10"},{default:n((()=>[v(l,{class:"commitView"},{default:n((()=>[v(l,{class:"commitTit"},{default:n((()=>[_("考试不合格")])),_:1}),v(l,{class:"commitTxt"},{default:n((()=>[_("学员、您本次成绩为"+m(p(le))+"分",1)])),_:1}),v(l,{class:"commitTxt"},{default:n((()=>[_("考试不合格,预祝您下次顺利")])),_:1}),v(l,{class:"commitBtn"},{default:n((()=>[v(l,{class:"btn",onClick:G},{default:n((()=>[_("确定")])),_:1})])),_:1}),v(l,{class:"djs"},{default:n((()=>[v(f,{time:4e3,format:"ss",onFinish:G,style:{color:"red"}}),_(),v(l,{class:"djsTxt"},{default:n((()=>[v(c,{style:{color:"red"}},{default:n((()=>[_("秒")])),_:1}),_("自动关闭,自动回到页面")])),_:1})])),_:1})])),_:1})])),_:1},8,["show"]),v(T,{show:R.value,mode:"center",closeable:!0,round:"10",onClose:fe},{default:n((()=>[v(l,{class:"commitView"},{default:n((()=>[v(l,{class:"commitTit"},{default:n((()=>[_("错题学习")])),_:1}),v(l,{class:"commitTxt"},{default:n((()=>[_(m(H.value.title),1)])),_:1}),(d(!0),y(x,null,w(H.value.optionArr,((e,a)=>(d(),u(l,{class:"commitTxt"},{default:n((()=>[v(l,{class:"text"},{default:n((()=>[v(c,null,{default:n((()=>[_(m(e.key),1)])),_:2},1024),_(" "+m(e.text),1)])),_:2},1024)])),_:2},1024)))),256)),v(l,{class:"rowBg"},{default:n((()=>[v(l,{class:"ans"},{default:n((()=>[_("正确答案: "),3==H.value.types?(d(),u(c,{key:0},{default:n((()=>[_(m("true"==H.value.answer?"A":"B"),1)])),_:1})):(d(),u(c,{key:1},{default:n((()=>[_(m(H.value.answer),1)])),_:1}))])),_:1}),v(l,{class:"ans blue"},{default:n((()=>[_("你的答案: "),3==H.value.types?(d(),u(c,{key:0},{default:n((()=>[_(m("true"==H.value.answerMy?"A":"B"),1)])),_:1})):(d(),u(c,{key:1},{default:n((()=>[_(m(H.value.answerMy),1)])),_:1}))])),_:1})])),_:1}),v(l,{class:"commitBtn"},{default:n((()=>[v(l,{class:"btn",onClick:fe},{default:n((()=>[_("继续考试")])),_:1})])),_:1}),v(l,{class:"djs"},{default:n((()=>[v(l,{class:"djsTxt"},{default:n((()=>[_("页面将在")])),_:1}),_(),v(f,{time:6e3,format:"ss",style:{color:"red"},onFinish:fe}),_(),v(l,{class:"djsTxt"},{default:n((()=>[v(c,{style:{color:"red"}},{default:n((()=>[_("秒")])),_:1}),_(" 后自动关闭并返还考试主页面")])),_:1})])),_:1})])),_:1})])),_:1},8,["show"])])),_:1})}}},[["__scopeId","data-v-760cb6c1"]]);export{V as default};