index-383a6dae-1708220053196.js 6.4 KB

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