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,a5 as a,b as l,c as s,w as t,Y as u,a6 as o,_ as n,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,A as x,a2 as w,a7 as b,y as h,j as g,v as C,a3 as T,a4 as I}from"./index-DkGewvWo.js";import{_ as j}from"./u-count-down.IX03siaP.js";import{o as A,r as B}from"./uni-app.es.Bo01BzMV.js";import{_ as z}from"./u-navbar.CwZJfInl.js";import{_ as F}from"./u-icon.x7ElsZU9.js";import{_ as R}from"./u-popup.C1usqomr.js";import{_ as q,a as E,b as N,c as S,d as U,e as V}from"./sc.S7-az16m.js";import{c as D}from"./car.CcI8AEaV.js";import{_ as H}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./u-status-bar.DDNs5qwz.js";import"./u-loading-icon.CdrBTsp-.js";const Q=H({__name:"examQuestions",setup(H){const Q=e("1"),$=e(["单选题","多选题","判断题"]),L=e(0),M=e(0);let O=e(!1),Y=D(),G=e(45),J=e(90);A((e=>{G.value=e.totalExamTime||45,J.value=e.score}));const K=e(!1);function P(){K.value=!1}function W(){K.value=!0}let X=e(!1),Z=e("");function ee(){X.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 oe(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={},ae.value.optionArr=[],te.value=te.value+e,ne()}async function ne(){console.log(te.value),ae.value=le.value[te.value],ie.value={},ae.value.optionArr=[],ie.value.isNext="",ue()}async function ce(){let e=1==ae.value.isCollect?"0":"1";const a={carType:Y.carInfo.carType,isAdd:e,questionId:ae.value.id,stepType:Y.carInfo.stepType};await w(a),ae.value.isCollect=e,console.log(ae.value.isCollect)}!async function(){try{u({title:"正在加载..."});let e={carType:Y.carInfo.carType,stepType:Y.carInfo.stepType,city:Y.carInfo.city,examType:1};const{data:a}=await o(e);n(),ae.value=a.questionBank[0],le.value=a.questionBank,ue(),se.value=a}catch(e){n()}}(),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*J.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:Y.carInfo.carType,examId:se.value.id,examType:1,grade:le.value.length-e.length,isEnd:1,pass:1,sort:se.value.sort,stepType:Y.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,o=B(l("up-count-down"),j),n=B(l("up-navbar"),z),w=B(l("up-icon"),F),b=g,h=C,A=T,D=B(l("up-popup"),R),H=B(l("up-textarea"),q),Y=B(l("up-button"),E);return i(),s(u,{class:"content"},{default:t((()=>[f(n,{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(o,{time:60*d(G)*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($.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((()=>{ne()}),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)(oe(-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)(oe(1),500)),disabled:d(te)>=le.value.length-1},{default:t((()=>[r("下一题")])),_:1},8,["class","disabled"])])),_:1}),2==Q.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(X)?X.value=!0:X=!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:W},{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(D,{show:K.value,onClose:P,onOpen:W,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={},ae.value.optionArr=[],te.value=a,ne(),K.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(D,{show:d(X),onClose:ee,mode:"bottom",round:"20rpx",closeable:""},{default:t((()=>[f(u,{class:"commtCon",style:{padding:"30rpx"}},{default:t((()=>[f(H,{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(Y,{text:"提 交",style:{"margin-top":"20rpx"},type:"primary",onClick:e.submitClick},null,8,["onClick"])])),_:1})])),_:1},8,["show"]),f(D,{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(J).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(o,{time:d(G)||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-8c75b2cd"]]);export{Q as default};