import{d as s,f as t,u as e,r as a,n as i,o,c as n,a as r,O as c,T as l,b as u,F as d,i as m,e as p,s as y,v as g}from"./index-4bd11d60.js";import{O as v}from"./index-d4b75cd9.js";import{C as f}from"./index-25a37ddb.js";import{O as h}from"./index-4cd08929.js";import{T as _,a as w}from"./index-179cb356.js";import{I as b}from"./index-616bb944.js";import"./index-73a2908a.js";import"./index-1da68693.js";import"./use-tab-status-ba8cfa13.js";import"./index-86832be9.js";const j=s({name:"courseList",setup(){const s=t(),j=e(),x=s.query.type;let L="music";"onlymusic"!==x&&(L=x);const C=a({topKey:L||"music",list:[],show:!0,actionKey:0,loading:!0,subjectList:[],classList:[],titleOpacity:0}),K=async()=>{try{const s=await p.get(y.platformApi+"/sysMusicScoreCategories/queryTree");C.list=s.data||[],C.show=C.list.length>0}catch(s){}},I=async()=>{C.loading=!0;try{const s=(await p.post(y.platformApi+"/lessonCourseware/queryLessonCourseware",{data:{subjectId:C.actionKey?C.actionKey:null,page:1,rows:999}})).data.rows.map((s=>({...s,coverImg:s.cover,name:s.name,id:s.id,courseNum:s.courseNum})));C.classList=s}catch(s){}C.loading=!1},O=async()=>{try{await(async()=>{try{const s=await p.get(y.platformApi+"/lessonCourseware/getLessonCoursewareSubjectList");C.subjectList=s.data||[]}catch(s){}})();const s="TEACHER"===y.platformType?y.user.data.subjectId:y.user.data.student.subjectIdList,t=s?s.split(",")[0]:0;C.subjectList.forEach((s=>{Number(t)===s.id&&(C.actionKey=Number(t))})),await I()}catch(s){}C.loading=!1,g({api:"getCoursewareSelectResult"},(s=>{if(null==s?void 0:s.content)return y.max=s.content.max,void(y.vIds=s.content.coursewareIds||[])}))};i("scroll",(()=>{const s=window.scrollY||window.pageYOffset||document.documentElement.scrollTop;C.titleOpacity=s>100?1:s/100})),o((async()=>{"music"===C.topKey?K():O()}));const S=n((()=>{const s=C.subjectList.map((s=>({id:s.id,name:s.name,text:s.name,value:s.id})));return s.unshift({id:"",name:"课程类型",text:"全部",value:0}),s}));return()=>{let t;return r("div",{"class":"_choiseHomework_uxrta_1"},[r(v,{position:"top"},{"default":()=>{return[r(c,{border:!1,background:"transparent",color:"#131415"},null),"onlymusic"!==x&&r("div",{"class":"_topTabs_uxrta_14"},[r(_,{border:!1,active:C.topKey,"onUpdate:active":s=>C.topKey=s,onClickTab:s=>{C.topKey=s.name,"music"===C.topKey?C.list.length<=0&&K():"courseware"===C.topKey&&(C.subjectList.length<=0||C.classList.length<=0)&&O()}},{"default":()=>[r(w,{title:"云练习",name:"music"},null),r(w,{title:"云课堂",name:"courseware"},null)]}),"courseware"===C.topKey&&r(_,{"class":"_classroomTab_uxrta_35",active:C.actionKey,"onUpdate:active":s=>C.actionKey=s,shrink:!0,onClickTab:s=>{C.actionKey=s.name,I()}},(s=t=S.value.map((s=>r(w,{title:s.text,name:s.value},null))),"function"==typeof s||"[object Object]"===Object.prototype.toString.call(s)&&!m(s)?t:{"default":()=>[t]}))])];var s}}),r("div",{"class":["_container_uxrta_50","courseware"===C.topKey?"_containerClass_uxrta_56":"","onlymusic"===x?"_containerClassOnly_uxrta_71":""]},["music"===C.topKey?r(l,{name:"van-fade"},{"default":()=>[r("div",{"class":"_items_uxrta_77"},[C.show?C.list.map((t=>r("div",{key:t.id,onClick:()=>(t=>{var e;const a=t.sysMusicScoreCategoriesList?t.sysMusicScoreCategoriesList.length:0;sessionStorage.setItem("musicScoreList",JSON.stringify(t.sysMusicScoreCategoriesList)),a>1?j.push({path:"/classify",query:{parentId:t.id,...s.query}}):j.push({path:"/music-list/"+(1==a?null==(e=t.sysMusicScoreCategoriesList[0])?void 0:e.id:t.id),query:{...s.query}})})(t)},[r("div",{"class":"_inner_uxrta_87"},[r(b,{src:t.coverImg,"class":"_img_uxrta_91"},null)])]))):r(u,{tips:"暂无数据"},null)])]}):r(d,null,[r(l,{name:"van-fade"},{"default":()=>[!C.loading&&Object.values(C.classList).length>0&&r(f,{list:C.classList,onItemClick:s=>{return t=s,void j.push({path:"/classroom-detail",query:{id:t.lessonCoursewareId}});var t}},null)]}),C.loading&&r(h,null,null),!C.loading&&!Object.values(C.classList).length&&r("div",{style:{minHeight:"calc(100vh - var(--header-height))",display:"flex",alignItems:"center"}},[r(u,{tips:"暂无课件"},null)])])])])}}});export{j as default};
