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
1 lines
12 KiB
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:{"margin-top":"10rpx"}},{default:n((()=>[_(m(p(R)),1)])),_:1})])),_:1}),v(l,{class:"txt"},{default:n((()=>[_("类型:"+m(p(S).carInfo.carTypeName),1)])),_:1}),v(l,{class:"txt"},{default:n((()=>[_("科目:科目"+m(1==p(S).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(X)+1)+"."+m(K.value.title),1)])),_:1}),(d(!0),y(x,null,w(K.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==K.value.types?(d(),u(c,{key:0},{default:n((()=>[_(m("true"==ee.value.answer?"A":"B"),1)])),_:1})):(d(),u(c,{key:1},{default:n((()=>[_(m(ee.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(K.value.optionArr,((e,a)=>(d(),u(l,{class:"optio flex"},{default:n((()=>{var a;return[v(l,{class:b(["optionItem",{active:null==(a=ee.value.answer)?void 0:a.includes(e.key)}]),onClick:a=>async function(e){if(!K.value.answerMy)if(console.log(e),2!=K.value.types)e.answer=e.key,ee.value=e;else if(2==K.value.types){if(ee.value.answer||(ee.value.answer=""),ee.value.answer.includes(e.key))return void(ee.value.answer=ee.value.answer.replace(e.key,""));ee.value.answer=(ee.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(P).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(S).carInfo.stepType?10:5,((e,a)=>(d(),y("th",{class:"blueItem br"},m(a+1)+"列",1)))),256))]),(d(!0),y(x,null,w(p(P),((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){X.value=e.index,le()}(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(de).totalExamTime*1e3,format:"mm:ss",onFinish:ue,ref_key:"countDownRef",ref:ne},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(L.value[K.value.types-1])+",请在备选答案中选择 "+m(2==K.value.types?"多":"一")+"个你认为正确的答案!",1)])),_:1})])),_:1})])),_:1}),v(l,{class:"rightBtnBox"},{default:n((()=>[v(g,{class:b(["btn hui",{disable:0==p(X)}]),onClick:a[0]||(a[0]=e=>p(j)(ae(-1),500)),disabled:0==p(X)},{default:n((()=>[_("上一题")])),_:1},8,["class","disabled"]),v(g,{class:b(["btn hui",{disable:p(X)>=O.value.length-1}]),onClick:a[1]||(a[1]=e=>p(j)(ae(1),500)),disabled:p(X)>=O.value.length-1},{default:n((()=>[_("下一题")])),_:1},8,["class","disabled"]),v(l,{class:"btn",onClick:re},{default:n((()=>[_("交 卷")])),_:1})])),_:1})])),_:1}),v(l,{class:"picBox"},{default:n((()=>[v(l,{class:"h3"},{default:n((()=>[_("考题图片")])),_:1}),v(l,{class:"imgBox"},{default:n((()=>[K.value.img?(d(),u(o,{key:0,src:K.value.img,onClick:H,mode:"aspectFit"},null,8,["src"])):k("",!0)])),_:1}),v(T,{show:G.value,mode:"center",closeable:!0,onClose:a[2]||(a[2]=e=>G.value=!1),bgColor:"transparent"},{default:n((()=>[v(l,{class:"imgView"},{default:n((()=>[v(l,{class:"img"},{default:n((()=>[v(o,{src:K.value.img,mode:"aspectFit"},null,8,["src"])])),_:1})])),_:1})])),_:1},8,["show"])])),_:1})])),_:1}),v(T,{show:U.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(oe.value)+"题,答错"+m(O.value.length-oe.value-ce.value)+"题,未答"+m(ce.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:te},{default:n((()=>[_("确定交卷")])),_:1}),v(l,{class:"btn",onClick:fe},{default:n((()=>[_("继续考试")])),_:1})])),_:1})])),_:1})])),_:1},8,["show"]),v(T,{show:Y.value,mode:"center",closeable:!0,onClose:a[3]||(a[3]=e=>Y.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(se))+"分",1)])),_:1}),v(l,{class:"commitTxt"},{default:n((()=>[_("考试不合格,预祝您下次顺利")])),_:1}),v(l,{class:"commitBtn"},{default:n((()=>[v(l,{class:"btn",onClick:J},{default:n((()=>[_("确定")])),_:1})])),_:1}),v(l,{class:"djs"},{default:n((()=>[v(f,{time:4e3,format:"ss",onFinish:J,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:$.value,mode:"center",closeable:!0,round:"10",onClose:ie},{default:n((()=>[v(l,{class:"commitView"},{default:n((()=>[v(l,{class:"commitTit"},{default:n((()=>[_("错题学习")])),_:1}),v(l,{class:"commitTxt"},{default:n((()=>[_(m(K.value.title),1)])),_:1}),(d(!0),y(x,null,w(K.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==K.value.types?(d(),u(c,{key:0},{default:n((()=>[_(m("true"==K.value.answer?"A":"B"),1)])),_:1})):(d(),u(c,{key:1},{default:n((()=>[_(m(K.value.answer),1)])),_:1}))])),_:1}),v(l,{class:"ans blue"},{default:n((()=>[_("你的答案: "),3==K.value.types?(d(),u(c,{key:0},{default:n((()=>[_(m("true"==K.value.answerMy?"A":"B"),1)])),_:1})):(d(),u(c,{key:1},{default:n((()=>[_(m(K.value.answerMy),1)])),_:1}))])),_:1})])),_:1}),v(l,{class:"commitBtn"},{default:n((()=>[v(l,{class:"btn",onClick:ie},{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:ie}),_(),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{Q as default};
|