1 |
- import{d as F,U,q as P,r as O,x as M,w as Q,e as z,y as D,a8 as H,a as s,S as K,A as p,C as r,V as q,a2 as $,D as C,z as G,_ as V}from"./index-5e5e4ebc.js";import{e as h,Q as b,C as E,D as j,K as W,P as Y,i as X,A as J,a as Z,R as ee}from"./index-9fd9ceff.js";import{M as m}from"./index-9096eaf6.js";import{E as te}from"./index-ebaba9ec.js";import{b as se,u as ne,a as oe}from"./index-572087e5.js";import{S as ae,a as ie}from"./index-d46a4ad2.js";import{I as le}from"./index-fa23aaeb.js";import"./index-8fc8f1a6.js";import"./index-cc5b42dd.js";import"./index-4bcfa431.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",Ie="_nextBtn_15a1l_71",ye="_activePrevBtn_15a1l_72",Ae="_right_15a1l_95",ge="_error_15a1l_98",Ce="_primary_15a1l_101",i={unitDetail:re,unitSwipe:ue,questionTitle:ce,questionNum:pe,pointName:de,questionType:fe,controlBtn:ve,wapList:we,btnSection:he,prevBtn:be,nextBtn:Ie,activePrevBtn:ye,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(),f=P(),v=O(),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:x,resume:Te,pause:B}=se(1e3,{controls:!0}),y=async n=>{try{const{data:t}=await C.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){}};Q(()=>e.currentIndex,()=>{if(e.currentIndex+3>=e.questionList.length&&!e.isFinish){const n=e.questionList[e.questionList.length-1];e.page=e.page+1,y(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&&g())},L=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(t=>t.studentExaminationErrorEditionId===e.visiableInfo.graspItem.studentExaminationErrorEditionId);e.questionList.splice(n,1),e.total-=1,u();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,u();return}}catch(n){}},_=async()=>{var n;try{const t=e.questionList||[];let o={};t.forEach((l,c)=>{c===e.currentIndex&&(o={questionId:l.id,details:l.userAnswer||[]})});const{data:a}=await C.post("/edu-app/studentUnitExamination/submitTrainingAnswer",{hideLoading:!0,data:o});if(t.forEach((l,c)=>{c===e.currentIndex&&(e.answerAnalysis=l.answerAnalysis,e.questionTypeCode=l.questionTypeCode,l.showAnalysis=!0,l.analysis.userResult=a)}),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="确认本次练习的题目都完成了吗?",g();return}a?(n=v.value)==null||n.next():e.visiableError=!0}catch(t){}},T=z(()=>{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 A=0;const u=(n=!0)=>{G(()=>{n&&window.scrollTo(0,0),setTimeout(()=>{var c;const t=(c=document.querySelectorAll(".van-swipe-item")[e.currentIndex])==null?void 0:c.querySelector(".swipe-item-question"),o=t==null?void 0:t.querySelectorAll(".answerTitleImg img");let a=!0;o==null||o.forEach(N=>{N.complete||(a=!1)}),!a&&A<3&&setTimeout(()=>{A+=1,u(n)},300),a&&(A=0);const l=V(t);e.swipeHeight=l.height},100)})},S=()=>{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",I,!1)):e.visiableInfo.operationType==="CONTINUE"?R():e.visiableInfo.operationType==="GRASP"&&L()},k=async()=>{const n=e.visiableInfo.operationType;n==="RESULT"||(n==="BACK"?(e.visiableInfo.show=!1,g()):n==="CONTINUE"?e.visiableInfo.show=!1:n==="GRASP"&&(e.visiableInfo.show=!1,window.history.pushState(null,"",document.URL),window.addEventListener("popstate",I,!1)))},R=()=>{const n=T.value;let t=0;n.count>0&&(t=Math.floor(n.passCount/n.count*100));const o=x.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},B(),x.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>`},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}道题了,继续做题可以巩固所学知识哦~`,h.emit("unitAudioStop")},g=()=>{window.removeEventListener("popstate",I,!1),f.back()};return D(async()=>{ne(document,"scroll",()=>{const{y:n}=oe();n.value>52?(e.background="#fff",e.color="#323333"):(e.background="transparent",e.color="#fff")}),await y(),u(),window.history.pushState(null,"",document.URL),window.addEventListener("popstate",I,!1)}),H(()=>{h.emit("unitAudioStop")}),()=>{let n;return s("div",{class:i.unitDetail},[s(m,{position:"top"},{default:()=>[s(K,{border:!1,background:e.background,color:e.color},null)]}),s(ae,{loop:!1,showIndicators:!1,ref:v,duration:300,touchable:!1,class:i.unitSwipe,style:{paddingBottom:"12px"},lazyRender:!0,height:e.swipeHeight,onChange:t=>{h.emit("unitAudioStop"),e.currentIndex=t,u()}},xe(n=e.questionList.map((t,o)=>s(ie,null,{default:()=>[s("div",{class:"swipe-item-question"},[t.questionTypeCode===b.RADIO&&s(E,{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(r,{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(E,{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(r,{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(j,{value:t.userAnswer,"onUpdate:value":[a=>t.userAnswer=a,()=>{const a=!(t.userAnswer&&t.userAnswer.length>0);u(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(r,{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(W,{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(r,{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(Y,{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(r,{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(m,{position:"bottom"},{default:()=>[s("div",{class:["btnGroup btnMore",i.btnSection]},[s(r,{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(r,{block:!0,round:!0,class:i.nextBtn,onClick:_,loading:e.nextStatus,disabled:e.nextStatus},{default:()=>[e.questionList.length===e.currentIndex+1?"提交":"下一题"]}),s(le,{src:X,class:[i.wapList,"van-haptics-feedback"],onClick:()=>e.visiableAnswer=!0},null)])]}),s(J,{show:e.visiableAnswer,"onUpdate:show":t=>e.visiableAnswer=t,title:"题目列表",safeAreaInsetBottom:!0},{default:()=>[s(Z,{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,y(t.id)}},null)]}),s(q,{show:e.visiableError,"onUpdate:show":t=>e.visiableError=t,style:{width:"90%"},round:!0,closeOnClickOverlay:!1},{default:()=>[s(te,{onClose:()=>e.visiableError=!1,answerAnalysis:e.answerAnalysis,questionTypeCode:e.questionTypeCode,onConform:()=>{var t;(t=v.value)==null||t.next(),e.answerAnalysis=""}},null)]}),s(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:()=>[s(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};
|