import{d as _,U,q as k,r as D,x as N,ah as R,D as c,y as O,ag as P,a as n,S as M,A as u,C as A,V as Q,a1 as K,z as H,Z as F}from"./index-a890cc58.js";import{e as d,Q as p,C as q,D as $,K as z,P as V,i as j,A as W,a as G,R as X}from"./index-5abb9be5.js";import{M as E}from"./index-063ac654.js";import{u as Y,a as Z}from"./index-c6afa7a1.js";import{S as J,a as ee}from"./index-cf35467f.js";import{I as te}from"./index-3819b2ef.js";import"./index-05265eee.js";import"./index-a2e64ebf.js";import"./index-46403f33.js";const ne="_unitDetail_15lcn_1",se="_unitSwipe_15lcn_9",ie="_questionTitle_15lcn_12",oe="_questionNum_15lcn_21",ae="_questionType_15lcn_24",le="_wapList_15lcn_31",ue="_btnSection_15lcn_37",re="_prevBtn_15lcn_42",ce="_nextBtn_15lcn_43",de="_activePrevBtn_15lcn_44",pe="_right_15lcn_67",fe="_error_15lcn_70",o={unitDetail:ne,unitSwipe:se,questionTitle:ie,questionNum:oe,questionType:ae,wapList:le,btnSection:ue,prevBtn:re,nextBtn:ce,activePrevBtn:de,right:pe,error:fe};function ve(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!K(r)}const qe=_({name:"unit-detail",setup(){const r=U(),y=k(),f=D(),e=N({type:r.query.type,knowledgePointIds:r.query.knowledgePointIds,lessonCoursewareId:r.query.lessonCoursewareId,studentUnitExaminationId:"",background:"transparent",color:"#fff",visiableAnswer:!1,examDetail:{},currentIndex:0,time:0,questionList:[],visiableInfo:{show:!1,operationType:"RESULT",type:"DEFAULT",content:"",showCancelButton:!1,confirmButtonText:"",cancelButtonText:"",title:""},nextStatus:!1,swipeHeight:"auto",countDownOver:!1}),l=R({time:e.time,onChange(s){3e5>=s.total&&!e.countDownOver&&(e.visiableInfo.show=!0,e.visiableInfo.title="倒计时5分钟",e.visiableInfo.showCancelButton=!1,e.visiableInfo.operationType="TIME",e.visiableInfo.type="COUNTDOWN",e.visiableInfo.confirmButtonText="确认",e.visiableInfo.content="距离交卷时间还剩五分钟哦,请尽快答题~",e.countDownOver=!0)},onFinish:async()=>{d.emit("unitAudioStop"),await I()}}),g=async()=>{try{let s={};if(e.type==="ai"){const{data:t}=await c.post("/edu-app/studentUnitExamination/pointRandomSave",{data:{knowledgePointIds:e.knowledgePointIds}});s=t||{}}else{const{data:t}=await c.post("/edu-app/studentUnitExamination/mockExamination",{data:{lessonCoursewareId:e.lessonCoursewareId}});s=t||{}}s.examinationQuestionAdds.forEach(t=>{t.showAnalysis=!1,t.analysis={message:t.answerAnalysis,topic:!0,userResult:!1},t.userAnswer=[]}),e.questionList=s.examinationQuestionAdds||[],e.studentUnitExaminationId=s.unitExaminationId,e.examDetail=s||{},S()}catch(s){}},S=async()=>{const t=(e.examDetail||{}).timeMinutes||0;e.time=Math.ceil(t*60*1e3),setTimeout(()=>{l.reset(t*60*1e3),l.start()},10)},L=async()=>{var s;e.nextStatus=!0;try{const t=e.questionList||[],a=[];if(t.forEach((i,m)=>{i.userAnswer&&i.userAnswer.length>0&&a.push({questionId:i.id,details:i.userAnswer})}),e.questionList.length===e.currentIndex+1){d.emit("unitAudioStop"),e.visiableInfo.show=!0,e.visiableInfo.title="测验完成",e.visiableInfo.showCancelButton=!0,e.visiableInfo.operationType="CONTINUE",e.visiableInfo.type="DEFAULT",e.visiableInfo.cancelButtonText="再等等",e.visiableInfo.confirmButtonText="确认完成",e.visiableInfo.content="确认本次测验的题目都完成了吗?",e.nextStatus=!1;return}await c.post("/edu-app/studentUnitExamination/submitAnswer",{hideLoading:!0,data:{answers:a,studentUnitExaminationId:e.studentUnitExaminationId}}),(s=f.value)==null||s.next()}catch(t){}e.nextStatus=!1};let w=0;const v=(s=!0)=>{H(()=>{s&&window.scrollTo(0,0),setTimeout(()=>{var x;const t=(x=document.querySelectorAll(".van-swipe-item")[e.currentIndex])==null?void 0:x.querySelector(".swipe-item-question"),a=t==null?void 0:t.querySelectorAll(".answerTitleImg img");let i=!0;a==null||a.forEach(T=>{console.log(T.complete),T.complete||(i=!1)}),!i&&w<3&&setTimeout(()=>{w+=1,v(s)},300),i&&(w=0);const m=F(t);e.swipeHeight=m.height},100)})},B=()=>{e.visiableInfo.operationType==="RESULT"?(e.visiableInfo.show=!1,b(),y.back()):e.visiableInfo.operationType==="BACK"||e.visiableInfo.operationType==="CONTINUE"?I():e.visiableInfo.operationType==="TIME"&&(e.visiableInfo.show=!1)},C=async s=>{if(e.visiableInfo.operationType==="BACK"){if(s){e.visiableInfo.show=!1,window.history.pushState(null,"",document.URL),window.addEventListener("popstate",h,!1);return}try{await c.get("/edu-app/studentUnitExamination/dropExamination",{params:{studentUnitExaminationId:e.studentUnitExaminationId}}),e.visiableInfo.show=!1,b()}catch(t){}}else e.visiableInfo.operationType==="CONTINUE"&&(e.visiableInfo.show=!1)},I=async()=>{try{const s=e.questionList||[],t=[];s.forEach(i=>{i.userAnswer&&i.userAnswer.length>0&&t.push({questionId:i.id,details:i.userAnswer})});const{data:a}=await c.post("/edu-app/studentUnitExamination/completionExamination",{hideLoading:!1,data:{answers:t,studentUnitExaminationId:e.studentUnitExaminationId}});e.visiableInfo.show=!0,e.visiableInfo.title=a.score+"分",e.visiableInfo.showCancelButton=!1,e.visiableInfo.operationType="RESULT",e.visiableInfo.confirmButtonText="确认",a.status==="A_EXCELLENT"?(e.visiableInfo.type="GOOD",e.visiableInfo.content="