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