1 |
- import{d as U,P,q as D,r as O,x as Q,w as M,e as z,y as $,Q as H,a as t,V as K,A as p,C as u,R as E,S as G,a3 as V,D as C,N as j,z as W,$ as Y}from"./index-869d77fb.js";import{e as h,Q as I,C as _,D as X,K as J,P as Z,i as ee,A as se,a as te,R as ne}from"./index-8029f624.js";import{M as B}from"./index-3eb77ad0.js";import{E as oe}from"./index-54a8f5e0.js";import{b as ae,u as ie,a as le}from"./index-155c29c2.js";import{S as re,a as ue}from"./index-d45dfe1a.js";import{I as ce}from"./index-e76f2a88.js";import"./index-3fd44b77.js";import"./index-70d6770d.js";import"./howler-ae3abd7b.js";import"./index-1c6c2ec0.js";const pe="_unitDetail_s94f4_1",de="_unitSwipe_s94f4_9",fe="_questionTitle_s94f4_12",we="_questionNum_s94f4_21",ve="_pointName_s94f4_28",be="_questionType_s94f4_38",he="_controlBtn_s94f4_56",Ie="_wapList_s94f4_59",ye="_btnSection_s94f4_65",Ae="_prevBtn_s94f4_70",ge="_nextBtn_s94f4_71",Te="_activePrevBtn_s94f4_72",xe="_right_s94f4_95",Ce="_error_s94f4_98",qe="_primary_s94f4_101",me="_unitDetailTablet_s94f4_104",i={unitDetail:pe,unitSwipe:de,questionTitle:fe,questionNum:we,pointName:ve,questionType:be,controlBtn:he,wapList:Ie,btnSection:ye,prevBtn:Ae,nextBtn:ge,activePrevBtn:Te,right:xe,error:Ce,primary:qe,unitDetailTablet:me};function Ee(d){return typeof d=="function"||Object.prototype.toString.call(d)==="[object Object]"&&!V(d)}const Qe=U({name:"unit-detail",setup(){const d=P(),f=D(),w=O(),e=Q({background:"transparent",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:_e,pause:L}=ae(1e3,{controls:!0}),A=async n=>{try{const{data:s}=await C.post("/edu-app/studentUnitExamination/errorEdition",{data:{page:e.page,rows:e.rows,maxStudentExaminationErrorEditionId:n}}),o=s||{};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(s){}};M(()=>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 v=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&&T())},S=async()=>{try{if(e.visiableInfo.show=!1,await C.get("/edu-app/studentExaminationErrorEdition/del",{hideLoading:!1,params:{questionId:e.visiableInfo.graspItem.id}}),e.visiableInfo.graspItem.grasp=!0,h.emit("unitAudioStop"),e.total<=1){f.back(),f.back();return}if(e.total>e.currentIndex+1){const n=e.questionList.findIndex(s=>s.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(s=>s.studentExaminationErrorEditionId===e.visiableInfo.graspItem.studentExaminationErrorEditionId);e.questionList.splice(n,1),e.total-=1,e.currentIndex-=1,c();return}}catch(n){}},k=async()=>{var n,s;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:b}=await C.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=b)}),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="确认本次练习的题目都完成了吗?",T();return}b?(s=w.value)==null||s.next():e.visiableError=!0}catch(o){}},m=z(()=>{const n=e.questionList||[];let s=0,o=0,a=0;return n.forEach(l=>{l.showAnalysis&&(s+=1,l.analysis.userResult?o+=1:a+=1)}),{count:s,passCount:o,noPassCount:a}});let g=0;const c=(n=!0)=>{W(()=>{n&&window.scrollTo(0,0),setTimeout(()=>{var b;const s=(b=document.querySelectorAll(".van-swipe-item")[e.currentIndex])==null?void 0:b.querySelector(".swipe-item-question"),o=s==null?void 0:s.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=Y(s);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,T()):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=m.value;let s=0;n.count>0&&(s=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:s},L(),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}'>${s}%</span>~</div>`},y=()=>{const n=m.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}道题了,继续做题可以巩固所学知识哦~`,h.emit("unitAudioStop")},T=()=>{window.removeEventListener("popstate",y,!1),f.back()};return $(async()=>{ie(document,"scroll",()=>{const{y:n}=le();n.value>52?e.background="#fff":e.background="transparent"}),await A(),c(),window.history.pushState(null,"",document.URL),window.addEventListener("popstate",y,!1)}),H(()=>{h.emit("unitAudioStop")}),()=>{let n;return t("div",{class:[i.unitDetail,G().isTablet?i.unitDetailTablet:""]},[t(B,{position:"top"},{default:()=>[t(K,{border:!1,background:e.background},null)]}),t(re,{loop:!1,showIndicators:!1,ref:w,duration:300,touchable:!1,class:i.unitSwipe,style:{paddingBottom:"12px"},lazyRender:!0,height:e.swipeHeight,onChange:s=>{h.emit("unitAudioStop"),e.currentIndex=s,c()}},Ee(n=e.questionList.map((s,o)=>t(ue,null,{default:()=>[t("div",{class:"swipe-item-question"},[s.questionTypeCode===I.RADIO&&t(_,{value:s.userAnswer,"onUpdate:value":a=>s.userAnswer=a,index:o+1,data:s,type:"radio",showAnalysis:s.showAnalysis,analysis:s.analysis},{title:()=>t("div",{class:i.questionTitle},[t("div",{class:i.questionNum},[t("p",{class:i.pointName},[s.knowledgePointName]),t("span",null,[e.currentIndex+1]),p("/"),e.total]),t(u,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",class:i.controlBtn,disabled:s.grasp,onClick:()=>v(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])}),s.questionTypeCode===I.CHECKBOX&&t(_,{value:s.userAnswer,"onUpdate:value":a=>s.userAnswer=a,index:o+1,data:s,type:"checkbox",showAnalysis:s.showAnalysis,analysis:s.analysis},{title:()=>t("div",{class:i.questionTitle},[t("div",{class:i.questionNum},[t("p",{class:i.pointName},[s.knowledgePointName]),t("span",null,[e.currentIndex+1]),p("/"),e.total]),t(u,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",class:i.controlBtn,disabled:s.grasp,onClick:()=>v(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])}),s.questionTypeCode===I.SORT&&t(X,{value:s.userAnswer,"onUpdate:value":[a=>s.userAnswer=a,()=>{const a=!(s.userAnswer&&s.userAnswer.length>0);c(a)}],data:s,index:o+1,showAnalysis:s.showAnalysis,analysis:s.analysis},{title:()=>t("div",{class:i.questionTitle},[t("div",{class:i.questionNum},[t("p",{class:i.pointName},[s.knowledgePointName]),t("span",null,[e.currentIndex+1]),p("/"),e.total]),t(u,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",class:i.controlBtn,disabled:s.grasp,onClick:()=>v(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])}),s.questionTypeCode===I.LINK&&t(J,{value:s.userAnswer,"onUpdate:value":a=>s.userAnswer=a,data:s,index:o+1,showAnalysis:s.showAnalysis,analysis:s.analysis},{title:()=>t("div",{class:i.questionTitle},[t("div",{class:i.questionNum},[t("p",{class:i.pointName},[s.knowledgePointName]),t("span",null,[e.currentIndex+1]),p("/"),e.total]),t(u,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",class:i.controlBtn,disabled:s.grasp,onClick:()=>v(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])}),s.questionTypeCode===I.PLAY&&t(Z,{value:s.userAnswer,"onUpdate:value":a=>s.userAnswer=a,data:s,index:o+1,unitId:e.id,showAnalysis:s.showAnalysis,analysis:s.analysis},{title:()=>t("div",{class:i.questionTitle},[t("div",{class:i.questionNum},[t("span",null,[e.currentIndex+1]),p("/"),e.total]),t(u,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",disabled:s.grasp,class:i.controlBtn,onClick:()=>v(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])})])]})))?n:{default:()=>[n]}),t(B,{position:"bottom"},{default:()=>[t("div",{class:["btnGroup btnMore",i.btnSection]},[t(u,{round:!0,block:!0,class:e.currentIndex>0?i.activePrevBtn:i.prevBtn,disabled:!(e.currentIndex>0),onClick:()=>{var s;(s=w.value)==null||s.prev()}},{default:()=>[p("上一题")]}),t(u,{block:!0,round:!0,class:i.nextBtn,onClick:k,loading:e.nextStatus,disabled:e.nextStatus},{default:()=>[e.questionList.length===e.currentIndex+1?"提交":"下一题"]}),t(ce,{src:ee,class:[i.wapList,"van-haptics-feedback"],onClick:()=>e.visiableAnswer=!0},null)])]}),t(se,{show:e.visiableAnswer,"onUpdate:show":s=>e.visiableAnswer=s,title:"题目列表",safeAreaInsetBottom:!0},{default:()=>[t(te,{value:e.questionList,lookType:"PRACTICE",statusList:[{text:"答对",color:"#1CACF1"},{text:"答错",color:"#FF8486"},{text:"未答",color:"#EAEAEA"}],isFinish:e.isFinish,onSelect:s=>{var o;(o=w.value)==null||o.swipeTo(s,{immediate:!0}),e.visiableAnswer=!1},onLoadMore:()=>{const s=e.questionList[e.questionList.length-1];e.page=e.page+1,A(s.id)}},null)]}),t(E,{show:e.visiableError,"onUpdate:show":s=>e.visiableError=s,style:{width:"90%",maxWidth:"520px"},round:!0,closeOnClickOverlay:!1},{default:()=>[t(oe,{onClose:()=>e.visiableError=!1,answerAnalysis:e.answerAnalysis,questionTypeCode:e.questionTypeCode,onConform:()=>{var s;(s=w.value)==null||s.next(),setTimeout(()=>{e.answerAnalysis=""},500)}},null)]}),t(E,{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(ne,{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{Qe as default};
|