index-a4ea3eab.js 10 KB

1
  1. import{d as U,U as N,q as P,r as O,x as M,w as z,e as D,y as Q,ag as H,a as t,S as K,A as c,C as r,V as x,a1 as G,D as h,z as $,Z as V}from"./index-fac4d009.js";import{e as y,Q as v,C as B,D as j,K as W,P as Y,i as X,A as Z,a as J,E as ee,R as se}from"./index-5a189fe4.js";import{M as q}from"./index-bc672952.js";import{b as te,u as ne,a as oe}from"./index-5c4f5cd3.js";import{S as ae,a as ie}from"./index-1701cc18.js";import{I as le}from"./index-fdcc93f3.js";import"./index-3834f2c2.js";import"./index-a0c979fe.js";import"./index-5cba6af7.js";const re="_unitDetail_1ficy_1",ue="_unitSwipe_1ficy_9",ce="_questionTitle_1ficy_12",pe="_questionNum_1ficy_21",fe="_questionType_1ficy_24",de="_controlBtn_1ficy_42",ve="_wapList_1ficy_45",we="_btnSection_1ficy_51",ye="_prevBtn_1ficy_56",be="_nextBtn_1ficy_57",he="_activePrevBtn_1ficy_58",Ie="_right_1ficy_81",Ae="_error_1ficy_84",a={unitDetail:re,unitSwipe:ue,questionTitle:ce,questionNum:pe,questionType:fe,controlBtn:de,wapList:ve,btnSection:we,prevBtn:ye,nextBtn:be,activePrevBtn:he,right:Ie,error:Ae};function Ce(p){return typeof p=="function"||Object.prototype.toString.call(p)==="[object Object]"&&!G(p)}const Re=U({name:"unit-detail",setup(){const p=N(),E=P(),f=O(),e=M({background:"transparent",color:"#fff",visiableError:!1,visiableAnswer:!1,id:p.query.id,currentIndex:0,questionList:[],page:1,rows:10,total:0,isFinish:!1,visiableInfo:{show:!1,operationType:"RESULT",type:"DEFAULT",content:"",showCancelButton:!1,confirmButtonText:"",cancelButtonText:"",title:"",graspItem:{}},nextStatus:!1,swipeHeight:"auto",answerAnalysis:"",questionTypeCode:"",overResult:{time:"00:00",questionLength:0,errorLength:0,rate:0}}),{counter:I,resume:ge,pause:_}=te(1e3,{controls:!0}),A=async()=>{try{const{data:n}=await h.post("/edu-app/studentUnitExamination/errorEdition",{data:{page:e.page,rows:e.rows}}),s=n||{};e.total=s.total||0,e.isFinish=!(s.current<s.pages),s.records.forEach(o=>{o.showAnalysis=!1,o.grasp=!1,o.analysis={message:o.answerAnalysis,topic:!0,userResult:!1},o.userAnswer=[]}),e.questionList.push(...s.records||[])}catch(n){}};z(()=>e.currentIndex,()=>{console.log(e.currentIndex,"index"),e.currentIndex+3>=e.questionList.length&&!e.isFinish&&(e.page=e.page+1,A())});const d=async n=>{n.grasp||(e.visiableInfo.show=!0,e.visiableInfo.title="确定掌握此题?",e.visiableInfo.showCancelButton=!0,e.visiableInfo.operationType="GRASP",e.visiableInfo.cancelButtonText="取消",e.visiableInfo.confirmButtonText="确定",e.visiableInfo.content="你确定已掌握该题知识要点,此题将移除你的错题集。",e.visiableInfo.graspItem=n)},S=async()=>{try{e.visiableInfo.show=!1,await h.get("/edu-app/studentExaminationErrorEdition/del",{hideLoading:!1,params:{studentExaminationErrorEditionId:e.visiableInfo.graspItem.studentExaminationErrorEditionId}}),e.visiableInfo.graspItem.grasp=!0}catch(n){}},L=async()=>{var n;try{const s=e.questionList||[];let o={};s.forEach((l,u)=>{u===e.currentIndex&&(o={questionId:l.id,details:l.userAnswer||[]})});const{data:i}=await h.post("/edu-app/studentUnitExamination/submitTrainingAnswer",{hideLoading:!0,data:o});if(s.forEach((l,u)=>{u===e.currentIndex&&(e.answerAnalysis=l.answerAnalysis,e.questionTypeCode=l.questionTypeCode,l.showAnalysis=!0,l.analysis.userResult=i)}),e.questionList.length===e.currentIndex+1){y.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="确认本次练习的题目都完成了吗?";return}i?(n=f.value)==null||n.next():e.visiableError=!0}catch(s){}},C=D(()=>{const n=e.questionList||[];let s=0,o=0,i=0;return n.forEach(l=>{l.showAnalysis&&(s+=1,l.analysis.userResult?o+=1:i+=1)}),{count:s,passCount:o,noPassCount:i}});let b=0;const w=(n=!0)=>{$(()=>{n&&window.scrollTo(0,0),setTimeout(()=>{var u;const s=(u=document.querySelectorAll(".van-swipe-item")[e.currentIndex])==null?void 0:u.querySelector(".swipe-item-question"),o=s==null?void 0:s.querySelectorAll(".answerTitleImg img");let i=!0;o==null||o.forEach(F=>{F.complete||(i=!1)}),!i&&b<3&&setTimeout(()=>{b+=1,w(n)},300),i&&(b=0);const l=V(s);e.swipeHeight=l.height},100)})},m=()=>{e.visiableInfo.operationType==="RESULT"||e.visiableInfo.operationType==="BACK"?(e.visiableInfo.show=!1,T()):e.visiableInfo.operationType==="CONTINUE"?k():e.visiableInfo.operationType==="GRASP"&&S()},R=async()=>{const n=e.visiableInfo.operationType;n==="RESULT"||(n==="BACK"?(e.visiableInfo.show=!1,window.history.pushState(null,"",document.URL),window.addEventListener("popstate",g,!1)):(n==="CONTINUE"||n==="GRASP")&&(e.visiableInfo.show=!1))},k=()=>{const n=C.value;let s=0;n.count>0&&(s=Math.floor(n.passCount/n.count*100));const o=I.value,i=Math.floor(o/60)>=10?Math.floor(o/60):"0"+Math.floor(o/60),l=o%60>=10?o%60:"0"+o%60;e.overResult={time:i+":"+l,questionLength:n.count,errorLength:n.noPassCount,rate:s},_(),I.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}'>${n.passCount}</span>,答错<span class='${a.error}'>${n.count-n.passCount}</span>,正确率${s}%~</div>`},g=()=>{const n=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=`您已经完成${n.passCount+n.noPassCount}道题了,继续做题可以巩固所学知识哦~`,y.emit("unitAudioStop")},T=()=>{window.removeEventListener("popstate",g,!1),E.back()};return Q(async()=>{ne(document,"scroll",()=>{const{y:n}=oe();n.value>52?(e.background="#fff",e.color="#323333"):(e.background="transparent",e.color="#fff")}),await A(),w()}),H(()=>{y.emit("unitAudioStop")}),()=>{let n;return t("div",{class:a.unitDetail},[t(q,{position:"top"},{default:()=>[t(K,{border:!1,background:e.background,color:e.color},null)]}),t(ae,{loop:!1,showIndicators:!1,ref:f,duration:300,touchable:!1,class:a.unitSwipe,style:{paddingBottom:"12px"},lazyRender:!0,height:e.swipeHeight,onChange:s=>{y.emit("unitAudioStop"),e.currentIndex=s,w()}},Ce(n=e.questionList.map((s,o)=>t(ie,null,{default:()=>[t("div",{class:"swipe-item-question"},[s.questionTypeCode===v.RADIO&&t(B,{value:s.userAnswer,"onUpdate:value":i=>s.userAnswer=i,index:o+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.total]),t(r,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",class:a.controlBtn,disabled:s.grasp,onClick:()=>d(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])}),s.questionTypeCode===v.CHECKBOX&&t(B,{value:s.userAnswer,"onUpdate:value":i=>s.userAnswer=i,index:o+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.total]),t(r,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",class:a.controlBtn,disabled:s.grasp,onClick:()=>d(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])}),s.questionTypeCode===v.SORT&&t(j,{value:s.userAnswer,"onUpdate:value":[i=>s.userAnswer=i,()=>{const i=!(s.userAnswer&&s.userAnswer.length>0);w(i)}],data:s,index:o+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.total]),t(r,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",class:a.controlBtn,disabled:s.grasp,onClick:()=>d(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])}),s.questionTypeCode===v.LINK&&t(W,{value:s.userAnswer,"onUpdate:value":i=>s.userAnswer=i,data:s,index:o+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.total]),t(r,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",class:a.controlBtn,disabled:s.grasp,onClick:()=>d(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])}),s.questionTypeCode===v.PLAY&&t(Y,{value:s.userAnswer,"onUpdate:value":i=>s.userAnswer=i,data:s,index:o+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.total]),t(r,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",disabled:s.grasp,class:a.controlBtn,onClick:()=>d(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])})])]})))?n:{default:()=>[n]}),t(q,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup btnMore",a.btnSection]},[t(r,{round:!0,block:!0,class:e.currentIndex>0?a.activePrevBtn:a.prevBtn,disabled:!(e.currentIndex>0),onClick:()=>{var s;(s=f.value)==null||s.prev()}},{default:()=>[c("上一题")]}),t(r,{block:!0,round:!0,class:a.nextBtn,onClick:L,loading:e.nextStatus,disabled:e.nextStatus},{default:()=>[e.questionList.length===e.currentIndex+1?"提交":"下一题"]}),t(le,{src:X,class:[a.wapList,"van-haptics-feedback"],onClick:()=>e.visiableAnswer=!0},null)])]}),t(Z,{show:e.visiableAnswer,"onUpdate:show":s=>e.visiableAnswer=s,title:"题目列表",safeAreaInsetBottom:!0},{default:()=>[t(J,{value:e.questionList,lookType:"PRACTICE",statusList:[{text:"答对",color:"#1CACF1"},{text:"答错",color:"#FF8486"},{text:"未答",color:"#EAEAEA"}],onSelect:s=>{var o;(o=f.value)==null||o.swipeTo(s,{immediate:!0}),e.visiableAnswer=!1}},null)]}),t(x,{show:e.visiableError,"onUpdate:show":s=>e.visiableError=s,style:{width:"90%"},round:!0,closeOnClickOverlay:!1},{default:()=>[t(ee,{onClose:()=>e.visiableError=!1,answerAnalysis:e.answerAnalysis,questionTypeCode:e.questionTypeCode,onConform:()=>{var s;(s=f.value)==null||s.next(),e.answerAnalysis=""}},null)]}),t(x,{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(se,{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:m,onClose:R},null)]})])}}});export{Re as default};