1 |
- import{d as U,P,q as O,r as Q,x as M,w as z,e as D,y as $,a8 as H,a as s,W as K,A as p,C as u,Q as m,a3 as G,D as T,E as j,z as V,$ as W}from"./index-521a9826.js";import{e as I,Q as b,C as B,D as Y,K as X,P as J,i as Z,A as ee,a as te,R as se}from"./index-7695da7e.js";import{M as L}from"./index-c0ea6da9.js";import{E as ne}from"./index-0da6f576.js";import{b as oe,u as ae,a as ie}from"./index-fdaad3c0.js";import{S as le,a as re}from"./index-5b82f39e.js";import{I as ue}from"./index-25b5c9d0.js";import"./index-1f2f0321.js";import"./index-544f4e19.js";import"./howler-302efa4a.js";import"./index-1ad6a58d.js";const ce="_unitDetail_15a1l_1",pe="_unitSwipe_15a1l_9",de="_questionTitle_15a1l_12",fe="_questionNum_15a1l_21",ve="_pointName_15a1l_28",we="_questionType_15a1l_38",he="_controlBtn_15a1l_56",Ie="_wapList_15a1l_59",be="_btnSection_15a1l_65",ye="_prevBtn_15a1l_70",Ae="_nextBtn_15a1l_71",ge="_activePrevBtn_15a1l_72",Ce="_right_15a1l_95",xe="_error_15a1l_98",Te="_primary_15a1l_101",i={unitDetail:ce,unitSwipe:pe,questionTitle:de,questionNum:fe,pointName:ve,questionType:we,controlBtn:he,wapList:Ie,btnSection:be,prevBtn:ye,nextBtn:Ae,activePrevBtn:ge,right:Ce,error:xe,primary:Te};function qe(d){return typeof d=="function"||Object.prototype.toString.call(d)==="[object Object]"&&!G(d)}const Oe=U({name:"unit-detail",setup(){const d=P(),f=O(),v=Q(),e=M({background:"transparent",color:"#fff",visiableError:!1,visiableAnswer:!1,id:d.query.id,currentIndex:0,questionList:[],page:1,rows:50,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:q,resume:Ee,pause:_}=oe(1e3,{controls:!0}),A=async n=>{try{const{data:t}=await T.post("/edu-app/studentUnitExamination/errorEdition",{data:{page:e.page,rows:e.rows,maxStudentExaminationErrorEditionId:n}}),o=t||{};e.total=o.total||0,e.isFinish=!(o.current<o.pages),o.records.forEach(a=>{a.showAnalysis=!1,a.grasp=!1,a.analysis={message:a.answerAnalysis,topic:!0,userResult:!1},a.userAnswer=[]}),e.questionList.push(...o.records||[])}catch(t){}};z(()=>e.currentIndex,()=>{if(e.currentIndex+3>=e.questionList.length&&!e.isFinish){const n=e.questionList[e.questionList.length-1];e.page=e.page+1,A(n.id)}});const w=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,console.log(e.total,"toa"),e.total<=1&&C())},S=async()=>{try{if(e.visiableInfo.show=!1,await T.get("/edu-app/studentExaminationErrorEdition/del",{hideLoading:!1,params:{questionId:e.visiableInfo.graspItem.id}}),e.visiableInfo.graspItem.grasp=!0,I.emit("unitAudioStop"),e.total<=1){f.back(),f.back();return}if(e.total>e.currentIndex+1){const n=e.questionList.findIndex(t=>t.studentExaminationErrorEditionId===e.visiableInfo.graspItem.studentExaminationErrorEditionId);e.questionList.splice(n,1),e.total-=1,c();return}if(e.total==e.currentIndex+1){const n=e.questionList.findIndex(t=>t.studentExaminationErrorEditionId===e.visiableInfo.graspItem.studentExaminationErrorEditionId);e.questionList.splice(n,1),e.total-=1,e.currentIndex-=1,c();return}}catch(n){}},k=async()=>{var n,t;try{const o=e.questionList||[],a=o[e.currentIndex];if(((n=a==null?void 0:a.userAnswer)==null?void 0:n.length)<=0){j("题目尚未做答"),e.nextStatus=!1;return}let l={};o.forEach((r,x)=>{x===e.currentIndex&&(l={questionId:r.id,details:r.userAnswer||[]})});const{data:h}=await T.post("/edu-app/studentUnitExamination/submitTrainingAnswer",{hideLoading:!0,data:l});if(o.forEach((r,x)=>{x===e.currentIndex&&(e.answerAnalysis=r.answerAnalysis,e.questionTypeCode=r.questionTypeCode,r.showAnalysis=!0,r.analysis.userResult=h)}),e.questionList.length===e.currentIndex+1){I.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="确认本次练习的题目都完成了吗?",C();return}h?(t=v.value)==null||t.next():e.visiableError=!0}catch(o){}},E=D(()=>{const n=e.questionList||[];let t=0,o=0,a=0;return n.forEach(l=>{l.showAnalysis&&(t+=1,l.analysis.userResult?o+=1:a+=1)}),{count:t,passCount:o,noPassCount:a}});let g=0;const c=(n=!0)=>{V(()=>{n&&window.scrollTo(0,0),setTimeout(()=>{var h;const t=(h=document.querySelectorAll(".van-swipe-item")[e.currentIndex])==null?void 0:h.querySelector(".swipe-item-question"),o=t==null?void 0:t.querySelectorAll(".answerTitleImg img");let a=!0;o==null||o.forEach(r=>{r.complete||(a=!1)}),!a&&g<3&&setTimeout(()=>{g+=1,c(n)},300),a&&(g=0);const l=W(t);e.swipeHeight=l.height},100)})},R=()=>{e.visiableInfo.operationType==="RESULT"?(e.visiableInfo.show=!1,f.back(),f.back()):e.visiableInfo.operationType==="BACK"?(e.visiableInfo.show=!1,window.history.pushState(null,"",document.URL),window.addEventListener("popstate",y,!1)):e.visiableInfo.operationType==="CONTINUE"?F():e.visiableInfo.operationType==="GRASP"&&S()},N=async()=>{const n=e.visiableInfo.operationType;n==="RESULT"||(n==="BACK"?(e.visiableInfo.show=!1,C()):n==="CONTINUE"?e.visiableInfo.show=!1:n==="GRASP"&&(e.visiableInfo.show=!1,window.history.pushState(null,"",document.URL),window.addEventListener("popstate",y,!1)))},F=()=>{const n=E.value;let t=0;n.count>0&&(t=Math.floor(n.passCount/n.count*100));const o=q.value,a=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:a+":"+l,questionLength:n.count,errorLength:n.noPassCount,rate:t},_(),q.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='${i.right}'>${n.passCount}</span>,答错<span class='${i.error}'>${n.count-n.passCount}</span>,正确率<span class='${i.primary}'>${t}%</span>~</div>`},y=()=>{const n=E.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}道题了,继续做题可以巩固所学知识哦~`,I.emit("unitAudioStop")},C=()=>{window.removeEventListener("popstate",y,!1),f.back()};return $(async()=>{ae(document,"scroll",()=>{const{y:n}=ie();n.value>52?(e.background="#fff",e.color="#323333"):(e.background="transparent",e.color="#fff")}),await A(),c(),window.history.pushState(null,"",document.URL),window.addEventListener("popstate",y,!1)}),H(()=>{I.emit("unitAudioStop")}),()=>{let n;return s("div",{class:i.unitDetail},[s(L,{position:"top"},{default:()=>[s(K,{border:!1,background:e.background,color:e.color},null)]}),s(le,{loop:!1,showIndicators:!1,ref:v,duration:300,touchable:!1,class:i.unitSwipe,style:{paddingBottom:"12px"},lazyRender:!0,height:e.swipeHeight,onChange:t=>{I.emit("unitAudioStop"),e.currentIndex=t,c()}},qe(n=e.questionList.map((t,o)=>s(re,null,{default:()=>[s("div",{class:"swipe-item-question"},[t.questionTypeCode===b.RADIO&&s(B,{value:t.userAnswer,"onUpdate:value":a=>t.userAnswer=a,index:o+1,data:t,type:"radio",showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>s("div",{class:i.questionTitle},[s("div",{class:i.questionNum},[s("p",{class:i.pointName},[t.knowledgePointName]),s("span",null,[e.currentIndex+1]),p("/"),e.total]),s(u,{round:!0,plain:!0,size:"mini",color:t.grasp?"#FF5A56":"#1CACF1",class:i.controlBtn,disabled:t.grasp,onClick:()=>w(t)},{default:()=>[t.grasp?"已掌握此题":"掌握此题"]})])}),t.questionTypeCode===b.CHECKBOX&&s(B,{value:t.userAnswer,"onUpdate:value":a=>t.userAnswer=a,index:o+1,data:t,type:"checkbox",showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>s("div",{class:i.questionTitle},[s("div",{class:i.questionNum},[s("p",{class:i.pointName},[t.knowledgePointName]),s("span",null,[e.currentIndex+1]),p("/"),e.total]),s(u,{round:!0,plain:!0,size:"mini",color:t.grasp?"#FF5A56":"#1CACF1",class:i.controlBtn,disabled:t.grasp,onClick:()=>w(t)},{default:()=>[t.grasp?"已掌握此题":"掌握此题"]})])}),t.questionTypeCode===b.SORT&&s(Y,{value:t.userAnswer,"onUpdate:value":[a=>t.userAnswer=a,()=>{const a=!(t.userAnswer&&t.userAnswer.length>0);c(a)}],data:t,index:o+1,showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>s("div",{class:i.questionTitle},[s("div",{class:i.questionNum},[s("p",{class:i.pointName},[t.knowledgePointName]),s("span",null,[e.currentIndex+1]),p("/"),e.total]),s(u,{round:!0,plain:!0,size:"mini",color:t.grasp?"#FF5A56":"#1CACF1",class:i.controlBtn,disabled:t.grasp,onClick:()=>w(t)},{default:()=>[t.grasp?"已掌握此题":"掌握此题"]})])}),t.questionTypeCode===b.LINK&&s(X,{value:t.userAnswer,"onUpdate:value":a=>t.userAnswer=a,data:t,index:o+1,showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>s("div",{class:i.questionTitle},[s("div",{class:i.questionNum},[s("p",{class:i.pointName},[t.knowledgePointName]),s("span",null,[e.currentIndex+1]),p("/"),e.total]),s(u,{round:!0,plain:!0,size:"mini",color:t.grasp?"#FF5A56":"#1CACF1",class:i.controlBtn,disabled:t.grasp,onClick:()=>w(t)},{default:()=>[t.grasp?"已掌握此题":"掌握此题"]})])}),t.questionTypeCode===b.PLAY&&s(J,{value:t.userAnswer,"onUpdate:value":a=>t.userAnswer=a,data:t,index:o+1,unitId:e.id,showAnalysis:t.showAnalysis,analysis:t.analysis},{title:()=>s("div",{class:i.questionTitle},[s("div",{class:i.questionNum},[s("span",null,[e.currentIndex+1]),p("/"),e.total]),s(u,{round:!0,plain:!0,size:"mini",color:t.grasp?"#FF5A56":"#1CACF1",disabled:t.grasp,class:i.controlBtn,onClick:()=>w(t)},{default:()=>[t.grasp?"已掌握此题":"掌握此题"]})])})])]})))?n:{default:()=>[n]}),s(L,{position:"bottom"},{default:()=>[s("div",{class:["btnGroup btnMore",i.btnSection]},[s(u,{round:!0,block:!0,class:e.currentIndex>0?i.activePrevBtn:i.prevBtn,disabled:!(e.currentIndex>0),onClick:()=>{var t;(t=v.value)==null||t.prev()}},{default:()=>[p("上一题")]}),s(u,{block:!0,round:!0,class:i.nextBtn,onClick:k,loading:e.nextStatus,disabled:e.nextStatus},{default:()=>[e.questionList.length===e.currentIndex+1?"提交":"下一题"]}),s(ue,{src:Z,class:[i.wapList,"van-haptics-feedback"],onClick:()=>e.visiableAnswer=!0},null)])]}),s(ee,{show:e.visiableAnswer,"onUpdate:show":t=>e.visiableAnswer=t,title:"题目列表",safeAreaInsetBottom:!0},{default:()=>[s(te,{value:e.questionList,lookType:"PRACTICE",statusList:[{text:"答对",color:"#1CACF1"},{text:"答错",color:"#FF8486"},{text:"未答",color:"#EAEAEA"}],isFinish:e.isFinish,onSelect:t=>{var o;(o=v.value)==null||o.swipeTo(t,{immediate:!0}),e.visiableAnswer=!1},onLoadMore:()=>{const t=e.questionList[e.questionList.length-1];e.page=e.page+1,A(t.id)}},null)]}),s(m,{show:e.visiableError,"onUpdate:show":t=>e.visiableError=t,style:{width:"90%"},round:!0,closeOnClickOverlay:!1},{default:()=>[s(ne,{onClose:()=>e.visiableError=!1,answerAnalysis:e.answerAnalysis,questionTypeCode:e.questionTypeCode,onConform:()=>{var t;(t=v.value)==null||t.next(),setTimeout(()=>{e.answerAnalysis=""},500)}},null)]}),s(m,{show:e.visiableInfo.show,"onUpdate:show":t=>e.visiableInfo.show=t,closeOnClickOverlay:!1,style:{background:"transparent",width:"100%",maxWidth:"100%",transform:"translateY(-55%)"}},{default:()=>[s(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:R,onClose:N},null)]})])}}});export{Oe as default};
|