1 |
- import{d as A,ah as L,ag as k,R as x,r as O,y as m,$ as T,c as i,aj as V,a5 as b,ak as I,al as R,m as l,g as p,_ as U,e as j}from"./index.1c621181.js";import{O as q}from"./index.b0685ec5.js";import{g as D,s as u}from"./index.module.c5e86b95.js";import{O as H}from"./index.b491c24a.js";import{O as M}from"./index.944c4ba2.js";import{D as N,a as f}from"./index.b1f8d369.js";import{L as _}from"./index.d5ee0b18.js";import{C as $}from"./index.2db9d877.js";import{C as z}from"./index.fd5ae97b.js";import"./index.c7a20c76.js";import"./use-tab-status.40058c51.js";function E(r){return typeof r=="function"||Object.prototype.toString.call(r)==="[object Object]"&&!R(r)}var te=A({name:"accompany-music-list",props:{musicTree:{type:Array,default:()=>[]}},setup(r,G){const c=L();k();const g=D("icon-music.svg"),h=x({}),e=O({loading:!1,finished:!1,refreshing:!1,musicTree:[],pagenation:{page:1,rows:20},value1:null,value2:null,PopoverOpen:!1,list:[],keyword:""}),y=async()=>{try{const a=await l.get(p.platformApi+"/musicSheetCategories/queryTree?enable=true");Array.isArray(a==null?void 0:a.data)&&(e.musicTree=a.data),U(()=>{n()})}catch(a){console.log(a)}},v=async()=>{try{const a=await l.get("/api-student/student/member");h.value=a.data||{}}catch{}},C=m(()=>{const a=e.musicTree.find(t=>t.id==c.query.categorieid);return Array.isArray(a==null?void 0:a.musicSheetCategoriesList)?a.musicSheetCategoriesList.map(s=>(e.value1||(e.value1=s.id,e.value2=null),{text:s.name,value:s.id})):[]}),w=m(()=>{const a=e.musicTree.find(t=>t.id==c.query.categorieid);if(Array.isArray(a==null?void 0:a.musicSheetCategoriesList)){const t=a.musicSheetCategoriesList.find(s=>s.id==e.value1);if(Array.isArray(t==null?void 0:t.musicSheetCategoriesList))return[{text:"\u5168\u90E8",value:null}].concat(t.musicSheetCategoriesList.map(d=>({text:d.name,value:d.id})))}return[{text:"\u5168\u90E8",value:null}]}),n=async()=>{var a;if(!e.loading){e.loading=!0;try{const t=await l.post(p.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}},o=()=>{e.pagenation.page=1,e.list=[],e.finished=!1,e.list=[],n()},S=a=>{let t=`${location.origin}/orchestra-music-score/?id=${a.id}`;j({api:"openAccompanyWebView",content:{url:t,orientation:0,isHideTitle:!0,statusBarTextColor:!1,isOpenLight:!0}})};return T(()=>{v(),y()}),()=>{let a;return i("div",{class:u["accompany-music-list"]},[i(H,{mode:"sticky",class:u.heade,onGetHeight:t=>{document.documentElement.style.setProperty("--header-height",t+"px")}},{default:()=>[i(V,{border:!1},null),i("div",null,[i(N,{activeColor:"var(--van-primary)"},{default:()=>[i(f,{modelValue:e.value1,"onUpdate:modelValue":t=>e.value1=t,options:C.value,onChange:t=>{e.value2=null,o()}},null),i(f,{modelValue:e.value2,"onUpdate:modelValue":t=>e.value2=t,options:w.value,onChange:()=>o()},null)]}),i("div",{class:u.filter},[i(M,{style:{width:"100%"},background:"transparent",onSearch:t=>{e.keyword=t,o()}},null)])])]}),i(q,{modelValue:e.refreshing,"onUpdate:modelValue":t=>e.refreshing=t,onRefresh:o,style:"min-height: calc(100vh - var(--header-height))"},{default:()=>[i(_,{"loading-text":" ",immediateCheck:!1,loading:e.loading,finished:e.finished,"onUpdate:finished":t=>e.finished=t,finishedText:" ",onLoad:()=>{n()}},{default:()=>[i($,{inset:!0},E(a=e.list.map(t=>i(z,{size:"large",center:!0,title:t.musicSheetName,isLink:!0,onClick:()=>S(t)},{icon:()=>i(b,{style:{marginRight:"12px"},size:40,name:g},null)})))?a:{default:()=>[a]})]}),!e.loading&&!e.list.length&&i(I,{tips:"\u6682\u65E0\u66F2\u8C31"},null)]})])}}});export{te as default};
|