1 |
- import{d as D,P as M,q as O,r as Q,x as $,e as H,y as K,Q as F,a as t,V as z,A as c,C as q,R as m,S as A,a3 as V,D as g,N as j,z as W,$ as Y,U as k}from"./index-869d77fb.js";import{e as h,Q as f,C as L,D as G,K as X,P as J,i as Z,A as ee,a as se,R as te}from"./index-8029f624.js";import{M as _}from"./index-3eb77ad0.js";import{E as ne}from"./index-54a8f5e0.js";import{b as oe,u as ae,a as ie}from"./index-155c29c2.js";import{S as le,a as ue}from"./index-d45dfe1a.js";import{I as re}from"./index-e76f2a88.js";import"./index-3fd44b77.js";import"./index-70d6770d.js";import"./howler-ae3abd7b.js";import"./index-1c6c2ec0.js";const ce="_unitDetail_b7pwk_1",pe="_unitSwipe_b7pwk_9",de="_questionTitle_b7pwk_12",we="_questionNum_b7pwk_21",fe="_questionType_b7pwk_24",ve="_wapList_b7pwk_42",ye="_btnSection_b7pwk_48",be="_prevBtn_b7pwk_53",he="_nextBtn_b7pwk_54",Ie="_activePrevBtn_b7pwk_55",Te="_right_b7pwk_78",Ae="_error_b7pwk_81",xe="_primary_b7pwk_84",Ce="_unitDetailTablet_b7pwk_87",a={unitDetail:ce,unitSwipe:pe,questionTitle:de,questionNum:we,questionType:fe,wapList:ve,btnSection:ye,prevBtn:be,nextBtn:he,activePrevBtn:Ie,right:Te,error:Ae,primary:xe,unitDetailTablet:Ce};function qe(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!V(r)}const De=D({name:"unit-detail",setup(){const r=M(),v=O(),p=Q(),e=$({type:r.query.type,knowledgePointIds:r.query.knowledgePointIds,lessonCoursewareId:r.query.lessonCoursewareId,background:"transparent",visiableError:!1,visiableAnswer:!1,id:r.query.id,currentIndex:0,questionList:[],visiableInfo:{show:!1,operationType:"RESULT",type:"DEFAULT",content:"",showCancelButton:!1,confirmButtonText:"",cancelButtonText:"",title:""},nextStatus:!1,swipeHeight:"auto",answerAnalysis:"",questionTypeCode:"",overResult:{time:"00:00",questionLength:0,errorLength:0,rate:0}}),{counter:x,resume:me,pause:E}=oe(1e3,{controls:!0}),B=async()=>{try{const{data:o}=await g.post("/edu-app/studentUnitExamination/queryPracticeModeExam",{data:{lessonCoursewareId:e.lessonCoursewareId,knowledgePointIds:e.knowledgePointIds}}),s=o||{};s.examinationQuestionAdds.forEach(n=>{n.showAnalysis=!1,n.analysis={message:n.answerAnalysis,topic:!0,isAnswer:!1,userResult:!1,disabled:!1},n.userAnswer=[]}),e.questionList=s.examinationQuestionAdds||[]}catch(o){}},S=async()=>{var o,s;try{const n=e.questionList||[];let i=!0;const l=n[e.currentIndex];if(((o=l==null?void 0:l.userAnswer)==null?void 0:o.length)<=0){j("题目尚未做答");return}if(!(l!=null&&l.analysis.isAnswer)){let w={};n.forEach((u,T)=>{T===e.currentIndex&&(w={questionId:u.id,details:u.userAnswer||[]})});const{data:b}=await g.post("/edu-app/studentUnitExamination/submitTrainingAnswer",{hideLoading:!0,data:w});i=b,n.forEach((u,T)=>{T===e.currentIndex&&(e.answerAnalysis=u.answerAnalysis,e.questionTypeCode=u.questionTypeCode,u.showAnalysis=!0,u.analysis.userResult=b,u.analysis.isAnswer=!0,u.analysis.disabled=!0)})}if(e.questionList.length===e.currentIndex+1){h.emit("unitAudioStop"),e.visiableInfo.show=!0,e.visiableInfo.title="练习完成",e.visiableInfo.showCancelButton=!0,e.visiableInfo.operationType="CONTINUE",e.visiableInfo.cancelButtonText="再等等",e.visiableInfo.confirmButtonText="确认完成",e.visiableInfo.content="确认本次练习的题目都完成了吗?",window.removeEventListener("popstate",d,!1),v.back();return}i?(s=p.value)==null||s.next():e.visiableError=!0}catch(n){}},C=H(()=>{const o=e.questionList||[];let s=0,n=0,i=0;return o.forEach(l=>{l.showAnalysis&&(s+=1,l.analysis.userResult?n+=1:i+=1)}),{count:s,passCount:n,noPassCount:i}});let I=0;const y=(o=!0)=>{W(()=>{o&&window.scrollTo(0,0),setTimeout(()=>{var w;const s=(w=document.querySelectorAll(".van-swipe-item")[e.currentIndex])==null?void 0:w.querySelector(".swipe-item-question"),n=s==null?void 0:s.querySelectorAll(".answerTitleImg img");let i=!0;n==null||n.forEach(b=>{b.complete||(i=!1)}),!i&&I<3&&setTimeout(()=>{I+=1,y(o)},300),i&&(I=0);const l=Y(s);e.swipeHeight=l.height},100)})},R=()=>{e.visiableInfo.operationType==="RESULT"?(e.visiableInfo.show=!1,A().isApp?k({api:"back"}):(v.back(),v.back())):e.visiableInfo.operationType==="BACK"?(e.visiableInfo.show=!1,U()):e.visiableInfo.operationType==="CONTINUE"&&P()},N=async()=>{e.visiableInfo.operationType==="RESULT"||(e.visiableInfo.operationType==="BACK"||e.visiableInfo.operationType==="CONTINUE")&&(e.visiableInfo.show=!1,window.history.pushState(null,"",document.URL),window.addEventListener("popstate",d,!1))},P=()=>{const o=C.value;let s=0;o.count>0&&(s=Math.floor(o.passCount/o.count*100));const n=x.value,i=Math.floor(n/60)>=10?Math.floor(n/60):"0"+Math.floor(n/60),l=n%60>=10?n%60:"0"+n%60;e.overResult={time:i+":"+l,questionLength:o.count,errorLength:o.noPassCount,rate:s},E(),x.value=0,e.visiableInfo.show=!0,e.visiableInfo.title="已完成~",e.visiableInfo.showCancelButton=!1,e.visiableInfo.operationType="RESULT",e.visiableInfo.confirmButtonText="确认",e.visiableInfo.content=`<div>您已完成本次测试,答对<span class='${a.right}'>${o.passCount}</span>,答错<span class='${a.error}'>${o.count-o.passCount}</span>,正确率<span class='${a.primary}'>${s}%</span>~</div>`},d=()=>{const o=C.value;e.visiableInfo.show=!0,e.visiableInfo.title="确认退出吗?",e.visiableInfo.showCancelButton=!0,e.visiableInfo.operationType="BACK",e.visiableInfo.cancelButtonText="取消",e.visiableInfo.confirmButtonText="确定",e.visiableInfo.content=`您已经完成${o.passCount+o.noPassCount}道题了,继续做题可以巩固所学知识哦~`,h.emit("unitAudioStop")},U=()=>{window.removeEventListener("popstate",d,!1),A().isApp?k({api:"back"}):v.back()};return K(async()=>{ae(document,"scroll",()=>{const{y:o}=ie();o.value>52?e.background="#fff":e.background="transparent"}),await B(),y(),window.history.pushState(null,"",document.URL),window.addEventListener("popstate",d,!1)}),F(()=>{h.emit("unitAudioStop")}),()=>{let o;return t("div",{class:[a.unitDetail,A().isTablet?a.unitDetailTablet:""]},[t(_,{position:"top"},{default:()=>[t(z,{border:!1,background:e.background},null)]}),t(le,{loop:!1,showIndicators:!1,ref:p,duration:300,touchable:!1,class:a.unitSwipe,style:{paddingBottom:"12px"},lazyRender:!0,height:e.swipeHeight,onChange:s=>{h.emit("unitAudioStop"),e.currentIndex=s,y()}},qe(o=e.questionList.map((s,n)=>t(ue,null,{default:()=>[t("div",{class:"swipe-item-question"},[s.questionTypeCode===f.RADIO&&t(L,{value:s.userAnswer,"onUpdate:value":i=>s.userAnswer=i,index:n+1,data:s,type:"radio",showAnalysis:s.showAnalysis,analysis:s.analysis},{title:()=>t("div",{class:a.questionTitle},[t("div",{class:a.questionNum},[t("span",null,[e.currentIndex+1]),c("/"),e.questionList.length]),t("div",{class:a.questionType},[t("i",null,null),t("span",null,[s.knowledgePointName])])])}),s.questionTypeCode===f.CHECKBOX&&t(L,{value:s.userAnswer,"onUpdate:value":i=>s.userAnswer=i,index:n+1,data:s,type:"checkbox",showAnalysis:s.showAnalysis,analysis:s.analysis},{title:()=>t("div",{class:a.questionTitle},[t("div",{class:a.questionNum},[t("span",null,[e.currentIndex+1]),c("/"),e.questionList.length]),t("div",{class:a.questionType},[t("i",null,null),t("span",null,[s.knowledgePointName])])])}),s.questionTypeCode===f.SORT&&t(G,{value:s.userAnswer,"onUpdate:value":[i=>s.userAnswer=i,()=>{const i=!(s.userAnswer&&s.userAnswer.length>0);y(i)}],data:s,index:n+1,showAnalysis:s.showAnalysis,analysis:s.analysis},{title:()=>t("div",{class:a.questionTitle},[t("div",{class:a.questionNum},[t("span",null,[e.currentIndex+1]),c("/"),e.questionList.length]),t("div",{class:a.questionType},[t("i",null,null),t("span",null,[s.knowledgePointName])])])}),s.questionTypeCode===f.LINK&&t(X,{value:s.userAnswer,"onUpdate:value":i=>s.userAnswer=i,data:s,index:n+1,showAnalysis:s.showAnalysis,analysis:s.analysis},{title:()=>t("div",{class:a.questionTitle},[t("div",{class:a.questionNum},[t("span",null,[e.currentIndex+1]),c("/"),e.questionList.length]),t("div",{class:a.questionType},[t("i",null,null),t("span",null,[s.knowledgePointName])])])}),s.questionTypeCode===f.PLAY&&t(J,{value:s.userAnswer,"onUpdate:value":i=>s.userAnswer=i,data:s,index:n+1,unitId:e.id,showAnalysis:s.showAnalysis,analysis:s.analysis},{title:()=>t("div",{class:a.questionTitle},[t("div",{class:a.questionNum},[t("span",null,[e.currentIndex+1]),c("/"),e.questionList.length]),t("div",{class:a.questionType},[t("i",null,null),t("span",null,[s.knowledgePointName])])])})])]})))?o:{default:()=>[o]}),t(_,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup btnMore",a.btnSection]},[t(q,{round:!0,block:!0,class:e.currentIndex>0?a.activePrevBtn:a.prevBtn,disabled:!(e.currentIndex>0),onClick:()=>{var s;(s=p.value)==null||s.prev()}},{default:()=>[c("上一题")]}),t(q,{block:!0,round:!0,class:a.nextBtn,onClick:S,loading:e.nextStatus,disabled:e.nextStatus},{default:()=>[e.questionList.length===e.currentIndex+1?"提交":"下一题"]}),t(re,{src:Z,class:[a.wapList,"van-haptics-feedback"],onClick:()=>e.visiableAnswer=!0},null)])]}),t(ee,{show:e.visiableAnswer,"onUpdate:show":s=>e.visiableAnswer=s,title:"题目列表",safeAreaInsetBottom:!0},{default:()=>[t(se,{value:e.questionList,statusList:[{text:"答对",color:"#1CACF1"},{text:"答错",color:"#FF8486"},{text:"未答",color:"#EAEAEA"}],lookType:"PRACTICE",onSelect:s=>{var n;(n=p.value)==null||n.swipeTo(s,{immediate:!0}),e.visiableAnswer=!1}},null)]}),t(m,{show:e.visiableError,"onUpdate:show":s=>e.visiableError=s,style:{width:"90%",maxWidth:"520px"},round:!0,closeOnClickOverlay:!1},{default:()=>[t(ne,{onClose:()=>e.visiableError=!1,answerAnalysis:e.answerAnalysis,questionTypeCode:e.questionTypeCode,onConform:()=>{var s;(s=p.value)==null||s.next(),setTimeout(()=>{e.answerAnalysis=""},500)}},null)]}),t(m,{show:e.visiableInfo.show,"onUpdate:show":s=>e.visiableInfo.show=s,closeOnClickOverlay:!1,style:{background:"transparent",width:"100%",maxWidth:"100%",transform:"translateY(-55%)"}},{default:()=>[t(te,{title:e.visiableInfo.title,showCancelButton:e.visiableInfo.showCancelButton,cancelButtonText:e.visiableInfo.cancelButtonText,confirmButtonText:e.visiableInfo.confirmButtonText,status:e.visiableInfo.type,content:e.visiableInfo.content,contentHtml:!0,onConform:R,onClose:N},null)]})])}}});export{De as default};
|