1 |
- import{d as C,U,q as k,r as D,x as N,af as R,D as c,y as O,a8 as P,a as n,S as M,A as l,C as T,V as Q,a2 as K,z as H,_ as F}from"./index-5e5e4ebc.js";import{e as d,Q as p,C as A,D as $,K as z,P as V,i as j,A as W,a as G,R as X}from"./index-9fd9ceff.js";import{M as q}from"./index-9096eaf6.js";import{u as Y,a as J}from"./index-572087e5.js";import{S as Z,a as ee}from"./index-d46a4ad2.js";import{I as te}from"./index-fa23aaeb.js";import"./index-8fc8f1a6.js";import"./index-cc5b42dd.js";import"./index-4bcfa431.js";const ne="_unitDetail_13q27_1",se="_unitSwipe_13q27_9",ie="_questionTitle_13q27_12",oe="_questionNum_13q27_21",ae="_questionType_13q27_24",ue="_wapList_13q27_31",le="_btnSection_13q27_37",re="_prevBtn_13q27_42",ce="_nextBtn_13q27_43",de="_activePrevBtn_13q27_44",pe="_right_13q27_67",fe="_error_13q27_70",ve="_minutes_13q27_73",o={unitDetail:ne,unitSwipe:se,questionTitle:ie,questionNum:oe,questionType:ae,wapList:ue,btnSection:le,prevBtn:re,nextBtn:ce,activePrevBtn:de,right:pe,error:fe,minutes:ve};function we(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!K(r)}const Ee=C({name:"unit-detail",setup(){const r=U(),I=k(),f=D(),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=R({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()=>{d.emit("unitAudioStop"),await y(),b()}}),E=async()=>{try{let s={};if(e.type==="ai"){const{data:t}=await c.post("/edu-app/studentUnitExamination/pointRandomSave",{data:{knowledgePointIds:e.knowledgePointIds}});s=t||{}}else{const{data:t}=await c.post("/edu-app/studentUnitExamination/mockExamination",{data:{lessonCoursewareId:e.lessonCoursewareId}});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||{},L()}catch(s){}},L=async()=>{const t=(e.examDetail||{}).timeMinutes||0;e.time=Math.ceil(t*60*1e3),setTimeout(()=>{u.reset(t*60*1e3),u.start()},10)},S=async()=>{var s;e.nextStatus=!0;try{const t=e.questionList||[],a=[];if(t.forEach((i,m)=>{i.userAnswer&&i.userAnswer.length>0&&a.push({questionId:i.id,details:i.userAnswer})}),e.questionList.length===e.currentIndex+1){d.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,b();return}await c.post("/edu-app/studentUnitExamination/submitAnswer",{hideLoading:!0,data:{answers:a,studentUnitExaminationId:e.studentUnitExaminationId}}),(s=f.value)==null||s.next()}catch(t){}e.nextStatus=!1};let h=0;const v=(s=!0)=>{H(()=>{s&&window.scrollTo(0,0),setTimeout(()=>{var x;const t=(x=document.querySelectorAll(".van-swipe-item")[e.currentIndex])==null?void 0:x.querySelector(".swipe-item-question"),a=t==null?void 0:t.querySelectorAll(".answerTitleImg img");let i=!0;a==null||a.forEach(B=>{B.complete||(i=!1)}),!i&&h<3&&setTimeout(()=>{h+=1,v(s)},300),i&&(h=0);const m=F(t);e.swipeHeight=m.height},100)})},g=()=>{e.visiableInfo.operationType==="RESULT"?(e.visiableInfo.show=!1,I.back(),I.back()):e.visiableInfo.operationType==="BACK"||e.visiableInfo.operationType==="CONTINUE"?y():e.visiableInfo.operationType==="TIME"&&(e.visiableInfo.show=!1)},_=async s=>{if(e.visiableInfo.operationType==="BACK"){if(s){e.visiableInfo.show=!1,window.history.pushState(null,"",document.URL),window.addEventListener("popstate",w,!1);return}try{await c.get("/edu-app/studentUnitExamination/dropExamination",{params:{studentUnitExaminationId:e.studentUnitExaminationId}}),e.visiableInfo.show=!1,b()}catch(t){}}else e.visiableInfo.operationType==="CONTINUE"&&(e.visiableInfo.show=!1,window.history.pushState(null,"",document.URL),window.addEventListener("popstate",w,!1))},y=async()=>{try{const s=e.questionList||[],t=[];s.forEach(i=>{i.userAnswer&&i.userAnswer.length>0&&t.push({questionId:i.id,details:i.userAnswer})});const{data:a}=await c.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='${o.right}'>${a.score}分</span>,正确率<span class='${o.error}'>${a.rightRate}%</span>,实际用时<span class='${o.minutes}'>${Math.ceil(a.answerTime/60)}</span>分钟~</div>`}catch(s){}},w=()=>{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="还有题目未完成哦,是否要提前交卷?",d.emit("unitAudioStop")},b=()=>{window.removeEventListener("popstate",w,!1),I.back()};return O(async()=>{Y(document,"scroll",()=>{const{y:s}=J();s.value>52?(e.background="#fff",e.color="#323333"):(e.background="transparent",e.color="#fff")}),await E(),v(),window.history.pushState(null,"",document.URL),window.addEventListener("popstate",w,!1)}),P(()=>{d.emit("unitAudioStop")}),()=>{let s;return n("div",{class:o.unitDetail},[n(q,{position:"top"},{default:()=>[n(M,{border:!1,background:e.background,color:e.color},null)]}),n(Z,{loop:!1,showIndicators:!1,ref:f,duration:300,touchable:!1,class:o.unitSwipe,style:{paddingBottom:"12px"},lazyRender:!0,height:e.swipeHeight,onChange:t=>{d.emit("unitAudioStop"),e.currentIndex=t,v()}},we(s=e.questionList.map((t,a)=>n(ee,null,{default:()=>[n("div",{class:"swipe-item-question"},[t.questionTypeCode===p.RADIO&&n(A,{value:t.userAnswer,"onUpdate:value":i=>t.userAnswer=i,index:a+1,data:t,type:"radio",showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>n("div",{class:o.questionTitle},[n("div",{class:o.questionNum},[n("span",null,[e.currentIndex+1]),l("/"),e.questionList.length]),n("div",{class:o.questionType},[u.current.value.minutes+u.current.value.hours*60,l(":"),u.current.value.seconds])])}),t.questionTypeCode===p.CHECKBOX&&n(A,{value:t.userAnswer,"onUpdate:value":i=>t.userAnswer=i,index:a+1,data:t,type:"checkbox",showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>n("div",{class:o.questionTitle},[n("div",{class:o.questionNum},[n("span",null,[e.currentIndex+1]),l("/"),e.questionList.length]),n("div",{class:o.questionType},[u.current.value.minutes+u.current.value.hours*60,l(":"),u.current.value.seconds])])}),t.questionTypeCode===p.SORT&&n($,{value:t.userAnswer,"onUpdate:value":[i=>t.userAnswer=i,()=>{const i=!(t.userAnswer&&t.userAnswer.length>0);v(i)}],data:t,index:a+1,showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>n("div",{class:o.questionTitle},[n("div",{class:o.questionNum},[n("span",null,[e.currentIndex+1]),l("/"),e.questionList.length]),n("div",{class:o.questionType},[u.current.value.minutes+u.current.value.hours*60,l(":"),u.current.value.seconds])])}),t.questionTypeCode===p.LINK&&n(z,{value:t.userAnswer,"onUpdate:value":i=>t.userAnswer=i,data:t,index:a+1,showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>n("div",{class:o.questionTitle},[n("div",{class:o.questionNum},[n("span",null,[e.currentIndex+1]),l("/"),e.questionList.length]),n("div",{class:o.questionType},[u.current.value.minutes+u.current.value.hours*60,l(":"),u.current.value.seconds])])}),t.questionTypeCode===p.PLAY&&n(V,{value:t.userAnswer,"onUpdate:value":i=>t.userAnswer=i,data:t,index:a+1,unitId:e.studentUnitExaminationId,showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>n("div",{class:o.questionTitle},[n("div",{class:o.questionNum},[n("span",null,[e.currentIndex+1]),l("/"),e.questionList.length]),n("div",{class:o.questionType},[u.current.value.minutes+u.current.value.hours*60,l(":"),u.current.value.seconds])])})])]})))?s:{default:()=>[s]}),n(q,{position:"bottom"},{default:()=>[n("div",{class:["btnGroup btnMore",o.btnSection]},[n(T,{round:!0,block:!0,class:e.currentIndex>0?o.activePrevBtn:o.prevBtn,disabled:!(e.currentIndex>0),onClick:()=>{var t;(t=f.value)==null||t.prev()}},{default:()=>[l("上一题")]}),n(T,{block:!0,round:!0,class:o.nextBtn,onClick:S,loading:e.nextStatus,disabled:e.nextStatus},{default:()=>[e.questionList.length===e.currentIndex+1?"提交":"下一题"]}),n(te,{src:j,class:[o.wapList,"van-haptics-feedback"],onClick:()=>e.visiableAnswer=!0},null)])]}),n(W,{show:e.visiableAnswer,"onUpdate:show":t=>e.visiableAnswer=t,title:"题目列表",safeAreaInsetBottom:!0},{default:()=>[n(G,{value:e.questionList,onSelect:t=>{var a;(a=f.value)==null||a.swipeTo(t,{immediate:!0}),e.visiableAnswer=!1}},null)]}),n(Q,{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(X,{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:g,onClose:_},null)]})])}}});export{Ee as default};
|