import{d as j,P as R,Q as B,S as E,U as i,g as D,W as M,V as N,j as t,F as g,A as d,B as C,f as x,n as $,C as q,y as T}from"./ResizeObserver.es.39b48a47.js";import{L as V}from"./index.6c529ad4.js";import{D as z,a as H}from"./index.720260d3.js";import"./index.db115763.js";import{T as f}from"./index.34ac729a.js";import{S as U}from"./index.e10a1ae2.js";import{g as P}from"./music.0a307f27.js";import{S as O}from"./index.62db47bb.js";import{C as W}from"./index.970ad07b.js";import{b as G}from"./bg.3caae330.js";import{T as J}from"./index.e90d2179.js";import"./use-tab-status.bcc0c503.js";import"./use-id.b004ff17.js";import"./index.428ab1a8.js";import"./icon-xin2.4ab2a52d.js";import"./index.fcbcb027.js";import"./index.dc19bc54.js";const K="_sticky_4pmkt_1",Q="_search_4pmkt_47",Y="_albumSearchSection_4pmkt_50",X="_albumSearchTitle_4pmkt_53",Z="_albumSearchResult_4pmkt_67",ee="_albumSearchCell_4pmkt_70",te="_albumLogo_4pmkt_73",ae="_albumContent_4pmkt_80",le="_albumSearchCellActive_4pmkt_95",se="_iconSelect_4pmkt_99",oe="_listContainer_4pmkt_107",re="_line_4pmkt_119",ie="_active_4pmkt_125",ne="_label_4pmkt_128",ue="_alumnList_4pmkt_141",ce="_bgImg_4pmkt_151",pe="_tagTabs_4pmkt_159",me="_fleg_4pmkt_189",de="_iconFree_4pmkt_195",_e="_iconFreeDisable_4pmkt_199",ge="_searchResult_4pmkt_205",ve="_searchTitle_4pmkt_211",be="_radio_4pmkt_217",fe="_resetting_4pmkt_256",he="_confirm_4pmkt_260";var l={sticky:K,search:Q,albumSearchSection:Y,albumSearchTitle:X,albumSearchResult:Z,albumSearchCell:ee,albumLogo:te,albumContent:ae,albumSearchCellActive:le,iconSelect:se,listContainer:oe,line:re,active:ie,label:ne,alumnList:ue,bgImg:ce,tagTabs:pe,fleg:me,iconFree:de,iconFreeDisable:_e,searchResult:ge,searchTitle:ve,"radio-group":"_radio-group_4pmkt_217",radio:be,"organ-radio":"_organ-radio_4pmkt_249",resetting:fe,confirm:he},qe=j({name:"MusicList",props:{teacherId:{type:String||Number,default:""},myself:{type:Boolean,default:!1}},setup({onItemClick:ye},{expose:ke}){localStorage.setItem("behaviorId",P());const v=R(),I=B(),u=v.query.subjectType||"";let p="";u==="SUBJECT"?p="\u57FA\u7840\u4E91\u7EC3":u==="MUSIC"?p="\u72EC\u594F\u4E91\u7EC3":u==="ENSEMBLE"&&(p="\u5408\u594F\u4E91\u7EC3");const a=E({keyword:v.query.search||"",subjectType:u,page:1,subjectId:null,albumId:v.query.albumId,albumName:"",level:"",type:"",title:p}),o=i(null),c=i(!1),h=i(!1),b=i(!1),r=i({}),y=i();i(),i([]);const k=i(D.platformType==="STUDENT"?"/api-student":"/api-teacher"),L=e=>{a.page=1,a.keyword=e,o.value=null,_()},_=async()=>{var s,m,S;c.value=!0,b.value=!1;const e={...a};try{const n=await T.post(`${k.value}/tenantAlbumMusic/page`,{data:e});if(((m=(s=o.value)==null?void 0:s.rows)==null?void 0:m.length)>0&&n.data.pageNo===1)return;if(o.value){const F=(((S=o.value)==null?void 0:S.rows)||[]).concat(n.data.rows||[]);o.value.rows=F}o.value=o.value||n.data,a.page=n.data.pageNo+1,h.value=n.data.pageNo>=n.data.totalPage}catch{b.value=!0}c.value=!1},w=async()=>{const{data:e}=await T.post(`${k.value}/tenantAlbumMusic/selectCondition`,{data:{subjectType:a.subjectType,tenantAlbumId:a.albumId}});r.value=e||{}},A=M(()=>{const e=r.value;let s=!1;return e.subjects&&e.subjects.length>0&&(s=!0),e.levelList&&e.levelList.length>0&&(s=!0),e.typeList&&e.typeList.length>0&&(s=!0),s});return N(async()=>{c.value=!0,await w(),a.albumId?await _():c.value=!1}),()=>t(g,null,[t("div",{class:l.sticky},[t(J,null,{default:()=>[t(W,{hideHeader:!1,background:"transparent",isFixed:!1,border:!1,title:p,color:"#131415"},null),t(U,{placeholder:"\u8BF7\u8F93\u5165\u66F2\u8C31\u5173\u952E\u8BCD",class:l.search,modelValue:a.keyword,onInput:e=>{a.keyword=e},onSearch:L,type:"tenant",background:"transparent",inputBackground:"transparent"},{left:()=>A.value&&t(z,null,{default:()=>[t(H,{class:"searchOther",titleClass:a.subjectId||a.type||a.level?l.titleActive:"",title:"\u7B5B\u9009",ref:y},{default:()=>[t("div",{class:l.searchResult,style:{maxHeight:"45vh",overflowY:"auto"}},[r.value.subjects&&r.value.subjects.length>0&&t(g,null,[t("div",{class:l.searchTitle},[d("\u58F0\u90E8")]),t("div",{class:[l["radio-group"],l.radio,l["organ-radio"]]},[r.value.subjects.map(e=>{const s=e.id===a.subjectId;return t(f,{size:"large",plain:s,type:s?"primary":"default",round:!0,onClick:()=>{a.subjectId=e.id}},{default:()=>[e.name]})})])]),r.value.levelList&&r.value.levelList.length>0&&t(g,null,[t("div",{class:l.searchTitle},[d("\u7EA7\u522B")]),t("div",{class:[l["radio-group"],l.radio,l["organ-radio"]]},[r.value.levelList.map(e=>{const s=e.id===a.level;return t(f,{size:"large",plain:s,type:s?"primary":"default",round:!0,onClick:()=>{a.level=e.id}},{default:()=>[e.value]})})])]),r.value.typeList&&r.value.typeList.length>0&&t(g,null,[t("div",{class:l.searchTitle},[d("\u7C7B\u578B")]),t("div",{class:[l["radio-group"],l.radio,l["organ-radio"]]},[r.value.typeList.map(e=>{const s=e.id===a.type;return t(f,{size:"large",plain:s,type:s?"primary":"default",round:!0,onClick:()=>{a.type=e.id}},{default:()=>[e.value]})})])])]),t("div",{class:["btnGroup","btnMore"]},[t(C,{class:l.resetting,type:"primary",plain:!0,round:!0,onClick:()=>{a.subjectId=null,a.level="",a.type=""}},{default:()=>[d("\u91CD \u7F6E")]}),t(C,{class:l.confirm,type:"primary",color:"linear-gradient( 270deg, #FF204B 0%, #FE5B71 100%)",round:!0,block:!0,onClick:()=>{var e;a.page=1,o.value=null,_(),(e=y.value)==null||e.toggle()}},{default:()=>[d("\u786E \u8BA4")]})])]})]})})]}),t("img",{class:l.bgImg,src:G},null)]),t("div",{class:l.alumnList},[t(V,{loading:c.value,finished:h.value,"finished-text":(o.value&&o.value.rows.length,""),onLoad:_,error:b.value,immediateCheck:!1},{default:()=>[o.value&&o.value.rows.length?t(O,{showTitleImg:!0,list:o.value.rows,onDetail:e=>{if(x().isApp){const s=`${location.origin}/tenant/#/music-detail?id=${e.id}&subjectType=${u}&tenantAlbumId=${e.tenantAlbumId}`;$({api:"openWebView",content:{url:s,orientation:1,isHideTitle:!1}})}else I.push({path:"/music-detail",query:{subjectType:u,id:e.id,tenantAlbumId:e.tenantAlbumId}})}},null):!c.value&&t(q,{tips:"\u6682\u65E0\u66F2\u76EE",classImgSize:"CERT",btnStatus:!1},null)]})])])}});export{qe as default};