import{i as w}from"./icon_back-c5ec0a72-1725962701482.js";import{d as g,e as p,q as y,f as t,x as m,j as u,k as _,u as h,E as f,w as k,aP as I,aQ as T,t as b,v as S,D as L,S as W}from"./index-8151123c-1725962701482.js";import{T as v}from"./index-6ac9882e-1725962701482.js";import{T as C}from"./index-b03328a0-1725962701482.js";import{P as B}from"./index-b978cc22-1725962701482.js";import{a as N,b as E}from"./api-95647aa3-1725962701482.js";const x="_container_19grw_1",G="_iconBack_19grw_1",V="_separator_19grw_63",F="_wrap_19grw_68",U="_listWrap_19grw_73",j="_listWrapEmpty_19grw_79",n={container:x,iconBack:G,separator:V,wrap:F,listWrap:U,listWrapEmpty:j},z="_searchGroup_1291e_1",A="_btnType_1291e_5",M="_inputSearch_1291e_18",P="_searchCatatory_1291e_39",D="_addTrain_1291e_44",O="_list_1291e_56",R="_itemWrap_1291e_66",q="_itemWrapBox_1291e_71",$="_itemCard_1291e_79",H="_itemImgSection_1291e_88",Q="_itemTag_1291e_95",J="_img_1291e_120",K="_itemTitle_1291e_130",o={searchGroup:z,btnType:A,inputSearch:M,searchCatatory:P,addTrain:D,list:O,itemWrap:R,itemWrapBox:q,itemCard:$,itemImgSection:H,itemTag:Q,img:J,itemTitle:K},X=g({name:"search-group",props:{categoryChildList:{type:Array,default:()=>[]},wikiCategoryId:{type:String,default:""}},emits:["search","add"],expose:["init"],setup(i,{emit:c}){const a=p({keyword:"",wikiCategoryId:i.wikiCategoryId||""}),r=()=>{c("search",a)};return y(async()=>{}),()=>t("div",{class:o.searchGroup},[t("div",{class:[o.searchCatatory]},[t(m,{size:"small",class:o.btnType},{default:()=>[i.categoryChildList.length>0?t(u,{type:a.wikiCategoryId===i.wikiCategoryId?"primary":"default",secondary:a.wikiCategoryId!==i.wikiCategoryId,round:!0,size:"small",focusable:!1,onClick:()=>{a.wikiCategoryId=i.wikiCategoryId,r()}},{default:()=>[_("全部")]}):t("span",null,null),i.categoryChildList.map(s=>t(u,{type:a.wikiCategoryId===s.id?"primary":"default",secondary:a.wikiCategoryId!==s.id,round:!0,size:"small",focusable:!1,onClick:()=>{a.wikiCategoryId=s.id,r()}},{default:()=>[s.name]}))]}),t(v,{class:o.inputSearch,placeholder:"请输入音乐家名称",round:!0,onSearch:s=>{a.keyword=s,r()}},null)])])}}),Y=g({name:"musician-list",props:{categoryId:{type:String,default:""},categoryChildList:{type:Array,default:()=>[]}},setup(i){const c=h(),a=p({searchWord:"",loading:!1,pageTotal:0,pagination:{page:1,rows:18},searchGroup:{type:"MUSICIAN",keyword:"",wikiCategoryId:i.categoryId},tableList:[],teachingStatus:!1,show:!1,item:{}}),r=async()=>{a.loading=!0;try{const{data:e}=await N({...a.pagination,...a.searchGroup}),d=e.rows||[];d.forEach(l=>{l.knowledgeWikiCategories&&l.knowledgeWikiCategories.length&&(l.categories=l.knowledgeWikiCategories[0].knowledgeWikiCategoryTypeName)}),a.tableList=d||[],a.pageTotal=Number(e.total)}catch(e){}a.loading=!1},s=async e=>{a.pagination.page=1,a.searchGroup=Object.assign(a.searchGroup,e),r()};return y(()=>{r()}),()=>t("div",{class:o.instrumentList},[t(X,{categoryChildList:i.categoryChildList||[],wikiCategoryId:i.categoryId,onSearch:e=>s(e)},null),t(f,{show:a.loading,"onUpdate:show":e=>a.loading=e,style:{"min-height":"50vh"}},{default:()=>[t("div",{class:o.list},[a.tableList.map(e=>t("div",{class:o.itemWrap,onClick:()=>{c.push({path:"/content-instruments-detail",query:{type:"MUSICIAN",id:e.id,name:e.name}})}},[t("div",{class:o.itemWrapBox},[t("div",{class:o.itemCard},[e.categories?t("span",{class:o.itemTag},[e.categories]):"",t("div",{class:o.itemImgSection},[t(k,{src:e.avatar,class:o.img,objectFit:"cover",previewDisabled:!0},null)]),t("div",{class:o.itemTitle},[e.name])])])])),!a.loading&&a.tableList.length<=0&&t(C,{style:{minHeight:"50vh"},description:"暂无音乐家"},null)])]}),t(B,{page:a.pagination.page,"onUpdate:page":e=>a.pagination.page=e,pageSize:a.pagination.rows,"onUpdate:pageSize":e=>a.pagination.rows=e,pageTotal:a.pageTotal,"onUpdate:pageTotal":e=>a.pageTotal=e,pageSizes:[18,24,30,36],onList:r},null)])}});function Z(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Object]"&&!L(i)}const ra=g({name:"content-musician",setup(){const i=sessionStorage.getItem("content-musician-tab"),c=h(),a=p({tabValue:"",categoryList:[],loading:!1});return(async()=>{a.loading=!0;try{const{data:s}=await E({type:"MUSICIAN",page:1,rows:99});a.categoryList=s.rows||[],a.categoryList.length&&W(()=>{a.tabValue=i||"name-"+a.categoryList[0].id})}catch(s){}a.loading=!1})(),()=>{let s;return t("div",{class:n.container},[t(m,{align:"center",wrapItem:!1,size:16},{default:()=>[t("img",{style:{cursor:"pointer"},src:w,class:n.iconBack,onClick:()=>c.push({path:"/"})},null),t(I,{separator:""},{default:()=>[t(T,null,{default:()=>[_("音乐家")]})]})]}),t("div",{class:n.wrap},[t("div",{class:[n.listWrap,!a.loading&&a.categoryList.length<=0&&n.listWrapEmpty]},[!a.loading&&a.categoryList.length<=0&&t(C,{description:"暂无音乐家"},null),t(b,{defaultValue:"myResources",paneClass:n.paneTitle,justifyContent:"center",paneWrapperClass:n.paneWrapperContainer,"onUpdate:value":[e=>{sessionStorage.setItem("content-musician-tab",e)},e=>a.tabValue=e],value:a.tabValue},Z(s=a.categoryList.map(e=>t(S,{name:"name-".concat(e.id),tab:e.name},{default:()=>[t(Y,{categoryId:e.id,categoryChildList:e.childrenList},null)]})))?s:{default:()=>[s]})])])])}}});export{ra as default};