index.9a30841f.js 6.0 KB

12
  1. import{d as _,aV as C,ag as L,R as b,r as N,$ as D,f as d,a_ as U,c as a,a5 as O,q as h,B as m,ak as k,m as x,_ as Q,am as B}from"./index.ffe80dbe.js";import{i as F}from"./icon-question-nums.dee74fa0.js";import{e as A,Q as p,C as q,D as H,K,P as V,i as j,A as z}from"./index.13760018.js";import{O as G}from"./index.4ddd16f0.js";import{C as J}from"./index.ea031708.js";import{S as P,a as M}from"./index.b4b77b5a.js";import{I as $}from"./index.7e972106.js";import{A as X}from"./index.84851ef1.js";import"./index.72ca63b9.js";import"./index.55ba7429.js";const Y="_unitDetail_1qg73_1",W="_unitSection_1qg73_4",Z="_unitTitle_1qg73_11",ee="_unitCount_1qg73_16",se="_qNums_1qg73_22",te="_num_1qg73_29",ne="_icon_1qg73_32",ae="_wapList_1qg73_37";var u={unitDetail:Y,unitSection:W,unitTitle:Z,unitCount:ee,qNums:se,num:te,icon:ne,wapList:ae};function oe(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!k(r)}var he=_({name:"unit-detail",setup(){const r=C(),g=L(),w=b(),s=N({id:r.query.id,examDetail:{},visiableAnswer:!1,currentIndex:0,questionList:[],time:0,resultInfo:{},answerResult:[],nextStatus:!1,swipeHeight:"auto"}),S=async()=>{try{const{data:n}=await x.post("/api-student/studentUnitExamination/detail",{requestType:"form",data:{studentUnitExaminationId:s.id}}),{questionJson:e,studentAnswerJson:t,answerResult:o,...l}=n,c=e||[];s.answerResult=o?JSON.parse(o):[],console.log(s.answerResult,c),c.forEach(i=>{i.userAnswer=R(i,t),i.showAnalysis=!0,i.showScore=!0,i.analysis={message:i.answerAnalysis,topic:!0,userResult:I(i.id)}}),s.questionList=c,s.examDetail={...l}}catch{}},v=async()=>{try{const{data:n}=await x.post(d.platformApi+"/classGroupUnitExamination/report",{requestType:"form",data:{classGroupUnitExaminationId:s.id,level:r.query.level}});s.examDetail={unitExaminationName:n.unitExaminationName,questionNum:n.questionNum||0};const e=n.examinationQuestionAdds||[];e.forEach(t=>{const o=t.rightAnswers||[];t.userAnswer=T(o),t.showAnalysis=!0,t.showRate=!0,t.showScore=!1,t.analysis={message:t.answerAnalysis,topic:!1}}),s.questionList=e,console.log(s.questionList,"state.questionList")}catch{}},T=n=>{const e=[];return n.forEach(t=>{if(t.rightAnswerFlag){const o=n.find(l=>l.questionExtra===t.questionExtra);e.push({answer:t.questionAnswer,answerId:t.examinationQuestionAnswerId,answerExtra:o?o.questionExtra:null})}}),e||[]},R=(n,e)=>{if(!e)return[];const t=e||[];return t[n.id]?t[n.id]:[]},I=n=>{let e=!1;return s.answerResult.forEach(t=>{t.questionId===n&&(e=t.rightFlag)}),e};let y=0;const f=(n=!0)=>{Q(()=>{n&&window.scrollTo(0,0),setTimeout(()=>{var c;const e=(c=document.querySelectorAll(".van-swipe-item")[s.currentIndex])==null?void 0:c.querySelector(".swipe-item-question"),t=e.querySelectorAll(".answerTitleImg img");let o=!0;t.forEach(i=>{console.log(i.complete),i.complete||(o=!1)}),!o&&y<3&&setTimeout(()=>{y+=1,f(n)},300),o&&(y=0);const l=B(e);console.log("\u{1F680} ~ setTimeout ~ rect",l,s.currentIndex),s.swipeHeight=l.height},100)})},E=async()=>{var n;try{s.nextStatus=!0,s.questionList.length===s.currentIndex+1&&(A.emit("unitAudioStop"),g.back()),(n=w.value)==null||n.next(),s.nextStatus=!1}catch{s.nextStatus=!1}};return D(async()=>{d.platformType==="TEACHER"||d.platformType==="SCHOOL"?await v():await S(),f()}),U(()=>{A.emit("unitAudioStop")}),()=>{let n;return a("div",{class:u.unitDetail},[a(J,{center:!0,class:u.unitSection,border:!1},{title:()=>a("div",{class:u.unitTitle},[s.examDetail.unitExaminationName]),label:()=>a("div",{class:u.unitCount},[a("div",{class:u.qNums},[a(O,{class:u.icon,name:F},null),h("\u9898\u76EE\u6570\u91CF")," ",a("span",{class:u.num,style:{paddingLeft:"6px"}},[s.currentIndex+1]),h("/"),s.examDetail.questionNum||0])])}),a(P,{loop:!1,showIndicators:!1,ref:w,duration:300,touchable:!1,lazyRender:!0,style:{paddingBottom:"12px"},height:s.swipeHeight,onChange:e=>{A.emit("unitAudioStop"),s.currentIndex=e,f()}},oe(n=s.questionList.map((e,t)=>a(M,null,{default:()=>[a("div",{class:"swipe-item-question"},[e.questionTypeCode===p.RADIO&&a(q,{value:e.userAnswer,"onUpdate:value":o=>e.userAnswer=o,index:t+1,data:e,readOnly:!0,type:"radio",showRate:e.showRate,showAnalysis:e.showAnalysis,analysis:e.analysis},null),e.questionTypeCode===p.CHECKBOX&&a(q,{value:e.userAnswer,"onUpdate:value":o=>e.userAnswer=o,index:t+1,data:e,readOnly:!0,type:"checkbox",showRate:e.showRate,showAnalysis:e.showAnalysis,analysis:e.analysis},null),e.questionTypeCode===p.SORT&&a(H,{readOnly:!0,value:e.userAnswer,"onUpdate:value":o=>e.userAnswer=o,data:e,index:t+1,showRate:e.showRate,showAnalysis:e.showAnalysis,analysis:e.analysis},null),e.questionTypeCode===p.LINK&&a(K,{readOnly:!0,value:e.userAnswer,"onUpdate:value":o=>e.userAnswer=o,data:e,index:t+1,showRate:e.showRate,showAnalysis:e.showAnalysis,analysis:e.analysis},null),e.questionTypeCode===p.PLAY&&a(V,{readOnly:!0,value:e.userAnswer,"onUpdate:value":o=>e.userAnswer=o,data:e,index:t+1,unitId:s.id,showScore:e.showScore,showRate:e.showRate,showAnalysis:e.showAnalysis,analysis:e.analysis},null)])]})))?n:{default:()=>[n]}),a(G,{position:"bottom",background:"white"},{default:()=>[a("div",{class:["btnGroup btnMore"]},[s.currentIndex>0&&a(m,{round:!0,block:!0,type:"primary",plain:!0,onClick:()=>{var e;(e=w.value)==null||e.prev()}},{default:()=>[h("\u4E0A\u4E00\u9898")]}),a(m,{block:!0,round:!0,type:"primary",onClick:E,loading:s.nextStatus,disabled:s.nextStatus},{default:()=>[s.questionList.length===s.currentIndex+1?"\u786E\u5B9A":"\u4E0B\u4E00\u9898"]}),a($,{src:j,class:[u.wapList,"van-haptics-feedback"],onClick:()=>s.visiableAnswer=!0},null)])]}),a(X,{show:s.visiableAnswer,"onUpdate:show":e=>s.visiableAnswer=e,title:"\u9898\u76EE\u5217\u8868",safeAreaInsetBottom:!0},{default:()=>[a(z,{value:s.questionList,answerResult:s.answerResult,index:s.currentIndex,lookType:d.platformType==="STUDENT"?"RESULT":"CLICK",statusList:d.platformType==="STUDENT"?[{text:"\u7B54\u5BF9",color:"#71B0FF"},{text:"\u7B54\u9519",color:"#FF8486"}]:[],onSelect:e=>{var t;(t=w.value)==null||t.swipeTo(e,{immediate:!0}),s.visiableAnswer=!1}},null)]})])}}});export{he as default};