1 |
- import{d as F,U,q as P,r as O,x as M,w as z,e as D,y as Q,ah as H,a as t,S as K,A as p,C as r,V as q,a1 as $,D as g,z as G,Z as V}from"./index-43e0e469.js";import{e as w,Q as h,C as E,D as j,K as W,P as Y,i as X,A as Z,a as J,R as ee}from"./index-5590f359.js";import{M as B}from"./index-27845645.js";import{E as se}from"./index-1a61193f.js";import{b as te,u as ne,a as oe}from"./index-1d54f1aa.js";import{S as ae,a as ie}from"./index-54078e5f.js";import{I as le}from"./index-4569e970.js";import"./index-639ff1be.js";import"./index-5e94b9b7.js";import"./index-5d1a1e3e.js";const re="_unitDetail_15a1l_1",ue="_unitSwipe_15a1l_9",ce="_questionTitle_15a1l_12",pe="_questionNum_15a1l_21",de="_pointName_15a1l_28",fe="_questionType_15a1l_38",ve="_controlBtn_15a1l_56",we="_wapList_15a1l_59",he="_btnSection_15a1l_65",be="_prevBtn_15a1l_70",ye="_nextBtn_15a1l_71",Ie="_activePrevBtn_15a1l_72",Ae="_right_15a1l_95",ge="_error_15a1l_98",Ce="_primary_15a1l_101",a={unitDetail:re,unitSwipe:ue,questionTitle:ce,questionNum:pe,pointName:de,questionType:fe,controlBtn:ve,wapList:we,btnSection:he,prevBtn:be,nextBtn:ye,activePrevBtn:Ie,right:Ae,error:ge,primary:Ce};function xe(d){return typeof d=="function"||Object.prototype.toString.call(d)==="[object Object]"&&!$(d)}const Fe=F({name:"unit-detail",setup(){const d=U(),b=P(),u=O(),e=M({background:"transparent",color:"#fff",visiableError:!1,visiableAnswer:!1,id:d.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:C,resume:Te,pause:m}=te(1e3,{controls:!0}),x=async()=>{try{const{data:n}=await g.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,x())});const f=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)},_=async()=>{var n;try{if(e.visiableInfo.show=!1,await g.get("/edu-app/studentExaminationErrorEdition/del",{hideLoading:!1,params:{studentExaminationErrorEditionId:e.visiableInfo.graspItem.studentExaminationErrorEditionId}}),e.visiableInfo.graspItem.grasp=!0,w.emit("unitAudioStop"),e.questionList.length===1){A(),b.back();return}if(e.questionList.length>e.currentIndex+1){const s=e.questionList.findIndex(o=>o.studentExaminationErrorEditionId===e.visiableInfo.graspItem.studentExaminationErrorEditionId);e.questionList.splice(s,1),e.total-=1,v();return}if(e.questionList.length===e.currentIndex+1){(n=u.value)==null||n.prev();return}}catch(s){}},L=async()=>{var n;try{const s=e.questionList||[];let o={};s.forEach((l,c)=>{c===e.currentIndex&&(o={questionId:l.id,details:l.userAnswer||[]})});const{data:i}=await g.post("/edu-app/studentUnitExamination/submitTrainingAnswer",{hideLoading:!0,data:o});if(s.forEach((l,c)=>{c===e.currentIndex&&(e.answerAnalysis=l.answerAnalysis,e.questionTypeCode=l.questionTypeCode,l.showAnalysis=!0,l.analysis.userResult=i)}),e.questionList.length===e.currentIndex+1){w.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="确认本次练习的题目都完成了吗?",A();return}i?(n=u.value)==null||n.next():e.visiableError=!0}catch(s){}},T=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 y=0;const v=(n=!0)=>{G(()=>{n&&window.scrollTo(0,0),setTimeout(()=>{var c;const s=(c=document.querySelectorAll(".van-swipe-item")[e.currentIndex])==null?void 0:c.querySelector(".swipe-item-question"),o=s==null?void 0:s.querySelectorAll(".answerTitleImg img");let i=!0;o==null||o.forEach(R=>{R.complete||(i=!1)}),!i&&y<3&&setTimeout(()=>{y+=1,v(n)},300),i&&(y=0);const l=V(s);e.swipeHeight=l.height},100)})},S=()=>{e.visiableInfo.operationType==="RESULT"?(e.visiableInfo.show=!1,b.back(),b.back()):e.visiableInfo.operationType==="BACK"?(e.visiableInfo.show=!1,window.history.pushState(null,"",document.URL),window.addEventListener("popstate",I,!1)):e.visiableInfo.operationType==="CONTINUE"?N():e.visiableInfo.operationType==="GRASP"&&_()},k=async()=>{const n=e.visiableInfo.operationType;n==="RESULT"||(n==="BACK"?(e.visiableInfo.show=!1,A()):(n==="CONTINUE"||n==="GRASP")&&(e.visiableInfo.show=!1))},N=()=>{const n=T.value;let s=0;n.count>0&&(s=Math.floor(n.passCount/n.count*100));const o=C.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},m(),C.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>,正确率<span class='${a.primary}'>${s}%</span>~</div>`},I=()=>{const n=T.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}道题了,继续做题可以巩固所学知识哦~`,w.emit("unitAudioStop")},A=()=>{window.removeEventListener("popstate",I,!1),b.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 x(),v(),window.history.pushState(null,"",document.URL),window.addEventListener("popstate",I,!1)}),H(()=>{w.emit("unitAudioStop")}),()=>{let n;return t("div",{class:a.unitDetail},[t(B,{position:"top"},{default:()=>[t(K,{border:!1,background:e.background,color:e.color},null)]}),t(ae,{loop:!1,showIndicators:!1,ref:u,duration:300,touchable:!1,class:a.unitSwipe,style:{paddingBottom:"12px"},lazyRender:!0,height:e.swipeHeight,onChange:s=>{w.emit("unitAudioStop"),e.currentIndex=s,v()}},xe(n=e.questionList.map((s,o)=>t(ie,null,{default:()=>[t("div",{class:"swipe-item-question"},[s.questionTypeCode===h.RADIO&&t(E,{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("p",{class:a.pointName},[s.knowledgePointName]),t("span",null,[e.currentIndex+1]),p("/"),e.total]),t(r,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",class:a.controlBtn,disabled:s.grasp,onClick:()=>f(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])}),s.questionTypeCode===h.CHECKBOX&&t(E,{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("p",{class:a.pointName},[s.knowledgePointName]),t("span",null,[e.currentIndex+1]),p("/"),e.total]),t(r,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",class:a.controlBtn,disabled:s.grasp,onClick:()=>f(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])}),s.questionTypeCode===h.SORT&&t(j,{value:s.userAnswer,"onUpdate:value":[i=>s.userAnswer=i,()=>{const i=!(s.userAnswer&&s.userAnswer.length>0);v(i)}],data:s,index:o+1,showAnalysis:s.showAnalysis,analysis:s.analysis},{title:()=>t("div",{class:a.questionTitle},[t("div",{class:a.questionNum},[t("p",{class:a.pointName},[s.knowledgePointName]),t("span",null,[e.currentIndex+1]),p("/"),e.total]),t(r,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",class:a.controlBtn,disabled:s.grasp,onClick:()=>f(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])}),s.questionTypeCode===h.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("p",{class:a.pointName},[s.knowledgePointName]),t("span",null,[e.currentIndex+1]),p("/"),e.total]),t(r,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",class:a.controlBtn,disabled:s.grasp,onClick:()=>f(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])}),s.questionTypeCode===h.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]),p("/"),e.total]),t(r,{round:!0,plain:!0,size:"mini",color:s.grasp?"#FF5A56":"#1CACF1",disabled:s.grasp,class:a.controlBtn,onClick:()=>f(s)},{default:()=>[s.grasp?"已掌握此题":"掌握此题"]})])})])]})))?n:{default:()=>[n]}),t(B,{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=u.value)==null||s.prev()}},{default:()=>[p("上一题")]}),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=u.value)==null||o.swipeTo(s,{immediate:!0}),e.visiableAnswer=!1}},null)]}),t(q,{show:e.visiableError,"onUpdate:show":s=>e.visiableError=s,style:{width:"90%"},round:!0,closeOnClickOverlay:!1},{default:()=>[t(se,{onClose:()=>e.visiableError=!1,answerAnalysis:e.answerAnalysis,questionTypeCode:e.questionTypeCode,onConform:()=>{var s;(s=u.value)==null||s.next(),e.answerAnalysis=""}},null)]}),t(q,{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(ee,{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:S,onClose:k},null)]})])}}});export{Fe as default};
|