index-8a15e1dc-1731319840132.js 5.8 KB

1
  1. import{i as S}from"./icon_back-c5ec0a72-1731319840132.js";import{d as g,e as p,q as h,f as a,x as _,j as y,k as f,u as C,E as T,w as I,aS as b,aT as W,t as L,v,D as N,S as E}from"./index-6198d9d3-1731319840132.js";import{T as G}from"./index-a0e01182-1731319840132.js";import{T as k}from"./index-eedcb178-1731319840132.js";import{P as V}from"./index-9710e333-1731319840132.js";import{a as B,b as x}from"./api-70d4d585-1731319840132.js";const j="_container_19grw_1",z="_iconBack_19grw_1",D="_separator_19grw_63",U="_wrap_19grw_68",O="_listWrap_19grw_73",R="_listWrapEmpty_19grw_79",l={container:j,iconBack:z,separator:D,wrap:U,listWrap:O,listWrapEmpty:R},F="_searchGroup_1d2i9_1",M="_btnType_1d2i9_5",P="_inputSearch_1d2i9_18",q="_searchCatatory_1d2i9_39",A="_addTrain_1d2i9_44",J="_list_1d2i9_56",$="_itemWrap_1d2i9_66",H="_itemWrapBox_1d2i9_71",K="_itemCard_1d2i9_79",Q="_itemImgSection_1d2i9_88",X="_itemTag_1d2i9_95",Y="_img_1d2i9_119",Z="_itemTitle_1d2i9_129",r={searchGroup:F,btnType:M,inputSearch:P,searchCatatory:q,addTrain:A,list:J,itemWrap:$,itemWrapBox:H,itemCard:K,itemImgSection:Q,itemTag:X,img:Y,itemTitle:Z},tt=g({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:d}){const i=p({keyword:s.searchValue||"",wikiCategoryId:s.wikiCategoryId||s.defaultWikiCategoryId||""}),n=()=>{d("search",i)};return h(async()=>{}),()=>a("div",{class:r.searchGroup},[a("div",{class:[r.searchCatatory]},[a(_,{size:"small",class:r.btnType},{default:()=>[s.categoryChildList.length>0?a(y,{type:i.wikiCategoryId===s.defaultWikiCategoryId?"primary":"default",secondary:i.wikiCategoryId!==s.defaultWikiCategoryId,round:!0,size:"small",focusable:!1,onClick:()=>{i.wikiCategoryId=s.defaultWikiCategoryId,n()}},{default:()=>[f("全部")]}):a("span",null,null),s.categoryChildList.map(t=>a(y,{type:i.wikiCategoryId===t.id?"primary":"default",secondary:i.wikiCategoryId!==t.id,round:!0,size:"small",focusable:!1,onClick:()=>{i.wikiCategoryId=t.id,n()}},{default:()=>[t.name]}))]}),a(G,{class:r.inputSearch,value:s.searchValue,placeholder:"请输入乐器名称",round:!0,onSearch:t=>{i.keyword=t,n()}},null)])])}}),at=g({name:"instrument-list",props:{categoryId:{type:String,default:""},categoryChildList:{type:Array,default:()=>[]}},setup(s){const d=(e="get",u="")=>{const c="content-instrument-catch";if(e==="get"){const m=sessionStorage.getItem(c);return m?JSON.parse(m):null}else e==="set"&&sessionStorage.setItem(c,u)},i=C(),n=d("get"),t=p({searchWord:"",loading:!1,pageTotal:0,pagination:n&&n.pagination?n.pagination:{page:1,rows:18},searchGroup:n&&n.searchGroup?n.searchGroup:{type:"INSTRUMENT",keyword:"",wikiCategoryId:s.categoryId},tableList:[],teachingStatus:!1,show:!1,item:{}}),o=async()=>{t.loading=!0,d("set",JSON.stringify({pagination:t.pagination,searchGroup:t.searchGroup}));try{const{data:e}=await B({...t.pagination,...t.searchGroup}),u=e.rows||[];u.forEach(c=>{c.knowledgeWikiCategories&&c.knowledgeWikiCategories.length&&(c.categories=c.knowledgeWikiCategories[0].knowledgeWikiCategoryTypeName)}),t.tableList=u||[],t.pageTotal=Number(e.total)}catch(e){}t.loading=!1},w=async e=>{t.pagination.page=1,t.searchGroup=Object.assign(t.searchGroup,e),o()};return h(()=>{o()}),()=>a("div",{class:r.instrumentList},[a(tt,{categoryChildList:s.categoryChildList||[],onSearch:e=>w(e),wikiCategoryId:t.searchGroup.wikiCategoryId,defaultWikiCategoryId:s.categoryId,searchValue:t.searchGroup.keyword},null),a(T,{show:t.loading,"onUpdate:show":e=>t.loading=e,style:{"min-height":"50vh"}},{default:()=>[a("div",{class:r.list},[t.tableList.map(e=>a("div",{class:r.itemWrap,onClick:()=>{i.push({path:"/content-instruments-detail",query:{id:e.id,name:e.name}})}},[a("div",{class:r.itemWrapBox},[a("div",{class:r.itemCard},[e.categories?a("span",{class:r.itemTag},[e.categories]):"",a("div",{class:r.itemImgSection},[a(I,{src:e.avatar+"?imageMogr2/strip/format/jpg/size-limit/15k!",class:r.img,objectFit:"cover",previewDisabled:!0},null)]),a("div",{class:r.itemTitle},[e.name])])])])),!t.loading&&t.tableList.length<=0&&a(k,{style:{minHeight:"50vh"},description:"暂无乐器百科"},null)])]}),a(V,{page:t.pagination.page,"onUpdate:page":e=>t.pagination.page=e,pageSize:t.pagination.rows,"onUpdate:pageSize":e=>t.pagination.rows=e,pageTotal:t.pageTotal,"onUpdate:pageTotal":e=>t.pageTotal=e,pageSizes:[18,24,30,36],onList:o},null)])}});function et(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!N(s)}const lt=g({name:"content-instrument",setup(){const s=sessionStorage.getItem("content-instrument-tab"),d=C(),i=p({tabValue:"",categoryList:[],loading:!1});return(async()=>{i.loading=!0;try{const{data:t}=await x({type:"INSTRUMENT",page:1,rows:99});i.categoryList=t.rows||[],i.categoryList.length&&E(()=>{i.tabValue=s||"name-"+i.categoryList[0].id})}catch(t){}i.loading=!1})(),()=>{let t;return a("div",{class:l.container},[a(_,{align:"center",wrapItem:!1,size:16},{default:()=>[a("img",{style:{cursor:"pointer"},src:S,class:l.iconBack,onClick:()=>d.push({path:"/"})},null),a(b,{separator:""},{default:()=>[a(W,null,{default:()=>[f("乐器百科")]})]})]}),a("div",{class:l.wrap},[a("div",{class:[l.listWrap,!i.loading&&i.categoryList.length<=0&&l.listWrapEmpty]},[!i.loading&&i.categoryList.length<=0&&a(k,{description:"暂无乐器百科"},null),a(L,{defaultValue:"myResources",paneClass:l.paneTitle,justifyContent:"center",paneWrapperClass:l.paneWrapperContainer,"onUpdate:value":[o=>{sessionStorage.setItem("content-instrument-tab",o),sessionStorage.removeItem("content-instrument-catch")},o=>i.tabValue=o],value:i.tabValue},et(t=i.categoryList.map(o=>a(v,{name:"name-".concat(o.id),tab:o.name},{default:()=>[a(at,{categoryId:o.id,categoryChildList:o.childrenList},null)]})))?t:{default:()=>[t]})])])])}}});export{lt as default};