1 |
- import{i as I}from"./icon_back-c5ec0a72-1720699367816.js";import{d as C,e as f,U as S,f as e,x as m,j as _,k as w,F as v,aC as B,D as k,u as b,q as T,E as x,aQ as W,aR as N,t as E,v as A,S as F}from"./index-b48b51d2-1720699367816.js";import{T as D}from"./index-876d8b60-1720699367816.js";import{T as L}from"./index-a2dc20f3-1720699367816.js";import{P as G}from"./index-3d012fb0-1720699367816.js";import{i as U}from"./icon_default-d1bcaf5f-1720699367816.js";import{a as V,b as j}from"./api-b5ee56f7-1720699367816.js";const z="_container_19grw_1",O="_iconBack_19grw_1",P="_separator_19grw_63",R="_wrap_19grw_68",M="_listWrap_19grw_73",$="_listWrapEmpty_19grw_79",p={container:z,iconBack:O,separator:P,wrap:R,listWrap:M,listWrapEmpty:$},q="_searchGroup_d4241_1",H="_btnType_d4241_5",Q="_inputSearch_d4241_18",J="_searchCatatory_d4241_39",K="_border_d4241_44",X="_addTrain_d4241_48",Y="_list_d4241_60",Z="_itemWrap_d4241_70",tt="_itemWrapBox_d4241_77",et="_itemCard_d4241_85",at="_musicBg_d4241_103",it="_itemName_d4241_109",st="_btn_d4241_5",ot="_iconArrow_d4241_139",nt="_popSelect_d4241_147",rt="_spaceSection_d4241_157",lt="_textBtn_d4241_160",ct="_textBtnActive_d4241_180",s={searchGroup:q,btnType:H,inputSearch:Q,searchCatatory:J,border:K,addTrain:X,list:Y,itemWrap:Z,itemWrapBox:tt,itemCard:et,musicBg:at,itemName:it,btn:st,iconArrow:ot,popSelect:nt,spaceSection:rt,textBtn:lt,textBtnActive:ct};function dt(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!k(o)}const pt=C({name:"search-group",props:{categoryChildList:{type:Array,default:()=>[]},wikiCategoryId:{type:String,default:""}},emits:["search","add"],expose:["init"],setup(o,{emit:u}){const t=f({keyword:"",wikiCategoryId:o.wikiCategoryId||"",wikiCategoryIdChild:"",childIds:[]}),l=()=>{u("search",t)},n=(c,i)=>{const r={};return c==null||c.forEach(d=>{d.id===t.wikiCategoryIdChild&&(r.selected=!0,r.name=d.name)}),r},a=S(()=>{const i=(o.categoryChildList||[]).find(r=>r.id===t.wikiCategoryId);if(i&&i.childrenList.length){const r=[];return i.childrenList.forEach(d=>{const y=d.childrenList,h=[];y&&y.length>0&&(h.push({label:"全部",value:d.id,name:d.name,id:d.id}),y.forEach(g=>{h.push({label:g.name,value:g.id,name:g.name,id:g.id})})),r.push({...d,childrenList:h})}),[{label:"全部",value:"",id:"",name:"全部",childrenList:[]},...r]}return[]});return()=>{let c;return e("div",{class:s.searchGroup},[e("div",{class:[s.searchCatatory,a.value.length>0?s.border:""]},[e(m,{size:"small",class:s.btnType},{default:()=>[o.categoryChildList.length>0?e(_,{type:t.wikiCategoryId===o.wikiCategoryId?"primary":"default",secondary:t.wikiCategoryId!==o.wikiCategoryId,round:!0,size:"small",focusable:!1,onClick:()=>{t.wikiCategoryId=o.wikiCategoryId,t.wikiCategoryIdChild="",l()}},{default:()=>[w("全部")]}):e("span",null,null),o.categoryChildList.map(i=>e(_,{type:t.wikiCategoryId===i.id?"primary":"default",secondary:t.wikiCategoryId!==i.id,round:!0,size:"small",focusable:!1,onClick:()=>{t.wikiCategoryId=i.id,l()}},{default:()=>[i.name]}))]}),e(D,{class:s.inputSearch,placeholder:"请输入曲目名称",round:!0,onSearch:i=>{t.keyword=i,l()}},null)]),a.value.length>0&&e("div",{class:[s.collapseWrap]},[e(m,{class:[s.spaceSection]},dt(c=a.value.map((i,r)=>e(v,null,[i.childrenList.length>0?e(B,{options:i.childrenList,trigger:"hover",value:t.wikiCategoryIdChild,"onUpdate:value":[d=>t.wikiCategoryIdChild=d,()=>{l()}],key:i.id,class:s.popSelect},{default:()=>[e("span",{class:[s.textBtn,n(i.childrenList).selected&&s.textBtnActive]},[n(i.childrenList).name||i.name,e("i",{class:s.iconArrow},null)])]}):e("span",{class:[s.textBtn,t.wikiCategoryIdChild===i.id&&s.textBtnActive],onClick:()=>{t.wikiCategoryIdChild=i.id,l()}},[i.name])])))?c:{default:()=>[c]})])])}}}),ut=C({name:"music-list",props:{categoryId:{type:String,default:""},categoryChildList:{type:Array,default:()=>[]}},setup(o){const u=b(),t=f({searchWord:"",loading:!1,pageTotal:0,pagination:{page:1,rows:18},searchGroup:{type:"MUSIC",keyword:"",wikiCategoryId:o.categoryId},tableList:[],teachingStatus:!1,show:!1,item:{}}),l=async()=>{t.loading=!0;try{const{data:a}=await V({...t.pagination,...t.searchGroup});t.tableList=a.rows||[],t.pageTotal=Number(a.total)}catch(a){}t.loading=!1},n=async a=>{t.pagination.page=1;const{wikiCategoryIdChild:c,wikiCategoryId:i,keyword:r}=a;t.searchGroup=Object.assign(t.searchGroup,{wikiCategoryId:c||i,keyword:r}),l()};return T(()=>{l()}),()=>e("div",{class:s.instrumentList},[e(pt,{categoryChildList:o.categoryChildList||[],wikiCategoryId:o.categoryId,onSearch:a=>n(a)},null),e(x,{show:t.loading,"onUpdate:show":a=>t.loading=a,style:{"min-height":"50vh"}},{default:()=>[e("div",{class:s.list},[t.tableList.map(a=>e("div",{class:s.itemWrap,onClick:()=>{u.push({path:"/content-music-detail",query:{id:a.id,name:a.name}})}},[e("div",{class:s.itemWrapBox},[e("div",{class:s.itemCard},[e("div",{class:s.itemName},[e("img",{src:a.avatar||U,class:s.musicBg},null),e("span",{class:s.name},[a.name])]),e(_,{class:s.btn,round:!0,type:"primary"},{default:()=>[w("播放"),e("i",{class:s.iconArrow},null)]})])])])),!t.loading&&t.tableList.length<=0&&e(L,{style:{minHeight:"50vh"},description:"暂无名曲鉴赏"},null)])]}),e(G,{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,pageSizes:[18,24,30,36],onList:l},null)])}});function gt(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!k(o)}const kt=C({name:"content-music",setup(){const o=sessionStorage.getItem("content-music-tab"),u=b(),t=f({tabValue:"",categoryList:[],loading:!1});return(async()=>{t.loading=!0;try{const{data:n}=await j({type:"MUSIC",page:1,rows:99});t.categoryList=n.rows||[],t.categoryList.length&&F(()=>{t.tabValue=o||"name-"+t.categoryList[0].id})}catch(n){}t.loading=!1})(),()=>{let n;return e("div",{class:p.container},[e(m,{align:"center",wrapItem:!1,size:16},{default:()=>[e("img",{style:{cursor:"pointer"},src:I,class:p.iconBack,onClick:()=>u.push({path:"/"})},null),e(W,{separator:""},{default:()=>[e(N,null,{default:()=>[w("名曲鉴赏")]})]})]}),e("div",{class:p.wrap},[e("div",{class:[p.listWrap,!t.loading&&t.categoryList.length<=0&&p.listWrapEmpty]},[!t.loading&&t.categoryList.length<=0&&e(L,{description:"暂无名曲鉴赏"},null),e(E,{defaultValue:"myResources",paneClass:p.paneTitle,justifyContent:"center",paneWrapperClass:p.paneWrapperContainer,value:t.tabValue,"onUpdate:value":[a=>t.tabValue=a,a=>{console.log(a,"val"),sessionStorage.setItem("content-music-tab",a)}]},gt(n=t.categoryList.map(a=>e(A,{name:"name-".concat(a.id),tab:a.name},{default:()=>[e(ut,{categoryId:a.id,categoryChildList:a.childrenList},null)]})))?n:{default:()=>[n]})])])])}}});export{kt as default};
|