1 |
- import{d as U,P as k,q as D,r as R,x as N,af as O,D as p,y as P,a8 as M,a as n,W as Q,A as l,C as T,Q as K,a3 as H,E as $,z as F,$ as z,R as A,S as q}from"./index-521a9826.js";import{e as f,Q as v,C as E,D as W,K as j,P as V,i as G,A as X,a as Y,R as J}from"./index-7695da7e.js";import{M as g}from"./index-c0ea6da9.js";import{u as Z,a as ee}from"./index-fdaad3c0.js";import{S as te,a as ne}from"./index-5b82f39e.js";import{I as se}from"./index-25b5c9d0.js";import"./index-1f2f0321.js";import"./index-544f4e19.js";import"./howler-302efa4a.js";import"./index-1ad6a58d.js";const ie="_unitDetail_13q27_1",oe="_unitSwipe_13q27_9",ae="_questionTitle_13q27_12",ue="_questionNum_13q27_21",le="_questionType_13q27_24",re="_wapList_13q27_31",ce="_btnSection_13q27_37",de="_prevBtn_13q27_42",pe="_nextBtn_13q27_43",fe="_activePrevBtn_13q27_44",ve="_right_13q27_67",we="_error_13q27_70",Ie="_minutes_13q27_73",i={unitDetail:ie,unitSwipe:oe,questionTitle:ae,questionNum:ue,questionType:le,wapList:re,btnSection:ce,prevBtn:de,nextBtn:pe,activePrevBtn:fe,right:ve,error:we,minutes:Ie};function he(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!H(r)}const Se=U({name:"unit-detail",setup(){const r=k(),w=D(),I=R(),e=N({type:r.query.type,knowledgePointIds:r.query.knowledgePointIds,lessonCoursewareId:r.query.lessonCoursewareId,studentUnitExaminationId:"",background:"transparent",color:"#fff",visiableAnswer:!1,examDetail:{},currentIndex:0,time:0,questionList:[],visiableInfo:{show:!1,operationType:"RESULT",type:"DEFAULT",content:"",showCancelButton:!1,confirmButtonText:"",cancelButtonText:"",title:""},nextStatus:!1,swipeHeight:"auto",countDownOver:!1}),u=O({time:e.time,onChange(s){if(3e5>=s.total&&!e.countDownOver){if(e.visiableInfo.show){e.countDownOver=!0;return}e.visiableInfo.show=!0,e.visiableInfo.title="倒计时5分钟",e.visiableInfo.showCancelButton=!1,e.visiableInfo.operationType="TIME",e.visiableInfo.type="COUNTDOWN",e.visiableInfo.confirmButtonText="确认",e.visiableInfo.content="距离交卷时间还剩五分钟哦,请尽快答题~",e.countDownOver=!0}},onFinish:async()=>{f.emit("unitAudioStop"),await m(),window.removeEventListener("popstate",c,!1),w.back()}}),L=async()=>{try{let s={};if(e.type==="ai"){const{data:t}=await p.post("/edu-app/studentUnitExamination/pointRandomSave",{data:{knowledgePointIds:e.knowledgePointIds}});s=t||{}}else{const{data:t}=await p.post("/edu-app/studentUnitExamination/mockExamination",{data:{lessonCoursewareId:e.lessonCoursewareId,knowledgePointIds:e.knowledgePointIds}});s=t||{}}s.examinationQuestionAdds.forEach(t=>{t.showAnalysis=!1,t.analysis={message:t.answerAnalysis,topic:!0,userResult:!1},t.userAnswer=[]}),e.questionList=s.examinationQuestionAdds||[],e.studentUnitExaminationId=s.unitExaminationId,e.examDetail=s||{},S()}catch(s){}},S=async()=>{const t=(e.examDetail||{}).timeMinutes||0;e.time=Math.ceil(t*60*1e3),setTimeout(()=>{u.reset(t*60*1e3),u.start()},10)},_=async()=>{var s,t;e.nextStatus=!0;try{const a=e.questionList||[],o=a[e.currentIndex];if(((s=o==null?void 0:o.userAnswer)==null?void 0:s.length)<=0){$("题目尚未做答"),e.nextStatus=!1;return}const y=[];if(a.forEach((d,x)=>{d.userAnswer&&d.userAnswer.length>0&&y.push({questionId:d.id,details:d.userAnswer})}),e.questionList.length===e.currentIndex+1){f.emit("unitAudioStop"),e.visiableInfo.show=!0,e.visiableInfo.title="测验完成",e.visiableInfo.showCancelButton=!0,e.visiableInfo.operationType="CONTINUE",e.visiableInfo.type="DEFAULT",e.visiableInfo.cancelButtonText="再等等",e.visiableInfo.confirmButtonText="确认完成",e.visiableInfo.content="确认本次测验的题目都完成了吗?",e.nextStatus=!1,window.removeEventListener("popstate",c,!1),w.back();return}await p.post("/edu-app/studentUnitExamination/submitAnswer",{hideLoading:!0,data:{answers:y,studentUnitExaminationId:e.studentUnitExaminationId}}),(t=I.value)==null||t.next()}catch(a){}e.nextStatus=!1};let b=0;const h=(s=!0)=>{F(()=>{s&&window.scrollTo(0,0),setTimeout(()=>{var d;const t=(d=document.querySelectorAll(".van-swipe-item")[e.currentIndex])==null?void 0:d.querySelector(".swipe-item-question"),a=t==null?void 0:t.querySelectorAll(".answerTitleImg img");let o=!0;a==null||a.forEach(x=>{x.complete||(o=!1)}),!o&&b<3&&setTimeout(()=>{b+=1,h(s)},300),o&&(b=0);const y=z(t);e.swipeHeight=y.height},100)})},B=()=>{e.visiableInfo.operationType==="RESULT"?(e.visiableInfo.show=!1,A().isApp&&e.type!=="ai"?q({api:"back"}):(window.removeEventListener("popstate",c,!1),w.go(-2))):e.visiableInfo.operationType==="BACK"||e.visiableInfo.operationType==="CONTINUE"?m():e.visiableInfo.operationType==="TIME"&&(e.visiableInfo.show=!1)},C=async s=>{if(e.visiableInfo.operationType==="BACK"){if(s){e.visiableInfo.show=!1,window.history.pushState(null,"",document.URL),window.addEventListener("popstate",c,!1);return}try{await p.get("/edu-app/studentUnitExamination/dropExamination",{params:{studentUnitExaminationId:e.studentUnitExaminationId}}),e.visiableInfo.show=!1,A().isApp&&e.type!=="ai"?q({api:"back"}):(window.removeEventListener("popstate",c,!1),w.go(-2))}catch(t){}}else e.visiableInfo.operationType==="CONTINUE"&&(e.visiableInfo.show=!1,window.history.pushState(null,"",document.URL),window.addEventListener("popstate",c,!1))},m=async()=>{try{const s=e.questionList||[],t=[];s.forEach(o=>{o.userAnswer&&o.userAnswer.length>0&&t.push({questionId:o.id,details:o.userAnswer})});const{data:a}=await p.post("/edu-app/studentUnitExamination/completionExamination",{hideLoading:!1,data:{answers:t,studentUnitExaminationId:e.studentUnitExaminationId}});e.visiableInfo.show=!0,e.visiableInfo.title=a.score+"分",e.visiableInfo.showCancelButton=!1,e.visiableInfo.operationType="RESULT",e.visiableInfo.confirmButtonText="确认",a.status==="A_EXCELLENT"?(e.visiableInfo.type="GOOD",e.visiableInfo.content="<div>你很棒,题目掌握的非常不错,"):a.status==="B_PASS"?(e.visiableInfo.type="PASS",e.visiableInfo.content="<div>还需要加油哦,"):(e.visiableInfo.type="FAIL",e.visiableInfo.content="<div>别气馁,继续努力,"),e.visiableInfo.content+=`您本次获得了<span class='${i.right}'>${a.score}分</span>,正确率<span class='${i.error}'>${a.rightRate}%</span>,实际用时<span class='${i.minutes}'>${Math.ceil(a.answerTime/60)}</span>分钟~</div>`}catch(s){}},c=()=>{e.visiableInfo.show=!0,e.visiableInfo.title="确认要离开吗?",e.visiableInfo.showCancelButton=!0,e.visiableInfo.operationType="BACK",e.visiableInfo.type="DEFAULT",e.visiableInfo.cancelButtonText="弃考",e.visiableInfo.confirmButtonText="提交",e.visiableInfo.content="还有题目未完成哦,是否要提前交卷?",f.emit("unitAudioStop")};return P(async()=>{Z(document,"scroll",()=>{const{y:s}=ee();s.value>52?(e.background="#fff",e.color="#323333"):(e.background="transparent",e.color="#fff")}),await L(),h(),window.history.pushState(null,"",document.URL),window.addEventListener("popstate",c,!1)}),M(()=>{f.emit("unitAudioStop")}),()=>{let s;return n("div",{class:i.unitDetail},[n(g,{position:"top"},{default:()=>[n(Q,{border:!1,background:e.background,color:e.color},null)]}),n(te,{loop:!1,showIndicators:!1,ref:I,duration:300,touchable:!1,class:i.unitSwipe,style:{paddingBottom:"12px"},lazyRender:!0,height:e.swipeHeight,onChange:t=>{f.emit("unitAudioStop"),e.currentIndex=t,h()}},he(s=e.questionList.map((t,a)=>n(ne,null,{default:()=>[n("div",{class:"swipe-item-question"},[t.questionTypeCode===v.RADIO&&n(E,{value:t.userAnswer,"onUpdate:value":o=>t.userAnswer=o,index:a+1,data:t,type:"radio",showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>n("div",{class:i.questionTitle},[n("div",{class:i.questionNum},[n("span",null,[e.currentIndex+1]),l("/"),e.questionList.length]),n("div",{class:i.questionType},[u.current.value.minutes+u.current.value.hours*60,l(":"),u.current.value.seconds])])}),t.questionTypeCode===v.CHECKBOX&&n(E,{value:t.userAnswer,"onUpdate:value":o=>t.userAnswer=o,index:a+1,data:t,type:"checkbox",showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>n("div",{class:i.questionTitle},[n("div",{class:i.questionNum},[n("span",null,[e.currentIndex+1]),l("/"),e.questionList.length]),n("div",{class:i.questionType},[u.current.value.minutes+u.current.value.hours*60,l(":"),u.current.value.seconds])])}),t.questionTypeCode===v.SORT&&n(W,{value:t.userAnswer,"onUpdate:value":[o=>t.userAnswer=o,()=>{const o=!(t.userAnswer&&t.userAnswer.length>0);h(o)}],data:t,index:a+1,showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>n("div",{class:i.questionTitle},[n("div",{class:i.questionNum},[n("span",null,[e.currentIndex+1]),l("/"),e.questionList.length]),n("div",{class:i.questionType},[u.current.value.minutes+u.current.value.hours*60,l(":"),u.current.value.seconds])])}),t.questionTypeCode===v.LINK&&n(j,{value:t.userAnswer,"onUpdate:value":o=>t.userAnswer=o,data:t,index:a+1,showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>n("div",{class:i.questionTitle},[n("div",{class:i.questionNum},[n("span",null,[e.currentIndex+1]),l("/"),e.questionList.length]),n("div",{class:i.questionType},[u.current.value.minutes+u.current.value.hours*60,l(":"),u.current.value.seconds])])}),t.questionTypeCode===v.PLAY&&n(V,{value:t.userAnswer,"onUpdate:value":o=>t.userAnswer=o,data:t,index:a+1,unitId:e.studentUnitExaminationId,showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>n("div",{class:i.questionTitle},[n("div",{class:i.questionNum},[n("span",null,[e.currentIndex+1]),l("/"),e.questionList.length]),n("div",{class:i.questionType},[u.current.value.minutes+u.current.value.hours*60,l(":"),u.current.value.seconds])])})])]})))?s:{default:()=>[s]}),n(g,{position:"bottom"},{default:()=>[n("div",{class:["btnGroup btnMore",i.btnSection]},[n(T,{round:!0,block:!0,class:e.currentIndex>0?i.activePrevBtn:i.prevBtn,disabled:!(e.currentIndex>0),onClick:()=>{var t;(t=I.value)==null||t.prev()}},{default:()=>[l("上一题")]}),n(T,{block:!0,round:!0,class:i.nextBtn,onClick:_,loading:e.nextStatus,disabled:e.nextStatus},{default:()=>[e.questionList.length===e.currentIndex+1?"提交":"下一题"]}),n(se,{src:G,class:[i.wapList,"van-haptics-feedback"],onClick:()=>e.visiableAnswer=!0},null)])]}),n(X,{show:e.visiableAnswer,"onUpdate:show":t=>e.visiableAnswer=t,title:"题目列表",safeAreaInsetBottom:!0},{default:()=>[n(Y,{value:e.questionList,onSelect:t=>{var a;(a=I.value)==null||a.swipeTo(t,{immediate:!0}),e.visiableAnswer=!1}},null)]}),n(K,{show:e.visiableInfo.show,"onUpdate:show":t=>e.visiableInfo.show=t,closeOnClickOverlay:!1,style:{background:"transparent",width:"100%",maxWidth:"100%",transform:"translateY(-55%)"}},{default:()=>[n(J,{title:e.visiableInfo.title,showCancelButton:e.visiableInfo.showCancelButton,cancelButtonText:e.visiableInfo.cancelButtonText,confirmButtonText:e.visiableInfo.confirmButtonText,status:e.visiableInfo.type,content:e.visiableInfo.content,closeable:e.visiableInfo.operationType==="BACK",contentHtml:!0,onConform:B,onClose:C},null)]})])}}});export{Se as default};
|