import{d as S,x as C,r as w,y as I,a8 as E,a as e,Q as T,A as p,F as D,C as y,q as N,P as R,W as B,h as L,a2 as P,a3 as q,D as v,E as G}from"./index-521a9826.js";import{M as U}from"./index-c0ea6da9.js";import{s as i}from"./index.module-35f2589f.js";import{u as V,a as M}from"./index-fdaad3c0.js";import{g as m,s as r,a as O,b as $}from"./api-5dda1e6a.js";import{C as z,a as A}from"./index-06b5ed9e.js";import{I as F}from"./index-25b5c9d0.js";import"./index-1ad6a58d.js";const j=""+new URL("library-1-96754f77.png",import.meta.url).href,K=""+new URL("library-2-18c7f885.png",import.meta.url).href,W=""+new URL("library-3-784f5dd5.png",import.meta.url).href,H=S({name:"knowledge-guide",emits:["close"],setup(c,{emit:h}){const s=C({box:{},show:!1,steps:[{ele:"",eleRect:{},img:m("knowledge1.png"),handStyle:{top:"1.3rem",left:"1.5rem"},imgStyle:{width:"5.46rem",height:"2.30rem",top:"1.9rem"},btnsStyle:{top:"4.5rem",left:"1rem"},boxStyle:{transform:"scale(1.2)!important"}},{ele:"",eleRect:{},img:m("knowledge2.png"),handStyle:{top:"1.3rem",left:"1.5rem"},imgStyle:{top:"1.9rem",left:"-1.5rem"},btnsStyle:{top:"4.5rem"},boxStyle:{transform:"scale(1.2)!important"}},{ele:"",img:m("knowledge3.png"),handStyle:{top:"4.1rem",left:"3.6rem"},imgStyle:{top:"4.8rem",left:"1.2rem",width:"7.2rem",height:"3.45rem"},btnsStyle:{top:"8.8rem",left:"2.3rem",transform:"scale(1.2)"},boxStyle:{transform:"scale(1)"}}],step:0}),o=w(!1),u=w({}),f=async()=>{var t;try{const n=await O({guideTag:"guideInfo"});n.data?u.value=JSON.parse((t=n.data)==null?void 0:t.guideValue)||null:u.value={},u.value&&u.value.knowledge?o.value=!1:o.value=!0}catch(n){console.log(n)}},d=()=>{const t=document.getElementById(`knowledge-${s.step}`);if(console.log(t,"ele"),t){const n=t.getBoundingClientRect();s.box={left:n.x+"px",top:n.y+"px",width:n.width+"px",height:n.height+"px"}}else a()};I(()=>{f(),d(),window.addEventListener("resize",l)});const l=()=>{d()};E(()=>{window.removeEventListener("resize",l)});const a=()=>{if(console.log(s.step,""),s.step>=2){g();return}s.step=s.step+1,d()},g=async()=>{u.value?u.value.knowledge=!0:u.value={knowledge:!0};try{const t=await $({guideTag:"guideInfo",guideValue:JSON.stringify(u.value)})}catch(t){console.log(t)}o.value=!1};return()=>e(T,{teleport:"body",overlay:!1,closeOnClickOverlay:!1,class:["popup-custom",r.guidePopup],show:o.value,"onUpdate:show":t=>o.value=t},{default:()=>[e("div",{class:r.content,onClick:()=>a()},[s.step!=s.steps.length-1&&e("div",{class:[r.backBtn,r.right],onClick:t=>{t.stopPropagation(),g()}},[p("跳过")]),e("div",{class:[r.box,r.noscalc],style:{...s.box,...s.steps[s.step].boxStyle},id:`modeType-${s.step}`},[s.steps.map((t,n)=>{var b,k;return e("div",{onClick:x=>x.stopPropagation(),class:r.item,style:{display:n===s.step?"":"none",left:`${(b=t.eleRect)==null?void 0:b.left}px`,top:`${(k=t.eleRect)==null?void 0:k.top}px`}},[e("img",{class:r.img,style:t.imgStyle,src:t.img},null),e("img",{class:r.iconHead,style:t.handStyle,src:m("indexDot.png")},null),e("div",{class:r.btns,style:t.btnsStyle},[s.step+1==s.steps.length?e(D,null,[e(y,{class:r.btn,round:!0,color:"transparent",style:{"border-color":"#fff"},type:"primary",onClick:()=>{s.step=0,d()}},{default:()=>[p("再看一遍")]}),e(y,{class:[r.btn,r.endBtn],round:!0,type:"primary",onClick:()=>g()},{default:()=>[p("完成")]})]):e(y,{class:r.btn,round:!0,type:"primary",onClick:()=>a()},{default:()=>[p("下一步 ("),s.step+1,p("/"),s.steps.length,p(")")]})])])})])])]})}});function J(c){return typeof c=="function"||Object.prototype.toString.call(c)==="[object Object]"&&!q(c)}const oe=S({name:"knowledge-ligrary",setup(){const c=N(),h=R(),s=w(),o=C({cid:h.query.cid,list:[],activeNames:sessionStorage.getItem("knowledge-ligrary-key")?Number(sessionStorage.getItem("knowledge-ligrary-key")):0,background:"transparent",color:"#fff"}),u=async()=>{try{const{data:l}=await v.post("/edu-app/lessonCourseware/queryStudentLessonDetail",{requestType:"form",data:{lessonCoursewareId:o.cid}});o.list=l,s.value=!0}catch(l){}},f=l=>{if(l%3===1)return j;if(l%3===2)return K;if(l%3===0)return W},d=async l=>{try{const{data:a}=await v.get("/edu-app/studentUnitExamination/checkKnowledgePointIds",{params:{lessonCoursewareId:o.cid}});if(!a){setTimeout(()=>{G("暂无题目")},100);return}l==="TEST"?c.push({path:"/examination-mode",query:{lessonCoursewareId:o.cid}}):c.push({path:"/practice-mode",query:{lessonCoursewareId:o.cid}})}catch(a){}};return I(()=>{V(document,"scroll",()=>{const{y:l}=M();l.value>52?(o.background="#fff",o.color="#323333"):(o.background="transparent",o.color="#fff")}),u()}),()=>{let l;return e("div",{class:i.knowledgeLibrary},[e(U,{position:"top"},{default:()=>[e(B,{border:!1,background:o.background,color:o.color},{right:()=>e("div",{class:[i.wroingBtn],onClick:()=>c.push("/wroing-book")},[e("i",{class:i.iconWroing},null),p("错题本")])})]}),e("div",{class:i.btnGroup},[e("div",{id:"knowledge-0",class:i.btnPractice,onClick:()=>d("PRACTICE")},null),e("div",{id:"knowledge-1",class:i.btnTest,onClick:()=>d("TEST")},null)]),e("div",{class:[i.containerSection,i.librarySection]},[e(z,{modelValue:o.activeNames,"onUpdate:modelValue":a=>o.activeNames=a,accordion:!0,border:!1,onChange:a=>{sessionStorage.setItem("knowledge-ligrary-key",a)}},J(l=o.list.map((a,g)=>e(A,{title:a.lessonCoursewareDetailName,name:g,value:o.activeNames===g?"收起":"展开",border:!1},{default:()=>[a.knowledgeDetails&&a.knowledgeDetails.map((t,n)=>e("div",{class:i.unitItem,onClick:()=>c.push({path:"/unit-detail",query:{detailId:t.lessonCoursewareKnowledgeDetailId}})},[e(F,L({id:n==0?"knowledge-2":""},{class:i.unitImg,lazyLoad:!0,src:f(n)}),null),e("p",{class:i.name},[e("span",null,[t.name])])])),a.knowledgeDetails&&a.knowledgeDetails.length<=0&&e(P,{description:"暂无章节"},null)]})))?l:{default:()=>[l]})]),s.value&&e(H,null,null)])}}});export{oe as default};