index.6a04e46b.js 11 KB

1
  1. import{d as L,c as s,q as i,B as _,ah as Q,ag as H,R,r as K,y as N,$ as G,g as z,b7 as V,aj as $,P as q,al as Y,m as h,_ as X,an as J}from"./index.5f7ffb46.js";import{a as W,e as f,Q as y,C as I,D as Z,K as ee,P as te,i as se,A as ne}from"./index.a5f6d9ed.js";import{O as F}from"./index.7790de2a.js";import{O as g}from"./index.95a99ca5.js";import{I as D}from"./index.276a5d68.js";import{R as ue}from"./index.ff20df31.js";import{u as ae}from"./index.da1fa078.js";import{C as oe}from"./index.abd668f7.js";import{S as ie,a as le}from"./index.99e0cf1f.js";import{A as re}from"./index.78e196a2.js";import{G as ce,a as E}from"./index.adf0b8fc.js";import"./index.ab2541bb.js";const de="_unitDetail_asj8n_1",pe="_unitSection_asj8n_4",we="_unitTitle_asj8n_11",fe="_unitCount_asj8n_19",ye="_countSection_asj8n_26",me="_nums_asj8n_34",Ce="_wapList_asj8n_44",ve="_practiceResult_asj8n_50",Ae="_practiceTitle_asj8n_50",he="_practiceRate_asj8n_56",ge="_title_asj8n_72",Ee="_name_asj8n_78",_e="_practiceTips_asj8n_84";var o={unitDetail:de,unitSection:pe,unitTitle:we,unitCount:fe,countSection:ye,nums:me,wapList:Ce,practiceResult:ve,practiceTitle:Ae,practiceRate:he,title:ge,name:Ee,practiceTips:_e};const Te="_popupResult_1naxw_1",xe="_resultTitle_1naxw_6",Se="_titleImg_1naxw_15",be="_result_1naxw_6",Be="_yes_1naxw_29",Re="_no_1naxw_33",qe="_resultContent_1naxw_36";var m={popupResult:Te,resultTitle:xe,titleImg:Se,result:be,yes:Be,no:Re,resultContent:qe},Ie=L({name:"result-mode",props:{confirmButtonText:{type:String,default:"\u6211\u77E5\u9053\u4E86"},answerAnalysis:{type:String,default:""},questionTypeCode:{type:String,default:""}},emits:["close","conform"],setup(r,{emit:c}){return()=>s("div",{class:m.popupResult},[s("div",{class:m.resultTitle},[s(D,{src:W,class:m.titleImg},null),r.questionTypeCode==="PLAY"?"\u4E0D\u5408\u683C\uFF01":"\u56DE\u7B54\u9519\u8BEF\uFF01"]),s("div",{class:m.resultContent},[s("span",null,[i("\u7B54\u6848\u89E3\u6790\uFF1A")]),r.answerAnalysis]),s(_,{type:"primary",round:!0,class:m.btn,block:!0,onClick:()=>{c("conform"),c("close")}},{default:()=>[r.confirmButtonText]})])}});function Fe(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!Y(r)}var Ge=L({name:"unit-detail",setup(){const r=Q(),c=H();R();const d=R(),t=K({examId:r.query.examId,name:r.query.name,courseTypeCode:r.query.courseTypeCode,visiableError:!1,visiableAnswer:!1,visiableResult:!1,id:r.query.id,currentIndex:0,questionList:[],visiableSure:!1,resultInfo:{},resultStatusType:"SUCCESS",visiableExam:!1,nextStatus:!1,swipeHeight:"auto",answerAnalysis:"",questionTypeCode:"",overResult:{time:"00:00",questionLength:0,errorLength:0,rate:0},knowledgelist:[],quitStatus:!1,dialogMessage:"",dialogStatus:!1}),{counter:T,resume:k,pause:x}=ae(1e3,{controls:!0}),S=async()=>{try{const{data:u}=await h.post("/api-student/examinationQuestion/randomPage",{data:{page:1,row:50,categoryId:t.id}}),e=u||[];e.forEach(n=>{n.showAnalysis=!1,n.analysis={message:n.answerAnalysis,topic:!0,userResult:!1},n.userAnswer=[]}),t.questionList=e}catch{}},j=async()=>{try{const{data:u}=await h.post("/api-student/unitExamination/queryKnowledgePoint",{requestType:"form",data:{unitExaminationId:t.examId}});t.knowledgelist=u.lists||[]}catch{}},U=async()=>{var u;try{const e=t.questionList||[];let n={};e.forEach((l,p)=>{p===t.currentIndex&&(n={questionId:l.id,details:l.userAnswer||[]})});const{data:a}=await h.post("/api-student/studentUnitExamination/submitTrainingAnswer",{hideLoading:!0,data:n});if(e.forEach((l,p)=>{p===t.currentIndex&&(t.answerAnalysis=l.answerAnalysis,t.questionTypeCode=l.questionTypeCode,l.showAnalysis=!0,l.analysis.userResult=a)}),t.questionList.length===t.currentIndex+1){f.emit("unitAudioStop"),t.visiableSure=!0;return}a?(u=d.value)==null||u.next():t.visiableError=!0}catch{}},C=N(()=>{const u=t.questionList||[];let e=0,n=0,a=0;return u.forEach(l=>{l.showAnalysis&&(e+=1,l.analysis.userResult?n+=1:a+=1)}),{count:e,passCount:n,noPassCount:a}});let v=0;const w=(u=!0)=>{X(()=>{u&&window.scrollTo(0,0),setTimeout(()=>{var p;const e=(p=document.querySelectorAll(".van-swipe-item")[t.currentIndex])==null?void 0:p.querySelector(".swipe-item-question");console.log("\u{1F680} ~ setTimeout ~ currentItemDom",e);const n=e.querySelectorAll(".answerTitleImg img");let a=!0;n.forEach(B=>{console.log(B.complete),B.complete||(a=!1)}),!a&&v<3&&setTimeout(()=>{v+=1,w(u)},300),a&&(v=0);const l=J(e);t.swipeHeight=l.height},100)})},O=()=>{const u=C.value;let e=0;u.count>0&&(e=Math.floor(u.passCount/u.count*100));const n=T.value,a=Math.floor(n/60)>=10?Math.floor(n/60):"0"+Math.floor(n/60),l=n%60>=10?n%60:"0"+n%60;t.overResult={time:a+":"+l,questionLength:u.count,errorLength:u.noPassCount,rate:e},x(),T.value=0,t.visiableResult=!0},b=async()=>{t.questionList=[],await S(),setTimeout(async()=>{var u;(u=d.value)==null||u.swipeTo(0,{immediate:!0}),t.swipeHeight="auto",t.answerAnalysis="",t.overResult={time:"00:00",questionLength:0,errorLength:0,rate:0},t.visiableResult=!1,k(),w()},100)},P=()=>{const u=t.knowledgelist||[],e=u.findIndex(a=>a.id===t.id);console.log("\u{1F680} ~ file: index.tsx:249 ~ onConfirmResult ~ knownleIndex",e);let n={};e+1>=u.length||e<0?n=u[0]:n=u[e+1],t.id=n.id,t.visiableResult=!1,t.currentIndex=0,b()},A=()=>{t.quitStatus=!0,f.emit("unitAudioStop")},M=()=>{window.removeEventListener("popstate",A,!1),c.back()};return G(async()=>{if(await S(),await j(),w(),!z.user.data.vipMember){x(),t.dialogStatus=!0,t.dialogMessage="\u60A8\u6682\u672A\u5F00\u901A\u56E2\u7EC3\u5B9D\uFF0C\u8BF7\u5F00\u901A\u540E\u4F7F\u7528";return}window.history.pushState(null,"",document.URL),window.addEventListener("popstate",A,!1)}),V(()=>{f.emit("unitAudioStop")}),()=>{let u;return s("div",{class:o.unitDetail},[s(F,{position:"top"},{default:()=>[s($,null,{right:()=>s("span",{style:"color: var(--van-primary-color)",onClick:()=>{f.emit("unitAudioStop"),t.visiableSure=!0}},[i("\u7ED3\u675F\u7EC3\u4E60")])})]}),s(oe,{center:!0,class:o.unitSection,border:!1},{title:()=>s("div",{class:[o.unitTitle]},[t.name]),value:()=>s("div",{class:o.unitCount},[s("div",{class:o.countSection},[s("span",{class:o.nums},[C.value.passCount]),s("span",null,[i("\u7B54\u5BF9")])]),s("div",{class:o.countSection},[s("span",{class:o.nums,style:{color:"#F44541"}},[C.value.noPassCount]),s("span",null,[i("\u7B54\u9519")])])])}),s(ie,{loop:!1,showIndicators:!1,ref:d,duration:300,touchable:!1,style:{paddingBottom:"12px"},lazyRender:!0,height:t.swipeHeight,onChange:e=>{f.emit("unitAudioStop"),t.currentIndex=e,w()}},Fe(u=t.questionList.map((e,n)=>s(le,null,{default:()=>[s("div",{class:"swipe-item-question"},[e.questionTypeCode===y.RADIO&&s(I,{value:e.userAnswer,"onUpdate:value":a=>e.userAnswer=a,index:n+1,data:e,type:"radio",showAnalysis:e.showAnalysis,analysis:e.analysis},null),e.questionTypeCode===y.CHECKBOX&&s(I,{value:e.userAnswer,"onUpdate:value":a=>e.userAnswer=a,index:n+1,data:e,type:"checkbox",showAnalysis:e.showAnalysis,analysis:e.analysis},null),e.questionTypeCode===y.SORT&&s(Z,{value:e.userAnswer,"onUpdate:value":[a=>e.userAnswer=a,()=>{const a=!(e.userAnswer&&e.userAnswer.length>0);w(a)}],data:e,index:n+1,showAnalysis:e.showAnalysis,analysis:e.analysis},null),e.questionTypeCode===y.LINK&&s(ee,{value:e.userAnswer,"onUpdate:value":a=>e.userAnswer=a,data:e,index:n+1,showAnalysis:e.showAnalysis,analysis:e.analysis},null),e.questionTypeCode===y.PLAY&&s(te,{value:e.userAnswer,"onUpdate:value":a=>e.userAnswer=a,data:e,index:n+1,unitId:t.id,showAnalysis:e.showAnalysis,analysis:e.analysis},null)])]})))?u:{default:()=>[u]}),s(F,{position:"bottom",background:"white"},{default:()=>[s("div",{class:["btnGroup btnMore"]},[t.currentIndex>0&&s(_,{round:!0,block:!0,type:"primary",plain:!0,onClick:()=>{var e;(e=d.value)==null||e.prev()}},{default:()=>[i("\u4E0A\u4E00\u9898")]}),s(_,{block:!0,round:!0,type:"primary",onClick:U,loading:t.nextStatus,disabled:t.nextStatus},{default:()=>[i("\u63D0\u4EA4")]}),s(D,{src:se,class:[o.wapList,"van-haptics-feedback"],onClick:()=>t.visiableAnswer=!0},null)])]}),s(re,{show:t.visiableAnswer,"onUpdate:show":e=>t.visiableAnswer=e,title:"\u9898\u76EE\u5217\u8868",safeAreaInsetBottom:!0},{default:()=>[s(ne,{value:t.questionList,lookType:"PRACTICE",statusList:[{text:"\u7B54\u5BF9",color:"#71B0FF"},{text:"\u7B54\u9519",color:"#FF8486"}],onSelect:e=>{var n;(n=d.value)==null||n.swipeTo(e,{immediate:!0}),t.visiableAnswer=!1}},null)]}),s(q,{show:t.visiableError,"onUpdate:show":e=>t.visiableError=e,style:{width:"90%"},round:!0,closeOnClickOverlay:!1},{default:()=>[s(Ie,{onClose:()=>t.visiableError=!1,answerAnalysis:t.answerAnalysis,questionTypeCode:t.questionTypeCode,onConform:()=>{var e;(e=d.value)==null||e.next(),t.answerAnalysis=""}},null)]}),s(q,{show:t.visiableResult,"onUpdate:show":e=>t.visiableResult=e,closeOnClickOverlay:!1,style:{background:"transparent",width:"96%"}},{default:()=>[s(ue,{status:"PRACTICE",confirmButtonText:"\u4E0B\u4E00\u4E2A\u8003\u70B9",cancelButtonText:"\u7EE7\u7EED\u7EC3\u4E60\u672C\u8003\u70B9",onClose:b,onConform:P},{content:()=>s("div",{class:o.practiceResult},[s("div",{class:o.practiceTitle},[i("\u672C\u6B21\u7EC3\u4E60\u6B63\u786E\u7387")]),s("div",{class:o.practiceRate},[t.overResult.rate,i("%")]),s(ce,{border:!1,columnNum:3},{default:()=>[s(E,null,{default:()=>[s("p",{class:o.title},[t.overResult.time]),s("p",{class:o.name},[i("\u7EC3\u4E60\u65F6\u957F")])]}),s(E,null,{default:()=>[s("p",{class:[o.title]},[t.overResult.questionLength|0]),s("p",{class:o.name},[i("\u7B54\u9898\u6570")])]}),s(E,null,{default:()=>[s("p",{class:o.title},[t.overResult.errorLength|0]),s("p",{class:o.name},[i("\u9519\u9898\u6570")])]})]}),t.overResult.rate>=100?s("div",{class:o.practiceTips},[i("\u4F60\u771F\u68D2\uFF01"),s("br",null,null),i("\u672C\u77E5\u8BC6\u70B9\u4F60\u5DF2\u7ECF\u5B8C\u5168\u638C\u63E1\u5566\uFF01")]):s("div",{class:o.practiceTips},[i("\u7EE7\u7EED\u52AA\u529B\uFF01"),s("br",null,null),i("\u4E89\u53D6\u5728\u6D4B\u9A8C\u4E2D\u83B7\u5F97\u9AD8\u5206\uFF01")])])})]}),s(g,{show:t.visiableSure,"onUpdate:show":e=>t.visiableSure=e,title:"\u7EC3\u4E60\u5B8C\u6210",message:"\u786E\u8BA4\u672C\u6B21\u7EC3\u4E60\u7684\u9898\u76EE\u90FD\u5B8C\u6210\u4E86\u5417\uFF1F",messageAlign:"left",showCancelButton:!0,cancelButtonText:"\u518D\u7B49\u7B49",confirmButtonText:"\u786E\u8BA4\u5B8C\u6210",onConfirm:O},null),s(g,{show:t.quitStatus,"onUpdate:show":e=>t.quitStatus=e,title:"\u63D0\u793A",message:"\u60A8\u662F\u5426\u9000\u51FA\u672C\u6B21\u7EC3\u4E60\uFF1F",showCancelButton:!0,cancelButtonText:"\u53D6\u6D88",onCancel:()=>{window.history.pushState(null,"",document.URL),window.addEventListener("popstate",A,!1)},confirmButtonText:"\u786E\u8BA4\u9000\u51FA",onConfirm:M},null),s(g,{message:t.dialogMessage,show:t.dialogStatus,"onUpdate:show":e=>t.dialogStatus=e,showCancelButton:!0,cancelButtonText:"\u8FD4\u56DE",onCancel:()=>{c.back()},confirmButtonText:"\u7ACB\u5373\u5F00\u901A",onConfirm:()=>{c.push("/memberCenter")}},null)])}}});export{Ge as default};