index.2c93bb90.js 9.0 KB

1
  1. import{d as k,ah as R,ag as N,R as y,r as O,$ as j,b7 as P,c as s,aj as X,a5 as C,q as A,B as q,P as K,al as M,m as h,ai as D,_ as Z,an as _}from"./index.5f7ffb46.js";import{i as H}from"./icon-question-nums.dee74fa0.js";import{e as r,Q as m,C as B,D as G,K as Q,P as W,i as z,A as V}from"./index.a5f6d9ed.js";import{O as Y}from"./index.7790de2a.js";import{O as v}from"./index.95a99ca5.js";import{R as J}from"./index.ff20df31.js";import{C as $}from"./index.85ea6781.js";import{C as tt}from"./index.abd668f7.js";import{S as et,a as st}from"./index.99e0cf1f.js";import{I as nt}from"./index.276a5d68.js";import{A as at}from"./index.78e196a2.js";import"./index.adf0b8fc.js";import"./index.ab2541bb.js";const ut="_unitDetail_1qg73_1",it="_unitSection_1qg73_4",ot="_unitTitle_1qg73_11",lt="_unitCount_1qg73_16",rt="_qNums_1qg73_22",ct="_num_1qg73_29",dt="_icon_1qg73_32",mt="_wapList_1qg73_37";var i={unitDetail:ut,unitSection:it,unitTitle:ot,unitCount:lt,qNums:rt,num:ct,icon:dt,wapList:mt},pt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAAAXNSR0IArs4c6QAABD5JREFUSEuVlm2IVGUUx3//mXXzrSJDcntDgpQIKxKEPkRWFCpa9GHmjlsKFallaPQiZbn3mS1fliJTtEKpCGmdO0tSqEnSBwn6ZH7IQtKgKNSSXswPajvr3BP3zt11Z3Ze1ufbzPM/5/ec85xz7iOaLMt7H2IsBtLNdMP2ysAOueDxRno12rBiJs2RVP8lwAZdleHUWLkDF+r5bgiMxOayK5A6MdqGGU8Gbkx+/wb8ObQnLiD1qquw+ZIjbBh53nsa4914XzwjP3hvlOlOTEahNje7DU25B+M+sDnAnYnZIbA9kP4aph+Qc2Erd81TunnuZZy+YgWwEuO65s7sOEq9jZW3yvWVLjml1t05k7DcC0yrNrZ+pD+w+N8OoL3G+TFIZeR2Hh510djr3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return typeof c=="function"||Object.prototype.toString.call(c)==="[object Object]"&&!M(c)}var Bt=k({name:"unit-detail",setup(){const c=R(),d=N(),b=y(),p=y(),t=O({id:c.query.id,examDetail:{},visiableAnswer:!1,currentIndex:0,questionList:[],time:0,visiableSure:!1,visiableResult:!1,resultInfo:{},resultStatusType:"SUCCESS",visiableExam:!1,nextStatus:!1,swipeHeight:"auto",quitStatus:!1}),I=async()=>{try{const{data:u}=await h.post("/api-student/studentUnitExamination/startExamination",{requestType:"form",data:{studentUnitExaminationId:t.id}}),{questionJson:e,studentAnswerJson:a,...n}=u,o=e||[];o.forEach(l=>{l.userAnswer=T(l,a)}),t.questionList=o,t.examDetail={...n},L()}catch{}},L=async()=>{const u=t.examDetail||{},e=u.startTime,a=u.now,n=u.timeMinutes||0,o=D(e).add(n,"minute").diff(D(a));o<=0?(r.emit("unitAudioStop"),await x(),t.visiableExam=!0):(t.time=Math.ceil(o/1e3)*1e3,setTimeout(()=>{var l;(l=b.value)==null||l.start()},10))},T=(u,e)=>{if(!e)return[];const a=e||[];return a[u.id]?a[u.id]:[]};let f=0;const w=(u=!0)=>{Z(()=>{u&&window.scrollTo(0,0),setTimeout(()=>{var l;const e=(l=document.querySelectorAll(".van-swipe-item")[t.currentIndex])==null?void 0:l.querySelector(".swipe-item-question"),a=e.querySelectorAll(".answerTitleImg img");let n=!0;a.forEach(E=>{console.log(E.complete),E.complete||(n=!1)}),!n&&f<3&&setTimeout(()=>{f+=1,w(u)},300),n&&(f=0);const o=_(e);t.swipeHeight=o.height},100)})},F=async()=>{var u;try{const e=t.questionList||[],a=[];if(e.forEach((n,o)=>{n.userAnswer&&n.userAnswer.length>0&&a.push({questionId:n.id,details:n.userAnswer})}),t.questionList.length===t.currentIndex+1){r.emit("unitAudioStop"),t.visiableSure=!0;return}t.nextStatus=!0,await h.post("/api-student/studentUnitExamination/submitAnswer",{hideLoading:!0,data:{answers:a,studentUnitExaminationId:t.id}}),(u=p.value)==null||u.next(),t.nextStatus=!1}catch{t.nextStatus=!1}},U=async()=>{try{await x(),S(),t.visiableResult=!0}catch{}},x=async()=>{try{const u=t.questionList||[],e=[];u.forEach(n=>{n.userAnswer&&n.userAnswer.length>0&&e.push({questionId:n.id,details:n.userAnswer})});const{data:a}=await h.post("/api-student/studentUnitExamination/completionExamination",{hideLoading:!1,data:{answers:e,studentUnitExaminationId:t.id}});a.status==="A_PASS"?(t.resultStatusType="SUCCESS",t.resultInfo={tips:"\u606D\u559C\u4F60\uFF0C\u6D4B\u9A8C\u901A\u8FC7\uFF01",score:a.score,examName:t.examDetail.unitExaminationName}):(t.resultStatusType="FAIL",t.resultInfo={tips:"\u672C\u6B21\u6D4B\u9A8C\u4E0D\u5408\u683C\uFF01",score:a.score,examName:t.examDetail.unitExaminationName})}catch{}},g=()=>{t.quitStatus=!0,r.emit("unitAudioStop")},S=()=>{window.removeEventListener("popstate",g,!1),d.back()};return j(async()=>{await I(),w(),window.history.pushState(null,"",document.URL),window.addEventListener("popstate",g,!1)}),P(()=>{r.emit("unitAudioStop")}),()=>{let u;return s("div",{class:i.unitDetail},[s(X,null,null),s(tt,{center:!0,class:i.unitSection,border:!1},{title:()=>s("div",{class:i.unitTitle},[t.examDetail.unitExaminationName]),label:()=>s("div",{class:i.unitCount},[s("div",{class:i.qNums},[s(C,{class:i.icon,name:H},null),A("\u9898\u76EE\u6570\u91CF")," ",s("span",{class:i.num,style:{paddingLeft:"6px"}},[t.currentIndex+1]),A("/"),t.examDetail.questionNum]),s("div",{class:i.qNums},[s(C,{class:i.icon,name:pt},null),A("\u5269\u4F59\u65F6\u957F\uFF1A"),s($,{ref:b,time:t.time,"onUpdate:time":e=>t.time=e,format:"mm:ss",autoStart:!1,onFinish:async()=>{r.emit("unitAudioStop"),await x(),t.visiableExam=!0}},null)])])}),s(et,{loop:!1,showIndicators:!1,ref:p,duration:300,touchable:!1,height:t.swipeHeight,style:{marginBottom:"12px"},lazyRender:!0,onChange:e=>{r.emit("unitAudioStop"),t.currentIndex=e,w()}},wt(u=t.questionList.map((e,a)=>s(st,null,{default:()=>[s("div",{class:"swipe-item-question"},[e.questionTypeCode===m.RADIO&&s(B,{value:e.userAnswer,"onUpdate:value":n=>e.userAnswer=n,index:a+1,data:e,type:"radio"},null),e.questionTypeCode===m.CHECKBOX&&s(B,{value:e.userAnswer,"onUpdate:value":n=>e.userAnswer=n,index:a+1,data:e,type:"checkbox"},null),e.questionTypeCode===m.SORT&&s(G,{value:e.userAnswer,"onUpdate:value":[n=>e.userAnswer=n,()=>{w(!1)}],data:e,index:a+1},null),e.questionTypeCode===m.LINK&&s(Q,{value:e.userAnswer,"onUpdate:value":n=>e.userAnswer=n,data:e,index:a+1},null),e.questionTypeCode===m.PLAY&&s(W,{value:e.userAnswer,"onUpdate:value":n=>e.userAnswer=n,data:e,index:a+1,unitId:t.id},null)])]})))?u:{default:()=>[u]}),s(Y,{position:"bottom",background:"white"},{default:()=>[s("div",{class:["btnGroup btnMore"]},[t.currentIndex>0&&s(q,{round:!0,block:!0,type:"primary",plain:!0,onClick:()=>{var e;(e=p.value)==null||e.prev()}},{default:()=>[A("\u4E0A\u4E00\u9898")]}),s(q,{block:!0,round:!0,type:"primary",onClick:F,loading:t.nextStatus,disabled:t.nextStatus},{default:()=>[t.questionList.length===t.currentIndex+1?"\u6D4B\u8BD5\u5B8C\u6210":"\u4E0B\u4E00\u9898"]}),s(nt,{src:z,class:[i.wapList,"van-haptics-feedback"],onClick:()=>t.visiableAnswer=!0},null)])]}),s(at,{show:t.visiableAnswer,"onUpdate:show":e=>t.visiableAnswer=e,title:"\u9898\u76EE\u5217\u8868",safeAreaInsetBottom:!0},{default:()=>[s(V,{value:t.questionList,onSelect:e=>{var a;(a=p.value)==null||a.swipeTo(e,{immediate:!0}),t.visiableAnswer=!1}},null)]}),s(K,{show:t.visiableResult,"onUpdate:show":e=>t.visiableResult=e,closeOnClickOverlay:!1,style:{background:"transparent",width:"96%"}},{default:()=>[s(J,{status:t.resultStatusType,result:t.resultInfo,confirmButtonText:"\u53BB\u7EC3\u4E60",cancelButtonText:"\u6211\u77E5\u9053\u4E86",onClose:()=>{t.visiableResult=!1,d.back(),d.back()},onConform:()=>{t.visiableResult=!1,d.back(),d.back()}},null)]}),s(v,{show:t.visiableSure,"onUpdate:show":e=>t.visiableSure=e,title:"\u6D4B\u9A8C\u5B8C\u6210",message:"\u786E\u8BA4\u672C\u6B21\u6D4B\u9A8C\u7684\u9898\u76EE\u90FD\u5B8C\u6210\u4E86\u5417\uFF1F\\n\u63D0\u4EA4\u540E\u4E0D\u53EF\u4FEE\u6539\u54E6",messageAlign:"left",showCancelButton:!0,cancelButtonText:"\u518D\u7B49\u7B49",confirmButtonText:"\u786E\u8BA4\u5B8C\u6210",onConfirm:U},null),s(v,{show:t.visiableExam,"onUpdate:show":e=>t.visiableExam=e,message:"\u8003\u8BD5\u5DF2\u7ED3\u675F",messageAlign:"center",onConfirm:async()=>{S(),t.visiableResult=!0}},null),s(v,{show:t.quitStatus,"onUpdate:show":e=>t.quitStatus=e,title:"\u63D0\u793A",message:"\u60A8\u662F\u5426\u9000\u51FA\u672C\u6B21\u6D4B\u9A8C\uFF1F",confirmButtonText:"\u786E\u8BA4\u9000\u51FA",showCancelButton:!0,cancelButtonText:"\u53D6\u6D88",onCancel:()=>{window.history.pushState(null,"",document.URL),window.addEventListener("popstate",g,!1)},onConfirm:()=>{S()}},null)])}}});export{Bt as default};