index.e8d1e5f4.js 11 KB

1
  1. import{d as k,c as s,q as i,B as T,ah as Q,ag as H,R as q,r as K,y as N,$ as G,g as z,b3 as V,aj as $,P as I,al as Y,m as g,_ as X,an as J}from"./index.1c621181.js";import{a as W,e as f,Q as y,C as L,D as Z,K as ee,P as te,i as se,A as ne}from"./index.ab76619c.js";import{O as B}from"./index.b491c24a.js";import{O as A}from"./index.120b6f0d.js";import{I as F}from"./index.4c221cbe.js";import{R as ae}from"./index.54419ac2.js";import{u as oe}from"./index.2424eeb6.js";import{C as ue}from"./index.fd5ae97b.js";import{S as ie,a as le}from"./index.78a302c3.js";import{A as re}from"./index.7c36c16c.js";import{G as ce,a as _}from"./index.5a8ac45d.js";import"./index.4e64eb97.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",ve="_wapList_asj8n_44",he="_practiceResult_asj8n_50",Ce="_practiceTitle_asj8n_50",ge="_practiceRate_asj8n_56",Ae="_title_asj8n_72",_e="_name_asj8n_78",Te="_practiceTips_asj8n_84";var u={unitDetail:de,unitSection:pe,unitTitle:we,unitCount:fe,countSection:ye,nums:me,wapList:ve,practiceResult:he,practiceTitle:Ce,practiceRate:ge,title:Ae,name:_e,practiceTips:Te};const xe="_popupResult_1naxw_1",Se="_resultTitle_1naxw_6",be="_titleImg_1naxw_15",Re="_result_1naxw_6",Ee="_yes_1naxw_29",qe="_no_1naxw_33",Ie="_resultContent_1naxw_36";var m={popupResult:xe,resultTitle:Se,titleImg:be,result:Re,yes:Ee,no:qe,resultContent:Ie},Le=k({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(F,{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(T,{type:"primary",round:!0,class:m.btn,block:!0,onClick:()=>{c("conform"),c("close")}},{default:()=>[r.confirmButtonText]})])}});function Be(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!Y(r)}var Ge=k({name:"unit-detail",setup(){const r=Q(),c=H();q();const d=q(),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:x,resume:D,pause:S}=oe(1e3,{controls:!0}),b=async()=>{try{const{data:a}=await g.post("/api-student/examinationQuestion/randomPage",{data:{page:1,row:50,categoryId:t.id}}),e=a||[];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:a}=await g.post("/api-student/unitExamination/queryKnowledgePoint",{requestType:"form",data:{unitExaminationId:t.examId}});t.knowledgelist=a.lists||[]}catch{}},U=async()=>{var a;try{const e=t.questionList||[];let n={};e.forEach((l,p)=>{p===t.currentIndex&&(n={questionId:l.id,details:l.userAnswer||[]})});const{data:o}=await g.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=o)}),t.questionList.length===t.currentIndex+1){f.emit("unitAudioStop"),t.visiableSure=!0;return}o?(a=d.value)==null||a.next():t.visiableError=!0}catch{}},v=N(()=>{const a=t.questionList||[];let e=0,n=0,o=0;return a.forEach(l=>{l.showAnalysis&&(e+=1,l.analysis.userResult?n+=1:o+=1)}),{count:e,passCount:n,noPassCount:o}});let h=0;const w=(a=!0)=>{X(()=>{a&&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 o=!0;n.forEach(E=>{console.log(E.complete),E.complete||(o=!1)}),!o&&h<3&&setTimeout(()=>{h+=1,w(a)},300),o&&(h=0);const l=J(e);t.swipeHeight=l.height},100)})},O=()=>{const a=v.value;let e=0;a.count>0&&(e=Math.floor(a.passCount/a.count*100));const n=x.value,o=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:o+":"+l,questionLength:a.count,errorLength:a.noPassCount,rate:e},S(),x.value=0,t.visiableResult=!0},R=async()=>{t.questionList=[],await b(),setTimeout(async()=>{var a;(a=d.value)==null||a.swipeTo(0,{immediate:!0}),t.swipeHeight="auto",t.answerAnalysis="",t.overResult={time:"00:00",questionLength:0,errorLength:0,rate:0},t.visiableResult=!1,D(),w()},100)},P=()=>{const a=t.knowledgelist||[],e=a.findIndex(o=>o.id===t.id);console.log("\u{1F680} ~ file: index.tsx:249 ~ onConfirmResult ~ knownleIndex",e);let n={};e+1>=a.length||e<0?n=a[0]:n=a[e+1],t.id=n.id,t.visiableResult=!1,t.currentIndex=0,R()},C=()=>{t.quitStatus=!0,f.emit("unitAudioStop")},M=()=>{window.removeEventListener("popstate",C,!1),c.back()};return G(async()=>{if(await b(),await j(),w(),!z.user.data.vipMember){S(),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",C,!1)}),V(()=>{f.emit("unitAudioStop")}),()=>{let a;return s("div",{class:u.unitDetail},[s(B,{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(ue,{center:!0,class:u.unitSection,border:!1},{title:()=>s("div",{class:[u.unitTitle]},[t.name]),value:()=>s("div",{class:u.unitCount},[s("div",{class:u.countSection},[s("span",{class:u.nums},[v.value.passCount]),s("span",null,[i("\u7B54\u5BF9")])]),s("div",{class:u.countSection},[s("span",{class:u.nums,style:{color:"#F44541"}},[v.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()}},Be(a=t.questionList.map((e,n)=>s(le,null,{default:()=>[s("div",{class:"swipe-item-question"},[e.questionTypeCode===y.RADIO&&s(L,{value:e.userAnswer,"onUpdate:value":o=>e.userAnswer=o,index:n+1,data:e,type:"radio",showAnalysis:e.showAnalysis,analysis:e.analysis},null),e.questionTypeCode===y.CHECKBOX&&s(L,{value:e.userAnswer,"onUpdate:value":o=>e.userAnswer=o,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":[o=>e.userAnswer=o,()=>{const o=!(e.userAnswer&&e.userAnswer.length>0);w(o)}],data:e,index:n+1,showAnalysis:e.showAnalysis,analysis:e.analysis},null),e.questionTypeCode===y.LINK&&s(ee,{value:e.userAnswer,"onUpdate:value":o=>e.userAnswer=o,data:e,index:n+1,showAnalysis:e.showAnalysis,analysis:e.analysis},null),e.questionTypeCode===y.PLAY&&s(te,{value:e.userAnswer,"onUpdate:value":o=>e.userAnswer=o,data:e,index:n+1,unitId:t.id,showAnalysis:e.showAnalysis,analysis:e.analysis},null)])]})))?a:{default:()=>[a]}),s(B,{position:"bottom",background:"white"},{default:()=>[s("div",{class:["btnGroup btnMore"]},[t.currentIndex>0&&s(T,{round:!0,block:!0,type:"primary",plain:!0,onClick:()=>{var e;(e=d.value)==null||e.prev()}},{default:()=>[i("\u4E0A\u4E00\u9898")]}),s(T,{block:!0,round:!0,type:"primary",onClick:U,loading:t.nextStatus,disabled:t.nextStatus},{default:()=>[i("\u63D0\u4EA4")]}),s(F,{src:se,class:[u.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(I,{show:t.visiableError,"onUpdate:show":e=>t.visiableError=e,style:{width:"90%"},round:!0,closeOnClickOverlay:!1},{default:()=>[s(Le,{onClose:()=>t.visiableError=!1,answerAnalysis:t.answerAnalysis,questionTypeCode:t.questionTypeCode,onConform:()=>{var e;(e=d.value)==null||e.next(),t.answerAnalysis=""}},null)]}),s(I,{show:t.visiableResult,"onUpdate:show":e=>t.visiableResult=e,closeOnClickOverlay:!1,style:{background:"transparent",width:"96%"}},{default:()=>[s(ae,{status:"PRACTICE",confirmButtonText:"\u4E0B\u4E00\u4E2A\u8003\u70B9",cancelButtonText:"\u7EE7\u7EED\u7EC3\u4E60\u672C\u8003\u70B9",onClose:R,onConform:P},{content:()=>s("div",{class:u.practiceResult},[s("div",{class:u.practiceTitle},[i("\u672C\u6B21\u7EC3\u4E60\u6B63\u786E\u7387")]),s("div",{class:u.practiceRate},[t.overResult.rate,i("%")]),s(ce,{border:!1,columnNum:3},{default:()=>[s(_,null,{default:()=>[s("p",{class:u.title},[t.overResult.time]),s("p",{class:u.name},[i("\u7EC3\u4E60\u65F6\u957F")])]}),s(_,null,{default:()=>[s("p",{class:[u.title]},[t.overResult.questionLength|0]),s("p",{class:u.name},[i("\u7B54\u9898\u6570")])]}),s(_,null,{default:()=>[s("p",{class:u.title},[t.overResult.errorLength|0]),s("p",{class:u.name},[i("\u9519\u9898\u6570")])]})]}),t.overResult.rate>=100?s("div",{class:u.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:u.practiceTips},[i("\u7EE7\u7EED\u52AA\u529B\uFF01"),s("br",null,null),i("\u4E89\u53D6\u5728\u6D4B\u9A8C\u4E2D\u83B7\u5F97\u9AD8\u5206\uFF01")])])})]}),s(A,{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(A,{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",C,!1)},confirmButtonText:"\u786E\u8BA4\u9000\u51FA",onConfirm:M},null),s(A,{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};