import{d as v,Q as h,P as y,S as E,U as n,V as N,j as a,f as C,n as F,C as w,F as A,y as b}from"./ResizeObserver.es.b7226882.js";import{D as T,a as R}from"./index.287fb1bf.js";import"./index.40f703b6.js";import{L as k}from"./index.9fec2202.js";import{C as M}from"./index.969bba7f.js";import{T as j}from"./index.1743594f.js";import{b as U}from"./bg.3caae330.js";import{S as O}from"./index.521acd0b.js";import{C as B}from"./index.18a074c6.js";import"./use-id.5d5e6e63.js";import"./use-tab-status.db1f6d2e.js";import"./index.1eaf642c.js";import"./index.021f1c7b.js";const G="_sticky_1o852_1",V="_dropdownMenuSub_1o852_49",x="_titleActive_1o852_78",H="_search_1o852_81",P="_bgImg_1o852_84",q="_alumnList_1o852_92",$="_courseItem_1o852_98";var o={sticky:G,dropdownMenuSub:V,titleActive:x,search:H,bgImg:P,alumnList:q,courseItem:$},ue=v({name:"lessonCourseware",setup(){const f=h(),m=y(),t=E({keyword:m.query.search||"",albumId:m.query.albumId,subjectList:[],page:1}),l=n(!1),I=n(!1),i=n(!1),c=n(""),d=n([]);let p;(function(e){e.PERCUSSION_SINGLE="\u6253\u51FB\u4E50",e.FLUTE_SINGLE="\u957F\u7B1B",e.SAX_SINGLE="\u8428\u514B\u65AF",e.CLARINET_SINGLE="\u5355\u7C27\u7BA1",e.TRUMPET_SINGLE="\u5C0F\u53F7",e.TROMBONE_SINGLE="\u957F\u53F7",e.HORN_SINGLE="\u5706\u53F7",e.BARITONE_TUBA_SINGLE="\u4E0A\u4F4E\u97F3\u53F7-\u5927\u53F7",e.MUSIC_THEORY="\u4E50\u7406",e.INSTRUMENTAL_ENSEMBLE="\u5408\u594F",e.EUPHONIUM_SINGLE="\u4E0A\u4F4E\u97F3\u53F7",e.TUBA_SINGLE="\u5927\u53F7"})(p||(p={}));const g=async()=>{var e;try{const u=await b.post("/api-student/tenantAlbumMusic/selectCondition",{data:{subjectType:"COURSEWARE",tenantAlbumId:t.albumId}});u.code===200&&(d.value=[{text:"\u5168\u90E8\u6559\u6750",value:""},...(((e=u.data)==null?void 0:e.courseTypeList)||[]).map(s=>({text:p[s],value:s}))])}catch{}};function _(e){t.page=1,t.keyword=e,t.subjectList=[],r()}function L(){t.page=1,t.subjectList=[],r()}const r=async()=>{var e,u;l.value=!0,i.value=!1;try{const s=await b.post("/api-student/tenantAlbumMusic/page",{data:{courseTypeCode:c.value,keyword:t.keyword,albumId:t.albumId,subjectType:"COURSEWARE",page:t.page,rows:20}});if(((e=t.subjectList)==null?void 0:e.length)>0&&s.data.pageNo===1)return;const S=(t.subjectList||[]).concat(((u=s.data)==null?void 0:u.rows)||[]);t.subjectList=S,t.page=s.data.pageNo+1,I.value=s.data.pageNo>=s.data.totalPage}catch{i.value=!0}l.value=!1};return N(async()=>{l.value=!0,await g(),t.albumId?await r():l.value=!1}),()=>a(A,null,[a("div",{class:o.sticky},[a(j,null,{default:()=>[a(M,{hideHeader:!1,background:"transparent",isFixed:!1,border:!1,title:"\u4E91\u8BFE\u5802",color:"#131415"},null),a(O,{class:o.search,onSearch:_,modelValue:t.keyword,onInput:e=>{t.keyword=e},type:"tenant",placeholder:"\u8BF7\u8F93\u5165\u6559\u6750\u5173\u952E\u8BCD",background:"transparent",inputBackground:"transparent"},{left:()=>d.value.length>1&&a(T,{class:o.dropdownMenuSub},{default:()=>[a(R,{titleClass:o.titleActive,modelValue:c.value,"onUpdate:modelValue":e=>c.value=e,options:d.value,onChange:L},{default:()=>[a("div",null,null)]})]})})]}),a("img",{class:o.bgImg,src:U},null)]),a("div",{class:o.alumnList},[a(k,{loading:l.value,finished:I.value,"finished-text":"",onLoad:r,error:i.value,immediateCheck:!1},{default:()=>[t.subjectList.length?a(B,{class:[o.courseItem],list:t.subjectList.map(e=>({name:e.musicSheetName,coverImg:e.titleImg,id:e.id})),onItemClick:e=>{if(C().isApp){const u=`${location.origin}/tenant/#/courseList?id=${e.id}&albumId=${t.albumId}`;F({api:"openWebView",content:{url:u,orientation:1,isHideTitle:!1}})}else f.push({path:"/courseList",query:{id:e.id,albumId:t.albumId}})}},null):!l.value&&a(w,{tips:"\u6682\u65E0\u6559\u6750",classImgSize:"CERT",btnStatus:!1},null)]})])])}});export{ue as default};