index-e9ab656c-1724872791500.js 5.2 KB

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