import{r as e,a8 as a,b as l,c as s,w as t,$ as u,a9 as n,a1 as o,i as c,o as i,d as f,e as r,u as d,t as v,k as _,m as p,f as m,g as y,F as k,C as x,a5 as w,aa as b,y as h,j as g,v as C,a6 as T,a7 as I}from"./index-IX2tYR8R.js";import{_ as j}from"./u-count-down.Cyww_8Ce.js";import{o as A,r as B}from"./uni-app.es.Bc5t55A8.js";import{_ as z}from"./u-navbar.BTvKBpLV.js";import{_ as q}from"./u-icon.sW6sruaF.js";import{_ as F}from"./u-popup.CPuol-R0.js";import{_ as R,a as E,b as N,c as S,d as U,e as V}from"./sc.fc7k8zE2.js";import{c as $}from"./car.C_k88K1b.js";import{_ as D}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./u-status-bar.weuqoXTS.js";import"./u-loading-icon.pEvsKDSP.js";const H=D({__name:"examQuestions",setup(D){const H=e("1"),Q=e(["单选题","多选题","判断题"]),L=e(0),M=e(0);let O=e(!1),G=$(),J=e(45),K=e(90);A((e=>{J.value=e.totalExamTime||45,K.value=e.score}));const P=e(!1);function W(){P.value=!1}function X(){P.value=!0}let Y=e(!1),Z=e("");function ee(){Y.value=!1,Z.value=""}const ae=e({}),le=e([]);let se=e([]),te=e(0);function ue(){ae.value.optionArr=[];["a","b","c","d","e","f"].forEach(((e,a)=>{let l="option"+e;if(ae.value[l]){let s={key:e.toLocaleUpperCase(),text:ae.value[l],index:a+1};ae.value.optionArr.push(s)}})),3==ae.value.types&&(ae.value.optionArr[0].key="true",ae.value.optionArr[1].key="false")}async function ne(e){if(2==ae.value.types&&ie.value.ans){if(ie.value.answer||(ie.value.answer=ie.value.ans),ae.value.answer!=ie.value.ans&&"next"!=ie.value.isNext)return ie.value.isNext="next",ae.value.yes=0,!1;ae.value.answer==ie.value.ans&&(ae.value.yes=1)}ie.value={},te.value=te.value+e,oe()}async function oe(){console.log(te.value),ae.value=le.value[te.value],ie.value={},ie.value.isNext="",ue()}async function ce(){let e=1==ae.value.isCollect?"0":"1";const a={carType:G.carInfo.carType,isAdd:e,questionId:ae.value.id,stepType:G.carInfo.stepType};await w(a),ae.value.isCollect=e,console.log(ae.value.isCollect)}!async function(){try{u({title:"正在加载..."});let e={carType:G.carInfo.carType,stepType:G.carInfo.stepType,city:G.carInfo.city,examType:1};const{data:a}=await n(e);o(),ae.value=a.questionBank[0],le.value=a.questionBank,ue(),se.value=a}catch(e){o()}}(),a((()=>le),((e,a)=>{L.value=a.value.filter((e=>e.yes)).length,M.value=a.value.filter((e=>0==e.yes)).length}),{deep:!0});const ie=e({});let fe=e(0),re=e(null);function de(){let e=le.value.filter((e=>null==e.yes));e.length||1*K.value>L.value?(fe.value=e.length,O.value=!0,re.value&&re.value.pause()):_e()}function ve(){O.value=!1,re.value&&re.value.start()}async function _e(){let e=le.value.filter((e=>1!=e.yes)),a=e.map((e=>e.id)).join(","),l={answer:null,carType:G.carInfo.carType,examId:se.value.id,examType:1,grade:le.value.length-e.length,isEnd:1,pass:1,sort:se.value.sort,stepType:G.carInfo.stepType,userId:se.value.userId,wrongQuestionIds:a};const s=await b(l);console.log(s),uni.$u.toast("已交卷"),setTimeout((()=>{h()}),1500)}function pe(){uni.$u.toast("考试时间已到,准备自动为您交卷"),setTimeout((()=>{_e()}),1500)}function me(){h()}return(e,a)=>{const u=c,n=B(l("up-count-down"),j),o=B(l("up-navbar"),z),w=B(l("up-icon"),q),b=g,h=C,A=T,$=B(l("up-popup"),F),D=B(l("up-textarea"),R),G=B(l("up-button"),E);return i(),s(u,{class:"content"},{default:t((()=>[f(o,{leftText:" ",title:"",safeAreaInsetTop:!1,autoBack:!0},{center:t((()=>[f(u,{class:"flex"},{default:t((()=>[f(u,{class:"lastText"},{default:t((()=>[r("剩余时间")])),_:1}),f(u,{class:"lastText",style:{margin:"8rpx 0 0 8rpx"}},{default:t((()=>[f(n,{time:60*d(J)*1e3,format:"mm:ss",onFinish:pe,ref_key:"countDownRef",ref:re},null,8,["time"])])),_:1})])),_:1})])),_:1}),f(u,{class:"top_row flex"},{default:t((()=>[f(u,{class:"itemCount"},{default:t((()=>[f(w,{name:"checkmark-circle-fill",color:"#55ff7f",size:"20"}),f(u,{class:"count"},{default:t((()=>[r(v(L.value),1)])),_:1})])),_:1}),f(u,{class:"itemCount"},{default:t((()=>[f(w,{name:"close-circle-fill",color:"#ff0000",size:"20"}),f(u,{class:"count"},{default:t((()=>[r(v(M.value),1)])),_:1})])),_:1}),f(u,{class:"mr"},{default:t((()=>[f(u,{class:"count"},{default:t((()=>[r(v(d(te)+1)+"/",1),f(b,null,{default:t((()=>[r(v(le.value.length),1)])),_:1})])),_:1})])),_:1})])),_:1}),f(u,{class:"con padding"},{default:t((()=>[f(u,{class:"h1_row"},{default:t((()=>[f(b,{class:_(["tag",{red:2==ae.value.types,blue:3==ae.value.types}])},{default:t((()=>[r(v(Q.value[ae.value.types-1]),1)])),_:1},8,["class"]),f(b,{class:"h1",onClick:a[0]||(a[0]=e=>function(e){const a=new SpeechSynthesisUtterance(e);window.speechSynthesis.speak(a)}(ae.value.title))},{default:t((()=>[r(v(ae.value.title),1)])),_:1})])),_:1}),ae.value.img?(i(),s(u,{key:0,class:"imgBox",style:{width:"100%",padding:"0 0 30rpx 0"}},{default:t((()=>[f(h,{src:ae.value.img,mode:"widthFix"},null,8,["src"])])),_:1})):p("",!0),f(u,{class:"option"},{default:t((()=>[(i(!0),m(k,null,y(ae.value.optionArr,((e,a)=>(i(),s(u,{onClick:a=>async function(e){if(console.log(e),!ie.value.answer)if(2!=ae.value.types)ae.value.answer==e.key?(ae.value.yes=1,te.value=te.value+1,ie.value=e,setTimeout((()=>{oe()}),500)):(e.answer=e.key,ie.value=e,ae.value.yes=0);else if(2==ae.value.types){if(ie.value.ans||(ie.value.ans=""),ie.value.ans.includes(e.key))return void(ie.value.ans=ie.value.ans.replace(e.key,""));ie.value.ans=(ie.value.ans+e.key).split("").sort().join("")}}(e)},{default:t((()=>[2!=ae.value.types||ie.value.answer&&ie.value.answer!=ae.value.answer?(i(),s(u,{key:1,class:"optionItem flex"},{default:t((()=>[ie.value.key||2==ae.value.types?ae.value.answer.includes(e.key)?(i(),s(w,{key:1,name:"checkmark-circle-fill",color:"#55ff7f",size:"20"})):(i(),s(w,{key:2,name:"close-circle-fill",color:"#ff0000",size:"20"})):(i(),s(u,{key:0,class:"icon"})),f(u,{class:"text"},{default:t((()=>[3!=ae.value.types?(i(),s(b,{key:0},{default:t((()=>[r(v(e.key),1)])),_:2},1024)):p("",!0),r(" "+v(e.text),1)])),_:2},1024)])),_:2},1024)):(i(),s(u,{key:0,class:"optionItem flex"},{default:t((()=>{var a;return[(null==(a=ie.value.ans)?void 0:a.includes(e.key))?(i(),s(w,{key:0,name:"checkmark-circle-fill",color:"#55ff7f",size:"20"})):(i(),s(u,{key:1,class:"icon"})),f(u,{class:"text"},{default:t((()=>[f(b,null,{default:t((()=>[r(v(e.key),1)])),_:2},1024),r(" "+v(e.text),1)])),_:2},1024)]})),_:2},1024))])),_:2},1032,["onClick"])))),256))])),_:1}),ie.value.answer&&ae.value.answer!=ie.value.answer?(i(),s(u,{key:1,class:"answerCss flex"},{default:t((()=>[f(u,{class:"ans"},{default:t((()=>[r("正确答案是 "),3==ae.value.types?(i(),s(b,{key:0},{default:t((()=>[r(v("false"==ae.value.answer?"错误":"正确"),1)])),_:1})):(i(),s(b,{key:1},{default:t((()=>[r(v(ae.value.answer),1)])),_:1}))])),_:1}),f(u,{class:"ans"},{default:t((()=>[r("您的答案是 "),3==ae.value.types?(i(),s(b,{key:0,class:"red"},{default:t((()=>[r(v("false"==ie.value.answer?"错误":"正确"),1)])),_:1})):(i(),s(b,{key:1,class:"red"},{default:t((()=>[r(v(ie.value.answer),1)])),_:1}))])),_:1})])),_:1})):p("",!0),f(u,{class:"btn_row flex-b"},{default:t((()=>[f(A,{class:_(["btn border",{disable:0==d(te)}]),onClick:a[1]||(a[1]=e=>d(I)(ne(-1),500)),disabled:0==d(te)},{default:t((()=>[r("上一题")])),_:1},8,["class","disabled"]),f(A,{class:_(["btn bg",{disable:d(te)>=le.value.length-1}]),onClick:a[2]||(a[2]=e=>d(I)(ne(1),500)),disabled:d(te)>=le.value.length-1},{default:t((()=>[r("下一题")])),_:1},8,["class","disabled"])])),_:1}),2==H.value||ie.value.answer&&ie.value.answer!=ae.value.answer?(i(),s(u,{key:2,class:"analysis"},{default:t((()=>[f(u,{class:"tit"},{default:t((()=>[r("题目解析")])),_:1}),f(u,{class:"txt"},{default:t((()=>[r(v(ae.value.resolving),1)])),_:1})])),_:1})):p("",!0)])),_:1}),f(u,{class:"bottomBar"},{default:t((()=>[f(u,{class:"ul"},{default:t((()=>[f(u,{class:"flex leftCotrl"},{default:t((()=>[f(u,{class:"li",onClick:a[3]||(a[3]=e=>x(Y)?Y.value=!0:Y=!0)},{default:t((()=>[f(u,{class:"icon"},{default:t((()=>[f(h,{src:N,mode:""})])),_:1}),f(u,{class:"text"},{default:t((()=>[r("反馈")])),_:1})])),_:1}),f(u,{class:"li",onClick:X},{default:t((()=>[f(u,{class:"icon"},{default:t((()=>[f(h,{src:S,mode:""})])),_:1}),f(u,{class:"text"},{default:t((()=>[r("答题卡")])),_:1})])),_:1}),f(u,{class:"li",onClick:ce},{default:t((()=>[f(u,{class:"icon"},{default:t((()=>["1"==ae.value.isCollect?(i(),s(h,{key:0,src:U,mode:""})):(i(),s(h,{key:1,src:V,mode:""}))])),_:1}),f(u,{class:"text"},{default:t((()=>[r("收藏")])),_:1})])),_:1})])),_:1}),f(u,{class:"submitBtn",onClick:de},{default:t((()=>[r("交卷")])),_:1})])),_:1})])),_:1}),f($,{show:P.value,onClose:W,onOpen:X,mode:"bottom",round:"20",closeable:""},{default:t((()=>[f(u,{class:"popupCon"},{default:t((()=>[f(u,{class:"h3"},{default:t((()=>[r("答题卡")])),_:1}),f(u,{class:"ulRow"},{default:t((()=>[f(u,{class:"ul"},{default:t((()=>[f(u,{class:"li"},{default:t((()=>[f(u,{class:"icon",style:{color:"#55ff7f"}},{default:t((()=>[r(v(L.value),1)])),_:1}),f(u,{class:"text"},{default:t((()=>[r("答对")])),_:1})])),_:1}),f(u,{class:"li"},{default:t((()=>[f(u,{class:"icon",style:{color:"#ff0000"}},{default:t((()=>[r(v(M.value),1)])),_:1}),f(u,{class:"text"},{default:t((()=>[r("答错")])),_:1})])),_:1}),f(u,{class:"li",style:{"margin-left":"auto"}},{default:t((()=>[f(u,{class:"icon"},{default:t((()=>[r(v(d(te)+1)+"/",1),f(b,{style:{color:"#999","font-size":"24rpx"}},{default:t((()=>[r(v(le.value.length),1)])),_:1})])),_:1}),f(u,{class:"text"},{default:t((()=>[r("题目")])),_:1})])),_:1})])),_:1})])),_:1}),f(u,{class:"ul2"},{default:t((()=>[(i(!0),m(k,null,y(le.value,((e,a)=>(i(),s(u,{class:"li2",key:a,onClick:e=>async function(e,a){ie.value={},te.value=a,oe(),P.value=!1}(0,a)},{default:t((()=>[f(u,{class:_(["num",{yes:1==e.yes,no:0==e.yes}])},{default:t((()=>[r(v(a+1)+" ",1),a==d(te)?(i(),s(b,{key:0},{default:t((()=>[r("当前")])),_:1})):p("",!0)])),_:2},1032,["class"])])),_:2},1032,["onClick"])))),128))])),_:1})])),_:1})])),_:1},8,["show"]),f($,{show:d(Y),onClose:ee,mode:"bottom",round:"20rpx",closeable:""},{default:t((()=>[f(u,{class:"commtCon",style:{padding:"30rpx"}},{default:t((()=>[f(D,{modelValue:d(Z),"onUpdate:modelValue":a[4]||(a[4]=e=>x(Z)?Z.value=e:Z=e),modelModifiers:{trim:!0},placeholder:"请输入反馈内容",style:{"margin-top":"50rpx"},maxlength:"300"},null,8,["modelValue"]),f(G,{text:"提 交",style:{"margin-top":"20rpx"},type:"primary",onClick:e.submitClick},null,8,["onClick"])])),_:1})])),_:1},8,["show"]),f($,{show:d(O),onClose:ve,mode:"center",round:"20rpx",closeable:""},{default:t((()=>[f(u,{class:"commitCon"},{default:t((()=>[d(fe)?(i(),s(u,{key:0,class:"tit"},{default:t((()=>[r("当前考试进度")])),_:1})):1*d(K).value>L.value.value?(i(),s(u,{key:1,class:"tit",style:{color:"red"}},{default:t((()=>[r("成绩不合格")])),_:1})):p("",!0),f(u,{class:"flex"},{default:t((()=>[f(u,{class:"commitItem"},{default:t((()=>[f(u,{class:"num"},{default:t((()=>[r(v(d(fe)),1)])),_:1}),f(u,{class:"lab"},{default:t((()=>[r("未答题数")])),_:1})])),_:1}),f(u,{class:"commitItem"},{default:t((()=>[f(u,{class:"num"},{default:t((()=>[r(v(le.value.length-d(fe)),1)])),_:1}),f(u,{class:"lab"},{default:t((()=>[r("已答题数")])),_:1})])),_:1}),f(u,{class:"commitItem"},{default:t((()=>[f(u,{class:"num"},{default:t((()=>[f(n,{time:d(J)||0,format:"HH:mm",ref_key:"countDownRef",ref:re},null,8,["time"])])),_:1}),f(u,{class:"lab"},{default:t((()=>[r("剩余时间")])),_:1})])),_:1})])),_:1}),f(u,{class:"imgAdd"},{default:t((()=>[f(h,{src:"/h5/assets/addImg-B5Rb502z.png",mode:"widthFix"})])),_:1}),d(fe)?(i(),s(u,{key:2,class:"btn_commit_row flex-b"},{default:t((()=>[f(u,{class:"border btn",onClick:me},{default:t((()=>[r("放弃考试")])),_:1}),f(u,{class:"btn",onClick:ve},{default:t((()=>[r("继续考试")])),_:1})])),_:1})):(i(),s(u,{key:3,class:"btn_commit_row flex-b"},{default:t((()=>[f(u,{class:"border btn",onClick:ve},{default:t((()=>[r("继续答题")])),_:1}),f(u,{class:"btn",onClick:_e},{default:t((()=>[r("现在交卷")])),_:1})])),_:1}))])),_:1})])),_:1},8,["show"])])),_:1})}}},[["__scopeId","data-v-37a2f385"]]);export{H as default};