1 |
- import{d as _,ah as C,ag as L,R as b,r as N,$ as D,g as d,b3 as O,c as a,aj as U,a5 as k,q as f,B as x,al as Q,m,_ as H,an as B}from"./index.1c621181.js";import{i as F}from"./icon-question-nums.dee74fa0.js";import{e as A,Q as p,C as q,D as K,K as j,P as z,i as G,A as J}from"./index.ab76619c.js";import{O as P}from"./index.b491c24a.js";import{C as V}from"./index.fd5ae97b.js";import{S as M,a as $}from"./index.78a302c3.js";import{I as X}from"./index.4c221cbe.js";import{A as Y}from"./index.7c36c16c.js";import"./index.5a8ac45d.js";import"./index.4e64eb97.js";const W="_unitDetail_1qg73_1",Z="_unitSection_1qg73_4",ee="_unitTitle_1qg73_11",se="_unitCount_1qg73_16",te="_qNums_1qg73_22",ne="_num_1qg73_29",ae="_icon_1qg73_32",oe="_wapList_1qg73_37";var u={unitDetail:W,unitSection:Z,unitTitle:ee,unitCount:se,qNums:te,num:ne,icon:ae,wapList:oe};function ie(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!Q(r)}var Ae=_({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 m.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 m.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 h=(n=!0)=>{H(()=>{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,h(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(),h()}),O(()=>{A.emit("unitAudioStop")}),()=>{let n;return a("div",{class:u.unitDetail},[a(U,null,null),a(V,{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(k,{class:u.icon,name:F},null),f("\u9898\u76EE\u6570\u91CF")," ",a("span",{class:u.num,style:{paddingLeft:"6px"}},[s.currentIndex+1]),f("/"),s.examDetail.questionNum||0])])}),a(M,{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,h()}},ie(n=s.questionList.map((e,t)=>a($,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(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.LINK&&a(j,{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(z,{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(P,{position:"bottom",background:"white"},{default:()=>[a("div",{class:["btnGroup btnMore"]},[s.currentIndex>0&&a(x,{round:!0,block:!0,type:"primary",plain:!0,onClick:()=>{var e;(e=w.value)==null||e.prev()}},{default:()=>[f("\u4E0A\u4E00\u9898")]}),a(x,{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(X,{src:G,class:[u.wapList,"van-haptics-feedback"],onClick:()=>s.visiableAnswer=!0},null)])]}),a(Y,{show:s.visiableAnswer,"onUpdate:show":e=>s.visiableAnswer=e,title:"\u9898\u76EE\u5217\u8868",safeAreaInsetBottom:!0},{default:()=>[a(J,{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{Ae as default};
|