music-list.31150d21.js 7.1 KB

1
  1. import{t as E,d as R,Q as H,R as x,x as B,an as K,y as I,a1 as F,bj as G,a0 as Q,c as n,v as A,z as Y,w as Z,u as J,ay as X,am as ee,aR as te,r as W,C as ae,W as oe,bK as se,aw as ne,O as $,aU as re,ac as ie,aQ as le,P as ce,E as ue,a5 as _,D as U,aV as de,ag as pe,$ as me,ai as fe,ak as he,m as T,f as z,_ as ge,k as ve}from"./index.ffe80dbe.js";import{O as ye}from"./index.45b38760.js";import{g as we,s as L}from"./index.module.c5e86b95.js";import{O as Ce}from"./index.4ddd16f0.js";import{O as ke}from"./index.c7af3af2.js";import{C as N}from"./index.ea031708.js";import{L as Oe}from"./index.cafcb8b5.js";import{C as be}from"./index.914765a1.js";import"./index.92ec0bf4.js";import"./use-tab-status.5a3cd090.js";const[j,P]=E("dropdown-menu"),Pe={overlay:A,zIndex:Y,duration:Z(.2),direction:J("down"),activeColor:String,closeOnClickOutside:A,closeOnClickOverlay:A},M=Symbol(j);var Se=R({name:j,props:Pe,setup(s,{slots:p}){const u=H(),h=x(),i=x(),e=x(0),{children:m,linkChildren:g}=B(M),C=K(h),v=I(()=>m.some(r=>r.state.showWrapper)),y=I(()=>{if(v.value&&F(s.zIndex))return{zIndex:+s.zIndex+1}}),f=()=>{s.closeOnClickOutside&&m.forEach(r=>{r.toggle(!1)})},w=()=>{if(i.value){const r=ee(i);s.direction==="down"?e.value=r.bottom:e.value=te.value-r.top}},a=()=>{v.value&&w()},t=r=>{m.forEach((o,l)=>{l===r?(w(),o.toggle()):o.state.showPopup&&o.toggle(!1,{immediate:!0})})},d=(r,o)=>{const{showPopup:l}=r.state,{disabled:c,titleClass:k}=r;return n("div",{id:`${u}-${o}`,role:"button",tabindex:c?void 0:0,class:[P("item",{disabled:c}),{[X]:!c}],onClick:()=>{c||t(o)}},[n("span",{class:[P("title",{down:l===(s.direction==="down"),active:l}),k],style:{color:l?s.activeColor:""}},[n("div",{class:"van-ellipsis"},[r.renderTitle()])])])};return g({id:u,props:s,offset:e}),G(h,f),Q("scroll",a,{target:C,passive:!0}),()=>{var r;return n("div",{ref:h,class:P()},[n("div",{ref:i,style:y.value,class:P("bar",{opened:v.value})},[m.map(d)]),(r=p.default)==null?void 0:r.call(p)])}}});const[xe,S]=E("dropdown-item"),Ae={title:String,options:ne(),disabled:Boolean,teleport:[String,Object],lazyRender:A,modelValue:$,titleClass:$};var Ie=R({name:xe,inheritAttrs:!1,props:Ae,emits:["open","opened","close","closed","change","update:modelValue"],setup(s,{emit:p,slots:u,attrs:h}){const i=W({showPopup:!1,transition:!0,showWrapper:!1}),{parent:e,index:m}=ae(M);if(!e){console.error("[Vant] <DropdownItem> must be a child component of <DropdownMenu>.");return}const g=o=>()=>p(o),C=g("open"),v=g("close"),y=g("opened"),f=()=>{i.showWrapper=!1,p("closed")},w=o=>{s.teleport&&o.stopPropagation()},a=(o=!i.showPopup,l={})=>{o!==i.showPopup&&(i.showPopup=o,i.transition=!l.immediate,o&&(i.showWrapper=!0))},t=()=>{if(u.title)return u.title();if(s.title)return s.title;const o=s.options.find(l=>l.value===s.modelValue);return o?o.text:""},d=o=>{const{activeColor:l}=e.props,c=o.value===s.modelValue,k=()=>{i.showPopup=!1,o.value!==s.modelValue&&(p("update:modelValue",o.value),p("change",o.value))},O=()=>{if(c)return n(_,{class:S("icon"),color:l,name:"success"},null)};return n(N,{role:"menuitem",key:o.value,icon:o.icon,title:o.text,class:S("option",{active:c}),style:{color:c?l:""},tabindex:c?0:-1,clickable:!0,onClick:k},{value:O})},r=()=>{const{offset:o}=e,{zIndex:l,overlay:c,duration:k,direction:O,closeOnClickOverlay:q}=e.props,V=re(l);return O==="down"?V.top=`${o.value}px`:V.bottom=`${o.value}px`,ie(n("div",ue({style:V,class:S([O]),onClick:w},h),[n(ce,{show:i.showPopup,"onUpdate:show":b=>i.showPopup=b,role:"menu",class:S("content"),overlay:c,position:O==="down"?"top":"bottom",duration:i.transition?k:0,lazyRender:s.lazyRender,overlayStyle:{position:"absolute"},"aria-labelledby":`${e.id}-${m.value}`,closeOnClickOverlay:q,onOpen:C,onClose:v,onOpened:y,onClosed:f},{default:()=>{var b;return[s.options.map(d),(b=u.default)==null?void 0:b.call(u)]}})]),[[le,i.showWrapper]])};return oe({state:i,toggle:a,renderTitle:t}),()=>s.teleport?n(se,{to:s.teleport},{default:()=>[r()]}):r()}});const D=U(Ie),Ve=U(Se);function Te(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!he(s)}var je=R({name:"accompany-music-list",props:{musicTree:{type:Array,default:()=>[]}},setup(s,p){const u=de();pe();const h=we("icon-music.svg"),i=x({}),e=W({loading:!1,finished:!1,refreshing:!1,musicTree:[],pagenation:{page:1,rows:20},value1:null,value2:null,PopoverOpen:!1,list:[],keyword:""}),m=async()=>{try{const a=await T.get(z.platformApi+"/musicSheetCategories/queryTree?enable=true");Array.isArray(a==null?void 0:a.data)&&(e.musicTree=a.data),ge(()=>{y()})}catch(a){console.log(a)}},g=async()=>{try{const a=await T.get("/api-student/student/member");i.value=a.data||{}}catch{}},C=I(()=>{const a=e.musicTree.find(t=>t.id==u.query.categorieid);return Array.isArray(a==null?void 0:a.musicSheetCategoriesList)?a.musicSheetCategoriesList.map(d=>(e.value1||(e.value1=d.id,e.value2=null),{text:d.name,value:d.id})):[]}),v=I(()=>{const a=e.musicTree.find(t=>t.id==u.query.categorieid);if(Array.isArray(a==null?void 0:a.musicSheetCategoriesList)){const t=a.musicSheetCategoriesList.find(d=>d.id==e.value1);if(Array.isArray(t==null?void 0:t.musicSheetCategoriesList))return[{text:"\u5168\u90E8",value:null}].concat(t.musicSheetCategoriesList.map(r=>({text:r.name,value:r.id})))}return[{text:"\u5168\u90E8",value:null}]}),y=async()=>{var a;if(!e.loading){e.loading=!0;try{const t=await T.post(z.platformApi+"/musicSheet/page",{data:{...e.pagenation,keyword:e.keyword,musicSheetCategoriesId:e.value2||e.value1},hideLoading:!0});Array.isArray((a=t==null?void 0:t.data)==null?void 0:a.rows)?(e.list=[].concat(e.list,t.data.rows),e.pagenation.page+=1,e.finished=!t.data.rows.length):e.finished=!0}catch{e.finished=!0}e.loading=!1,e.refreshing=!1}},f=()=>{e.pagenation.page=1,e.list=[],e.finished=!1,e.list=[],y()},w=a=>{let t=`${location.origin}/orchestra-music-score/?id=${a.id}`;ve({api:"openAccompanyWebView",content:{url:t,orientation:0,isHideTitle:!0,statusBarTextColor:!1,isOpenLight:!0}})};return me(()=>{g(),m()}),()=>{let a;return n("div",{class:L["accompany-music-list"]},[n(Ce,{mode:"sticky",class:L.heade,onGetHeight:t=>{document.documentElement.style.setProperty("--header-height",t+"px")}},{default:()=>[n("div",null,[n(Ve,{activeColor:"var(--van-primary)"},{default:()=>[n(D,{modelValue:e.value1,"onUpdate:modelValue":t=>e.value1=t,options:C.value,onChange:t=>{e.value2=null,f()}},null),n(D,{modelValue:e.value2,"onUpdate:modelValue":t=>e.value2=t,options:v.value,onChange:()=>f()},null)]}),n("div",{class:L.filter},[n(ke,{style:{width:"100%"},background:"transparent",onSearch:t=>{e.keyword=t,f()}},null)])])]}),n(ye,{modelValue:e.refreshing,"onUpdate:modelValue":t=>e.refreshing=t,onRefresh:f,style:"min-height: calc(100vh - var(--header-height))"},{default:()=>[n(Oe,{"loading-text":" ",immediateCheck:!1,loading:e.loading,finished:e.finished,"onUpdate:finished":t=>e.finished=t,finishedText:" ",onLoad:()=>{y()}},{default:()=>[n(be,{inset:!0},Te(a=e.list.map(t=>n(N,{size:"large",center:!0,title:t.musicSheetName,isLink:!0,onClick:()=>w(t)},{icon:()=>n(_,{style:{marginRight:"12px"},size:40,name:h},null)})))?a:{default:()=>[a]})]}),!e.loading&&!e.list.length&&n(fe,{tips:"\u6682\u65E0\u66F2\u8C31"},null)]})])}}});export{je as default};