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

5 days ago
  1. 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"},{defau