1 |
- import{i as k}from"./icon_back-c5ec0a72-1701760103461.js";import{d as _,e as m,O as b,f as e,w as y,j as h,k as C,F as L,dh as S,aS as f,u as w,n as I,A as v,ci as B,cj as T,p as x,q as W}from"./index-e2e98748-1701760103461.js";import{T as N}from"./index-0fad0471-1701760103461.js";import{T as A}from"./index-9587e556-1701760103461.js";import{P as E}from"./index-23cef579-1701760103461.js";import{i as j}from"./icon_default-d1bcaf5f-1701760103461.js";import{a as F,b as G}from"./api-45233a8f-1701760103461.js";const U="_container_1d1l7_1",V="_iconBack_1d1l7_1",O="_separator_1d1l7_63",z="_wrap_1d1l7_68",D="_listWrap_1d1l7_73",p={container:U,iconBack:V,separator:O,wrap:z,listWrap:D},P="_searchGroup_1eoa2_1",M="_btnType_1eoa2_5",R="_inputSearch_1eoa2_18",$="_searchCatatory_1eoa2_39",q="_border_1eoa2_44",H="_addTrain_1eoa2_48",J="_list_1eoa2_60",K="_itemWrap_1eoa2_70",Q="_itemWrapBox_1eoa2_76",X="_itemCard_1eoa2_84",Y="_musicBg_1eoa2_100",Z="_itemName_1eoa2_106",tt="_btn_1eoa2_5",et="_iconArrow_1eoa2_122",at="_popSelect_1eoa2_130",it="_spaceSection_1eoa2_137",ot="_textBtn_1eoa2_140",st="_textBtnActive_1eoa2_149",o={searchGroup:P,btnType:M,inputSearch:R,searchCatatory:$,border:q,addTrain:H,list:J,itemWrap:K,itemWrapBox:Q,itemCard:X,musicBg:Y,itemName:Z,btn:tt,iconArrow:et,popSelect:at,spaceSection:it,textBtn:ot,textBtnActive:st};function rt(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!f(s)}const nt=_({name:"search-group",props:{categoryChildList:{type:Array,default:()=>[]},wikiCategoryId:{type:String,default:""}},emits:["search","add"],expose:["init"],setup(s,{emit:n}){const t=m({keyword:"",wikiCategoryId:"",wikiCategoryIdChild:"",childIds:[]}),r=()=>{n("search",t)},c=(l,i)=>{const d={};return l==null||l.forEach(u=>{u.id===t.wikiCategoryIdChild&&(d.selected=!0,d.name=u.name)}),d},a=b(()=>{const i=(s.categoryChildList||[]).find(d=>d.id===t.wikiCategoryId);return i&&i.childrenList.length?(i.childrenList.forEach(d=>{d.childrenList.forEach(g=>{g.label=g.name,g.value=g.id})}),[{label:"全部",value:"",id:"",name:"全部",childrenList:[]},...i.childrenList]):[]});return console.log(s.categoryChildList,"categoryChildList"),()=>{let l;return e("div",{class:o.searchGroup},[e("div",{class:[o.searchCatatory,a.value.length>0?o.border:""]},[e(y,{size:"small",class:o.btnType},{default:()=>[e(h,{type:t.wikiCategoryId===""?"primary":"default",secondary:t.wikiCategoryId!=="",round:!0,size:"small",focusable:!1,onClick:()=>{t.wikiCategoryId=s.wikiCategoryId,t.wikiCategoryIdChild="",r()}},{default:()=>[C("全部")]}),s.categoryChildList.map(i=>e(h,{type:t.wikiCategoryId===i.id?"primary":"default",secondary:t.wikiCategoryId!==i.id,round:!0,size:"small",focusable:!1,onClick:()=>{t.wikiCategoryId=i.id,r()}},{default:()=>[i.name]}))]}),e(N,{class:o.inputSearch,placeholder:"请输入曲目鉴赏关键词",round:!0,onSearch:i=>{t.keyword=i,r()}},null)]),a.value.length>0&&e("div",{class:[o.collapseWrap]},[e(y,{class:[o.spaceSection]},rt(l=a.value.map((i,d)=>e(L,null,[i.childrenList.length>0?e(S,{options:i.childrenList,trigger:"click",value:t.wikiCategoryIdChild,"onUpdate:value":[u=>t.wikiCategoryIdChild=u,()=>{r()}],key:i.id,class:o.popSelect},{default:()=>[e("span",{class:[o.textBtn,c(i.childrenList).selected&&o.textBtnActive]},[c(i.childrenList).name||i.name])]}):e("span",{class:[o.textBtn,t.wikiCategoryIdChild===i.id&&o.textBtnActive],onClick:()=>{t.wikiCategoryIdChild=i.id,r()}},[i.name])])))?l:{default:()=>[l]})])])}}}),ct=_({name:"music-list",props:{categoryId:{type:String,default:""},categoryChildList:{type:Array,default:()=>[]}},setup(s){const n=w(),t=m({searchWord:"",loading:!1,pageTotal:0,pagination:{page:1,rows:20},searchGroup:{type:"MUSIC",keyword:"",wikiCategoryId:s.categoryId},tableList:[],teachingStatus:!1,show:!1,item:{}}),r=async()=>{t.loading=!0;try{const{data:a}=await F({...t.pagination,...t.searchGroup});t.tableList=a.rows||[],t.pageTotal=Number(a.total)}catch(a){}t.loading=!1},c=async a=>{t.pagination.page=1;const{wikiCategoryIdChild:l,wikiCategoryId:i}=a;t.searchGroup=Object.assign(t.searchGroup,{wikiCategoryId:l||i}),r()};return I(()=>{r()}),()=>e("div",{class:o.instrumentList},[e(nt,{categoryChildList:s.categoryChildList,wikiCategoryId:s.categoryId,onSearch:a=>c(a)},null),e(v,{show:t.loading,"onUpdate:show":a=>t.loading=a,style:{"min-height":"50vh"}},{default:()=>[e("div",{class:o.list},[t.tableList.map(a=>e("div",{class:o.itemWrap},[e("div",{class:o.itemWrapBox},[e("div",{class:o.itemCard},[e("div",{class:o.itemName},[e("img",{src:a.avatar||j,class:o.musicBg},null),e("span",{class:o.name},[a.name])]),e(h,{class:o.btn,round:!0,type:"primary",onClick:()=>{n.push({path:"/content-music-detail",query:{id:a.id,name:a.name}})}},{default:()=>[C("播放"),e("i",{class:o.iconArrow},null)]})])])])),!t.loading&&t.tableList.length<=0&&e(A,{style:{minHeight:"50vh"},description:"暂无音乐人"},null)])]}),e(E,{page:t.pagination.page,"onUpdate:page":a=>t.pagination.page=a,pageSize:t.pagination.rows,"onUpdate:pageSize":a=>t.pagination.rows=a,pageTotal:t.pageTotal,"onUpdate:pageTotal":a=>t.pageTotal=a,onList:r},null)])}});function lt(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!f(s)}const mt=_({name:"content-music",setup(){const s=w(),n=m({tabValue:"",categoryList:[]});return(async()=>{try{const{data:r}=await G({type:"MUSIC",page:1,rows:99});n.categoryList=r.rows||[],n.categoryList.length&&(n.tabValue="name-"+n.categoryList[0].id)}catch(r){}})(),()=>{let r;return e("div",{class:p.container},[e(y,{align:"center",wrapItem:!1,size:16},{default:()=>[e("img",{style:{cursor:"pointer"},src:k,class:p.iconBack,onClick:()=>s.push({path:"/"})},null),e(B,{separator:""},{default:()=>[e(T,null,{default:()=>[C("曲目鉴赏")]})]})]}),e("div",{class:p.wrap},[e("div",{class:p.listWrap},[e(x,{defaultValue:"myResources",paneClass:p.paneTitle,justifyContent:"center",paneWrapperClass:p.paneWrapperContainer,value:n.tabValue,"onUpdate:value":c=>n.tabValue=c},lt(r=n.categoryList.map(c=>e(W,{name:"name-".concat(c.id),tab:c.name},{default:()=>[e(ct,{categoryId:c.id,categoryChildList:c.childrenList},null)]})))?r:{default:()=>[r]})])])])}}});export{mt as default};
|