import{d as h,ah as y,ag as g,r as w,e as C,$ as v,y as b,c as r,F as N,q as S,a5 as q,b6 as O,aj as _,P as I,m as l,f as u}from"./index.e9fb8d8c.js";import{O as A}from"./index.4c3cce9a.js";import{C as K}from"./index.2ee6d99f.js";import{c as j}from"./index.38b203e1.js";import{O as x}from"./index.d106ceac.js";import{P as R}from"./index.a8f43359.js";import"./index.45072c7a.js";import"./Picker.0568a7cb.js";import"./index.fee75d0a.js";import"./use-tab-status.fd4c4609.js";import"./index.e61886e7.js";import"./index.25161507.js";const T="_lessonCourseware_hwgf4_1",L="_filter_hwgf4_7";var m={lessonCourseware:T,filter:L},G=h({name:"lessonCourseware",setup(){const s=y(),n=g(),o=w({loading:!0,list:[],actionShow:!1,actionName:"\u8BFE\u7A0B\u7C7B\u578B",actionKey:"",showRight:s.query.code!="select"&&C().isTeacher}),i=e=>{const a={};for(let t=0;t{if(o.loading=!0,s.query.code==="select")try{const e=await l.post(u.platformApi+`/courseSchedule/getCourseware/${s.query.courseScheduleId}`);if(Array.isArray(e==null?void 0:e.data)){const a=e.data.map(t=>({...t,coverImg:t.coverImg,name:t.coursewareName,id:t.lessonCoursewareId,courseNum:t.coursewareNum}));o.list=i(a),console.log("\u{1F680} ~ data.list:",o.list)}}catch{}else try{const e=await l.post(u.platformApi+"/courseSchedule/myCourseware");if(Array.isArray(e==null?void 0:e.data)){const a=o.actionKey?e.data.filter(t=>t.courseTypeCode===o.actionKey):e.data;o.list=i(a)}}catch{}o.loading=!1};v(()=>{c()});const d=e=>{if(s.query.code==="select"){n.push({path:"/courseList",query:{...s.query,id:e.id}});return}n.push({path:"/courseList",query:{id:e.id}})},p=b(()=>{const e=Object.entries(j).map(([a,t])=>({id:a,name:t,text:t,value:a,color:a===o.actionKey?"var(--van-primary)":""}));return e.unshift({id:"",name:"\u8BFE\u7A0B\u7C7B\u578B",text:"\u5168\u90E8",value:"",color:o.actionKey===""?"var(--van-primary)":""}),e}),f=e=>{o.actionKey=e.id,o.actionName=e.name,o.actionShow=!1,c()};return()=>r("div",{class:[m.lessonCourseware,!Object.values(o.list).length&&"emptyRootContainer"]},[r(A,{border:!1,background:"rgba(255, 232, 206, 1)",color:"rgba(124, 61, 18, 1)",title:"\u4E91\u6559\u6750"},{right:()=>r(N,null,[o.showRight&&r("div",{class:m.filter,onClick:()=>o.actionShow=!0},[o.actionName,S(" "),r(q,{style:{transform:"rotate(90deg)"},name:"play"},null)," "])])}),r(O,{name:"van-fade"},{default:()=>[!o.loading&&Object.keys(o.list).map(e=>r(K,{term:e,list:o.list[e],onItemClick:a=>d(a)},null))]}),o.loading&&r(x,null,null),!o.loading&&!Object.values(o.list).length&&r(_,{tips:"\u6CA1\u6709\u8BFE\u4EF6"},null),r(I,{position:"bottom",round:!0,show:o.actionShow,"onUpdate:show":e=>o.actionShow=e},{default:()=>[r(R,{class:"popupBottomSearch",columns:p.value,onCancel:()=>o.actionShow=!1,onConfirm:({selectedOptions:e})=>{f(e[0])}},null)]})])}});export{G as default};