import{d as N,r as B,bm as ee,bn as te,X as M,ab as ae,bo as se,bp as oe,a as o,aa as R,a6 as A,bq as ne,au as T,N as re,br as le,aw as $,bs as ie,bt as ce,ad as de,bu as ue,P as H,af as X,aY as K,ag as D,aA as U,bv as F,ax as Y,W as pe,aD as he,ar as ve,b as fe,ak as me,bw as E,l as q,s as i,a4 as S,T as C,q as ge,j as we,H as _,bx as be,by as ye,g as W,I as xe,b9 as Ie,ba as je,Q as Se,K as Ae,Z as Ce,bb as _e}from"./App.03d0734f.js";import{g as Oe,s as a}from"./state.731c32e9.js";import{C as Pe,V as ke}from"./vip.af07eab2.js";import{M as Be}from"./music.b35eb5be.js";var[J,O]=R("dropdown-menu"),Q=Symbol(J),Ne={overlay:A,zIndex:[Number,String],activeColor:String,closeOnClickOutside:A,closeOnClickOverlay:A,duration:{type:[Number,String],default:.2},direction:{type:String,default:"down"}},Le=N({name:J,props:Ne,setup(e,{slots:t}){var r=B(),s=B(),l=B(0),{children:d,linkChildren:p}=ee(Q),m=te(r),g=M(()=>d.some(n=>n.state.showWrapper)),y=M(()=>{if(g.value&&ae(e.zIndex))return{zIndex:+e.zIndex+1}}),x=()=>{e.closeOnClickOutside&&d.forEach(n=>{n.toggle(!1)})},b=()=>{if(s.value){var n=ne(s);e.direction==="down"?l.value=n.bottom:l.value=window.innerHeight-n.top}},I=()=>{g.value&&b()},c=n=>{d.forEach((u,h)=>{h===n?(b(),u.toggle()):u.state.showPopup&&u.toggle(!1,{immediate:!0})})},f=(n,u)=>{var{showPopup:h}=n.state,{disabled:w,titleClass:j}=n;return o("div",{role:"button",tabindex:w?-1:0,class:O("item",{disabled:w}),onClick:()=>{w||c(u)}},[o("span",{class:[O("title",{down:h===(e.direction==="down"),active:h}),j],style:{color:h?e.activeColor:""}},[o("div",{class:"van-ellipsis"},[n.renderTitle()])])])};return p({props:e,offset:l}),se(r,x),oe("scroll",I,{target:m}),()=>o("div",{ref:r,class:O()},[o("div",{ref:s,style:y.value,class:O("bar",{opened:g.value})},[d.map(f)]),t.default==null?void 0:t.default()])}}),[Ve,P]=R("dropdown-item"),Re=N({name:Ve,props:{title:String,disabled:Boolean,teleport:[String,Object],lazyRender:A,modelValue:T,titleClass:T,options:{type:Array,default:()=>[]}},emits:["open","opened","close","closed","change","update:modelValue"],setup(e,{emit:t,slots:r}){var s=re({showPopup:!1,transition:!0,showWrapper:!1}),{parent:l}=le(Q);if(!!l){var d=n=>()=>t(n),p=d("open"),m=d("close"),g=d("opened"),y=()=>{s.showWrapper=!1,t("closed")},x=n=>{e.teleport&&n.stopPropagation()},b=(n=!s.showPopup,u={})=>{n!==s.showPopup&&(s.showPopup=n,s.transition=!u.immediate,n&&(s.showWrapper=!0))},I=()=>{if(r.title)return r.title();if(e.title)return e.title;var n=e.options.find(u=>u.value===e.modelValue);return n?n.text:""},c=n=>{var{activeColor:u}=l.props,h=n.value===e.modelValue,w=()=>{s.showPopup=!1,n.value!==e.modelValue&&(t("update:modelValue",n.value),t("change",n.value))};return o(K,{clickable:!0,key:n.value,icon:n.icon,title:n.text,class:P("option",{active:h}),style:{color:h?u:""},onClick:w},{default:()=>[h&&o(X,{class:P("icon"),color:u,name:"success"},null)]})},f=()=>{var{offset:n}=l,{zIndex:u,overlay:h,duration:w,direction:j,closeOnClickOverlay:G}=l.props,L=ce(u);return j==="down"?L.top=n.value+"px":L.bottom=n.value+"px",de(o("div",{style:L,class:P([j]),onClick:x},[o(H,{show:s.showPopup,"onUpdate:show":Z=>s.showPopup=Z,class:P("content"),overlay:h,position:j==="down"?"top":"bottom",duration:s.transition?w:0,lazyRender:e.lazyRender,overlayStyle:{position:"absolute"},closeOnClickOverlay:G,onOpen:p,onClose:m,onOpened:g,onClosed:y},{default:()=>[e.options.map(c),r.default==null?void 0:r.default()]})]),[[ue,s.showWrapper]])};return $({state:s,toggle:b,renderTitle:I}),()=>e.teleport?o(ie,{to:e.teleport},{default:()=>[f()]}):f()}}}),V=D(Re),z=D(Le),[De,k,Me]=R("search"),Te=N({name:De,props:U({},F,{label:String,clearable:A,actionText:String,background:String,showAction:Boolean,shape:{type:String,default:"square"},leftIcon:{type:String,default:"search"}}),emits:["search","cancel","update:modelValue"],setup(e,{emit:t,slots:r,attrs:s}){var l=B(),d=()=>{r.action||(t("update:modelValue",""),t("cancel"))},p=c=>{var f=13;c.keyCode===f&&(ve(c),t("search",e.modelValue))},m=()=>{if(r.label||e.label)return o("div",{class:k("label")},[r.label?r.label():e.label])},g=()=>{if(e.showAction){var c=e.actionText||Me("cancel");return o("div",{class:k("action"),role:"button",tabindex:0,onClick:d},[r.action?r.action():c])}},y=()=>{var c;return(c=l.value)==null?void 0:c.blur()},x=()=>{var c;return(c=l.value)==null?void 0:c.focus()},b=Object.keys(F),I=()=>{var c=U({},s,Y(e,b)),f=n=>t("update:modelValue",n);return o(he,pe({ref:l,type:"search",border:!1,onKeypress:p},c,{"onUpdate:modelValue":f}),Y(r,["left-icon","right-icon"]))};return $({focus:x,blur:y}),()=>o("div",{class:k({"show-action":e.showAction}),style:{background:e.background}},[r.left==null?void 0:r.left(),o("div",{class:k("content",e.shape)},[m(),I()]),g()])}}),Ue=D(Te),Fe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAqCAMAAAD26OlUAAAAdVBMVEUAAAAAwrYAwbQAw7QBwrUBwbYBwbYAwrYBwbUCwrYBwrYAwrcBwrYBwbUBwbUBwrUCwrUAw7cAwbgAwrcAwbUAxLsBwbUAwrYAwrUAwLQBwbQBwbUBwrYCwrYCwrYAw7YAwLUAwbUAv7gAv7cBwrYAysoBwbV4Ka+yAAAAJnRSTlMAQhMG8fv3guaojTnr3s/ImmtQRi0P1Xp2KPO+uKCTYllWJB65BHQbZOYAAAEHSURBVDjL7ZLLEoIwDEUphSIg74fiW9H+/yeaOIUpDWXYuOOu4M5pmpvG2fQnuc0KiN0SX0qRBvUylslR4cvOBVLXqbRxoSL2nvooluqFFYc4j18PfjXbnwTt4uH3LrC2OwNmyPXaQR+MyFIw1p0jGIKO9Ib9TRyegPUkILoVTZcTEDvitJszeV/MaHgdeK0JNmB6hleDl5KrcWzG1EqwLgRMwX1MrVwNkkbMpm3jkzMC1hJ0150rPhWf3x2hFTjY9ud1wn05cnUv1qM3q5CoJGBdXeZqJb14jix8achGVnudaSM76UZiwHYFxzwqOFXzzM9teokYH5P3jkXG8r6dVerYx9m0Rl+8riWqpDNy7wAAAABJRU5ErkJggg==";const Ye="_accompany_x19jj_1",Ee="_playIcon_x19jj_23",qe="_extra_x19jj_34",We="_song_x19jj_42",ze="_vipTip_x19jj_56",$e="_strong_x19jj_63",He="_search_x19jj_67",Xe="_search_btn_x19jj_143",Ke="_item_x19jj_157",Je="_title_x19jj_160",Qe="_iconSearch_x19jj_163",Ge="_iconMusic_x19jj_49",Ze="_hidden_x19jj_194",et="_searchSelect_x19jj_198",tt="_tags_x19jj_201",at="_icon_x19jj_49",st="_notice_x19jj_232";var v={accompany:Ye,playIcon:Ee,extra:qe,song:We,vipTip:ze,strong:$e,search:He,search_btn:Xe,item:Ke,title:Je,iconSearch:Qe,iconMusic:Ge,"icon-status":"_icon-status_x19jj_177","audio-container":"_audio-container_x19jj_185",hidden:Ze,searchSelect:et,tags:tt,icon:at,notice:st};const ot=Ce.parse(location.search);function nt(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!_e(e)}var dt=N({name:"music-list",data(){return{show:!0,isFirstLoad:!1,userinfo:null,isApp:fe().isApp,tempLevelId:0,chooseShow:!1,partNames:[],selectedPartName:"",selectedPartIndex:0,activeRow:null}},async mounted(){await this.initList()},methods:{async initList(){me(["_trackEvent","\u4E91\u6559\u7EC3","\u5207\u6362\u9875\u9762","\u5217\u8868\u9875\u9762"]);const e=Oe();for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(a[t]=e[t]);a.parentId=this.$route.params.id||1,await this.FetchLevel(),await this.FetchList()},async FetchLevel(){try{const e=sessionStorage.getItem("musicScoreList"),t=e?JSON.parse(e):[];let r=[];for(let s of t)s.id==a.parentId&&(r=s.sysMusicScoreCategoriesList||[]);if(a.levelOptions=[...r.map(s=>({value:s.id,text:s.name,childs:s.sysMusicScoreCategoriesList}))],a.levelOptions.length&&!a.levelId){a.levelId=a.levelOptions[0].value;const s=E.exports.find(a.levelOptions,{value:a.levelId});s&&(s.childs?(console.log(s,"showInfo"),a.typeOptions=[{value:0,text:"\u5168\u90E8"},...s.childs.map(l=>({value:l.id,text:l.name}))]):a.typeOptions=null)}}catch{}},async FetchCats(){try{const e=await q.get("/sysMusicScoreAccompaniment/querySubjectIds",{params:{categoriesId:this.$route.params.id||1}});i.subjectOptions=[{value:0,text:"\u5168\u90E8\u58F0\u90E8"},...e.data.filter(t=>!!t).map(t=>({value:t.id,text:t.name}))]}catch{}},async FetchList(){if(a.error=!1,a.loading)return;a.loading=!0,console.log(i.subjectOptions),S()!=="/api-student"&&await this.FetchCats(),S()==="/api-student"&&(i.subjectOptions=[...i.extSubjectIds.filter(t=>!!t).map(t=>({value:t.id,text:t.name}))]);const e=i.subjectOptions.map(t=>t.value).filter(t=>t>0);console.log(e,i.subjectId),e.includes(5)&&e.push(6),e.includes(i.subjectId)||(i.subjectId=0),console.log(i.subjectOptions);try{a.subjectId=i.subjectId;let t=a.params,r=this.$route.params.id,s=((a.levelId||a.typeId)===0?void 0:a.typeId||a.levelId)||r,l=i.subjectId===0?void 0:i.subjectId;S();const d=await q.get("/sysMusicScore/queryPage2",{params:{...t,clientType:"SMART_PRACTICE",subjectId:l,categoriesId:s,search:a.search}}),{data:p}=d;if(a.list.length>0&&p.pageNo==1)return;a.list=[...a.list,...p.rows],t.page>=Math.ceil(p.total/t.rows)&&(a.finished=!0),a.params.page=p.nextPage,a.list.length<=0&&(this.show=!1)}catch{a.error=!0}a.loading=!1},async getPartNames(e){const t=[];C({type:"loading",overlay:!0});try{const r=await ge.get(e,{mode:"cors"}),s=new DOMParser().parseFromString(r,"text/xml");for(const l of s.getElementsByTagName("part-name"))l.textContent&&t.push(l.textContent);C.clear()}catch{C.clear(),C("\u8BFB\u53D6\u5206\u8C31\u4FE1\u606F\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")}return t},openDetail(){var l,d,p;const e=this.activeRow,t=(l=e.rankIds)==null?void 0:l.split(","),r=String((p=(d=i.user)==null?void 0:d.student)==null?void 0:p.memberRankSettingId);if(e.rankIds&&i.user&&!t.includes(r)&&S()==="/api-student"){we.vipShow=!0;return}if(ot.mode==="select"){this.isApp&&_({api:"onAccompanySelectResult",content:{id:e.id,name:e.name,partIndex:this.selectedPartIndex}});return}const s="/detail/"+e.id+"?part-index="+this.selectedPartIndex;if(this.isApp)_({api:"openAccompanyWebView",content:{url:location.origin+"/accompany/#"+s,orientation:0,isHideTitle:!0,statusBarTextColor:!1,isOpenLight:!0}});else{const m=be("#"+s,{...this.$route.query});location.replace(m)}},async toDetail(e){this.activeRow=e,this.selectedPartName="",this.selectedPartIndex=0;const t=await this.getPartNames(e.xmlUrl);this.partNames=t,t.length>1?this.chooseShow=!0:(this.selectedPartName=t[0],this.openDetail())},onSelectedPartName(e){this.selectedPartIndex=e,this.chooseShow=!1,this.openDetail()},onPayVideo(e,t){e.stopPropagation(),_({api:"recordHomeworkVideo",content:{...t,partIndex:this.selectedPartIndex}})},openRecordingWebview(e,t){e.stopPropagation(),_({api:"recordHomeworkVideo",content:{id:t.id,partIndex:this.selectedPartIndex}})},onSearch(){a.params.page=1,a.list=[],this.show=!0,a.finished=!1,this.FetchList()},subjectChange(e){i.subjectId=e,this.onSearch()},onClickLeft(){this.$router.replace("/")}},render(){let e;return o("div",{class:v.accompany},[o(H,{show:this.chooseShow,teleport:"body",closeable:!0,style:{borderRadius:"8px"},onClickOverlay:()=>this.chooseShow=!1,onClickCloseIcon:()=>this.chooseShow=!1},{default:()=>[o(Pe,{partNames:this.partNames,onSelectedPartName:this.onSelectedPartName},null)]}),o(ye,null,{default:()=>[a.typeOptions||a.levelOptions&&a.levelOptions.length>0?o(z,{activeColor:"#01C1B5"},{default:()=>[a.levelOptions&&a.levelOptions.length>0?o(V,{modelValue:a.levelId,options:a.levelOptions,onChange:t=>{a.levelId=t,a.typeId=0;const r=E.exports.find(a.levelOptions,{value:t});r&&(r.childs?a.typeOptions=[{value:0,text:"\u5168\u90E8"},...r.childs.map(s=>({value:s.id,text:s.name}))]:a.typeOptions=null),this.onSearch()}},null):null,a.typeOptions?o(V,{class:v.searchSelect,"get-container":"#app",modelValue:a.typeId,options:a.typeOptions,onChange:t=>{a.typeId=t,this.onSearch()}},null):null]}):null,o(Ue,{class:[v.search],placeholder:"\u8BF7\u8F93\u5165\u641C\u7D22\u5173\u952E\u8BCD",modelValue:a.search,background:"#F8F9FC","onUpdate:model-value":t=>a.search=t,showAction:!0,onSearch:this.onSearch},{"left-icon":()=>o("img",{class:v.iconSearch,src:Fe},null),label:()=>S()=="/api-student"&&i.subjectOptions&&i.subjectOptions.length===1?null:o(z,{activeColor:"#01C1B5",onClick:t=>{t.preventDefault()}},{default:()=>[o(V,{class:v.searchSelect,"get-container":"#app",modelValue:i.subjectId,options:i.subjectOptions,onChange:t=>{i.subjectId=t,this.onSearch()}},null)]}),action:()=>o("span",{class:v.search_btn,onClick:this.onSearch},[W("\u641C\u7D22")])})]}),o("div",{class:xe(v.accompanyList,v.song)},[this.show?o(Ie,{loading:a.loading,finishedText:"\u52A0\u8F7D\u5B8C\u6BD5",error:a.error,offset:100,finished:a.finished,immediateCheck:!1,onLoad:this.FetchList},{default:()=>[o(je,null,nt(e=a.list.map(t=>o(K,{size:"large",onClick:()=>this.toDetail(t)},{icon:()=>o("div",{class:v["icon-status"]},[o(X,{class:v.iconMusic,name:Be},null),t.rankIds?o("div",{class:v.icon},[o("img",{src:ke},null)]):null]),title:()=>o(Se,{background:"none",color:"#444",style:{paddingLeft:(t.rankIds?"4PX":"15PX")+"!important"},text:t.name,key:"notactive"},null)})))?e:{default:()=>[e]})],error:()=>o("span",{onClick:this.FetchList},[W("\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u70B9\u51FB\u91CD\u8BD5")])}):o(Ae,{description:"\u6682\u65E0\u6570\u636E"},null)])])}});export{dt as default};