index-25296d28.js 13 KB

1
  1. import{C as $,m as T,F as ee,l as U,s as te,S as ae,j as se,L as ne,k as oe,N as ie}from"./index-f53ab261.js";import{v as re,b as le,l as ce,s as l,g as S,t as de,q as ue}from"./utils-8747c988.js";import{u as pe,n as ve,t as he,s as fe,v as me,b as ge,P as H,c as K,k as we,r as D,T as A,a as _e,z as j}from"./request-9a0f9c1d.js";import{g as ye,s as a}from"./state-a1f4c50e.js";import{C as be,V as xe}from"./vip-3c0fff4a.js";import{M as Ie}from"./music-d9a14675.js";import{d as L,K as B,G as F,c as n,A as Se,V as Ce,U as Ae,W as je,M as E,S as Oe}from"./runtime-core.esm-bundler-8a997806.js";import{c as R,t as C,i as Pe,u as Y,I as X,g as ke,w as M,e as q,p as z}from"./index-ea32d722.js";import{E as Be}from"./index-e1d206b5.js";import"./_commonjsHelpers-edff4021.js";var[G,O]=R("dropdown-menu"),J=Symbol(G),Le={overlay:C,zIndex:[Number,String],activeColor:String,closeOnClickOutside:C,closeOnClickOverlay:C,duration:{type:[Number,String],default:.2},direction:{type:String,default:"down"}};const Ne=L({name:G,props:Le,setup(e,{slots:t}){var i=B(),s=B(),r=B(0),{children:d,linkChildren:p}=pe(J),m=ve(i),g=F(()=>d.some(o=>o.state.showWrapper)),y=F(()=>{if(g.value&&Pe(e.zIndex))return{zIndex:+e.zIndex+1}}),b=()=>{e.closeOnClickOutside&&d.forEach(o=>{o.toggle(!1)})},_=()=>{if(s.value){var o=me(s);e.direction==="down"?r.value=o.bottom:r.value=window.innerHeight-o.top}},x=()=>{g.value&&_()},c=o=>{d.forEach((u,v)=>{v===o?(_(),u.toggle()):u.state.showPopup&&u.toggle(!1,{immediate:!0})})},f=(o,u)=>{var{showPopup:v}=o.state,{disabled:w,titleClass:I}=o;return n("div",{role:"button",tabindex:w?-1:0,class:O("item",{disabled:w}),onClick:()=>{w||c(u)}},[n("span",{class:[O("title",{down:v===(e.direction==="down"),active:v}),I],style:{color:v?e.activeColor:""}},[n("div",{class:"van-ellipsis"},[o.renderTitle()])])])};return p({props:e,offset:r}),he(i,b),fe("scroll",x,{target:m}),()=>n("div",{ref:i,class:O()},[n("div",{ref:s,style:y.value,class:O("bar",{opened:g.value})},[d.map(f)]),t.default==null?void 0:t.default()])}});var[Ve,P]=R("dropdown-item");const Re=L({name:Ve,props:{title:String,disabled:Boolean,teleport:[String,Object],lazyRender:C,modelValue:Y,titleClass:Y,options:{type:Array,default:()=>[]}},emits:["open","opened","close","closed","change","update:modelValue"],setup(e,{emit:t,slots:i}){var s=Se({showPopup:!1,transition:!0,showWrapper:!1}),{parent:r}=ge(J);if(r){var d=o=>()=>t(o),p=d("open"),m=d("close"),g=d("opened"),y=()=>{s.showWrapper=!1,t("closed")},b=o=>{e.teleport&&o.stopPropagation()},_=(o=!s.showPopup,u={})=>{o!==s.showPopup&&(s.showPopup=o,s.transition=!u.immediate,o&&(s.showWrapper=!0))},x=()=>{if(i.title)return i.title();if(e.title)return e.title;var o=e.options.find(u=>u.value===e.modelValue);return o?o.text:""},c=o=>{var{activeColor:u}=r.props,v=o.value===e.modelValue,w=()=>{s.showPopup=!1,o.value!==e.modelValue&&(t("update:modelValue",o.value),t("change",o.value))};return n($,{clickable:!0,key:o.value,icon:o.icon,title:o.text,class:P("option",{active:v}),style:{color:v?u:""},onClick:w},{default:()=>[v&&n(X,{class:P("icon"),color:u,name:"success"},null)]})},f=()=>{var{offset:o}=r,{zIndex:u,overlay:v,duration:w,direction:I,closeOnClickOverlay:Q}=r.props,N=ke(u);return I==="down"?N.top=o.value+"px":N.bottom=o.value+"px",Ae(n("div",{style:N,class:P([I]),onClick:b},[n(H,{show:s.showPopup,"onUpdate:show":Z=>s.showPopup=Z,class:P("content"),overlay:v,position:I==="down"?"top":"bottom",duration:s.transition?w:0,lazyRender:e.lazyRender,overlayStyle:{position:"absolute"},closeOnClickOverlay:Q,onOpen:p,onClose:m,onOpened:g,onClosed:y},{default:()=>[e.options.map(c),i.default==null?void 0:i.default()]})]),[[re,s.showWrapper]])};return K({state:s,toggle:_,renderTitle:x}),()=>e.teleport?n(Ce,{to:e.teleport},{default:()=>[f()]}):f()}}});var V=M(Re),W=M(Ne),[Me,k,Te]=R("search");const Ue=L({name:Me,props:q({},T,{label:String,clearable:C,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:i,attrs:s}){var r=B(),d=()=>{i.action||(t("update:modelValue",""),t("cancel"))},p=c=>{var f=13;c.keyCode===f&&(we(c),t("search",e.modelValue))},m=()=>{if(i.label||e.label)return n("div",{class:k("label")},[i.label?i.label():e.label])},g=()=>{if(e.showAction){var c=e.actionText||Te("cancel");return n("div",{class:k("action"),role:"button",tabindex:0,onClick:d},[i.action?i.action():c])}},y=()=>{var c;return(c=r.value)==null?void 0:c.blur()},b=()=>{var c;return(c=r.value)==null?void 0:c.focus()},_=Object.keys(T),x=()=>{var c=q({},s,z(e,_)),f=o=>t("update:modelValue",o);return n(ee,je({ref:r,type:"search",border:!1,onKeypress:p},c,{"onUpdate:modelValue":f}),z(i,["left-icon","right-icon"]))};return K({focus:b,blur:y}),()=>n("div",{class:k({"show-action":e.showAction}),style:{background:e.background}},[i.left==null?void 0:i.left(),n("div",{class:k("content",e.shape)},[m(),x()]),g()])}});var De=M(Ue);const Fe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAqCAMAAAD26OlUAAAAdVBMVEUAAAAAwrYAwbQAw7QBwrUBwbYBwbYAwrYBwbUCwrYBwrYAwrcBwrYBwbUBwbUBwrUCwrUAw7cAwbgAwrcAwbUAxLsBwbUAwrYAwrUAwLQBwbQBwbUBwrYCwrYCwrYAw7YAwLUAwbUAv7gAv7cBwrYAysoBwbV4Ka+yAAAAJnRSTlMAQhMG8fv3guaojTnr3s/ImmtQRi0P1Xp2KPO+uKCTYllWJB65BHQbZOYAAAEHSURBVDjL7ZLLEoIwDEUphSIg74fiW9H+/yeaOIUpDWXYuOOu4M5pmpvG2fQnuc0KiN0SX0qRBvUylslR4cvOBVLXqbRxoSL2nvooluqFFYc4j18PfjXbnwTt4uH3LrC2OwNmyPXaQR+MyFIw1p0jGIKO9Ib9TRyegPUkILoVTZcTEDvitJszeV/MaHgdeK0JNmB6hleDl5KrcWzG1EqwLgRMwX1MrVwNkkbMpm3jkzMC1hJ0150rPhWf3x2hFTjY9ud1wn05cnUv1qM3q5CoJGBdXeZqJb14jix8achGVnudaSM76UZiwHYFxzwqOFXzzM9teokYH5P3jkXG8r6dVerYx9m0Rl+8riWqpDNy7wAAAABJRU5ErkJggg==",Ee="_accompany_jdvsx_1",Ye="_playIcon_jdvsx_23",qe="_extra_jdvsx_34",ze="_song_jdvsx_42",We="_playing_jdvsx_45",$e="_iconMusic_jdvsx_49",He="_spin_jdvsx_1",Ke="_active_jdvsx_53",Xe="_vipTip_jdvsx_56",Ge="_strong_jdvsx_63",Je="_search_jdvsx_67",Qe="_search_btn_jdvsx_143",Ze="_item_jdvsx_153",et="_title_jdvsx_156",tt="_iconSearch_jdvsx_163",at="_hidden_jdvsx_194",st="_searchSelect_jdvsx_198",nt="_tags_jdvsx_201",ot="_icon_jdvsx_49",it="_notice_jdvsx_232",h={accompany:Ee,"van-tab":"_van-tab_jdvsx_17","van-tab--active":"_van-tab--active_jdvsx_20",playIcon:Ye,extra:qe,song:ze,"van-cell":"_van-cell_jdvsx_42",playing:We,iconMusic:$e,spin:He,active:Ke,vipTip:Xe,strong:Ge,search:Je,"van-field__left-icon":"_van-field__left-icon_jdvsx_71","van-search__content":"_van-search__content_jdvsx_75","van-search__action":"_van-search__action_jdvsx_81",search_btn:Qe,item:Ze,title:et,iconSearch:tt,"van-icon__image":"_van-icon__image_jdvsx_167","icon-status":"_icon-status_jdvsx_177","audio-container":"_audio-container_jdvsx_185",hidden:at,searchSelect:st,tags:nt,icon:ot,notice:it},rt=ue.parse(location.search);function lt(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!Oe(e)}const _t=L({name:"music-list",data(){return{show:!0,isFirstLoad:!1,userinfo:null,isApp:le().isApp,tempLevelId:0,chooseShow:!1,partNames:[],selectedPartName:"",selectedPartIndex:0,activeRow:null}},async mounted(){await this.initList()},methods:{async initList(){ce(["_trackEvent","云教练","切换页面","列表页面"]);const e=ye();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 i=[];for(let s of t)s.id==a.parentId&&(i=s.sysMusicScoreCategoriesList||[]);if(a.levelOptions=[...i.map(s=>({value:s.id,text:s.name,childs:s.sysMusicScoreCategoriesList}))],a.levelOptions.length&&!a.levelId){a.levelId=a.levelOptions[0].value;const s=U.find(a.levelOptions,{value:a.levelId});s&&(s.childs?(console.log(s,"showInfo"),a.typeOptions=[{value:0,text:"全部"},...s.childs.map(r=>({value:r.id,text:r.name}))]):a.typeOptions=null)}}catch{}},async FetchCats(){try{const e=await D.get("/sysMusicScoreAccompaniment/querySubjectIds",{params:{categoriesId:this.$route.params.id||1}});l.subjectOptions=[{value:0,text:"全部声部"},...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(l.subjectOptions),S()!=="/api-student"&&await this.FetchCats(),S()==="/api-student"&&(l.subjectOptions=[...l.extSubjectIds.filter(t=>!!t).map(t=>({value:t.id,text:t.name}))]);const e=l.subjectOptions.map(t=>t.value).filter(t=>t>0);console.log(e,l.subjectId),e.includes(5)&&e.push(6),e.includes(l.subjectId)||(l.subjectId=0),console.log(l.subjectOptions);try{a.subjectId=l.subjectId;let t=a.params,i=this.$route.params.id,s=((a.levelId||a.typeId)===0?void 0:a.typeId||a.levelId)||i,r=l.subjectId===0?void 0:l.subjectId;S();const d=await D.get("/sysMusicScore/queryPage2",{params:{...t,clientType:"SMART_PRACTICE",subjectId:r,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=[];A({type:"loading",overlay:!0});try{const i=await _e.get(e,{mode:"cors"}),s=new DOMParser().parseFromString(i,"text/xml");for(const r of s.getElementsByTagName("part-name"))r.textContent&&t.push(r.textContent);A.clear()}catch{A.clear(),A("读取分谱信息失败,请重试")}return t},openDetail(){var r,d,p;const e=this.activeRow,t=(r=e.rankIds)==null?void 0:r.split(","),i=String((p=(d=l.user)==null?void 0:d.student)==null?void 0:p.memberRankSettingId);if(e.rankIds&&l.user&&!t.includes(i)&&S()==="/api-student"){te.vipShow=!0;return}if(rt.mode==="select"){this.isApp&&j({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)j({api:"openAccompanyWebView",content:{url:location.origin+"/accompany/#"+s,orientation:0,isHideTitle:!0,statusBarTextColor:!1,isOpenLight:!0}});else{const m=de("#"+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(),j({api:"recordHomeworkVideo",content:{...t,partIndex:this.selectedPartIndex}})},openRecordingWebview(e,t){e.stopPropagation(),j({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){l.subjectId=e,this.onSearch()},onClickLeft(){this.$router.replace("/")}},render(){let e;return n("div",{class:h.accompany},[n(H,{show:this.chooseShow,teleport:"body",closeable:!0,style:{borderRadius:"8px"},onClickOverlay:()=>this.chooseShow=!1,onClickCloseIcon:()=>this.chooseShow=!1},{default:()=>[n(be,{partNames:this.partNames,onSelectedPartName:this.onSelectedPartName},null)]}),n(ae,null,{default:()=>[a.typeOptions||a.levelOptions&&a.levelOptions.length>0?n(W,{activeColor:"#01C1B5"},{default:()=>[a.levelOptions&&a.levelOptions.length>0?n(V,{modelValue:a.levelId,options:a.levelOptions,onChange:t=>{a.levelId=t,a.typeId=0;const i=U.find(a.levelOptions,{value:t});i&&(i.childs?a.typeOptions=[{value:0,text:"全部"},...i.childs.map(s=>({value:s.id,text:s.name}))]:a.typeOptions=null),this.onSearch()}},null):null,a.typeOptions?n(V,{class:h.searchSelect,"get-container":"#app",modelValue:a.typeId,options:a.typeOptions,onChange:t=>{a.typeId=t,this.onSearch()}},null):null]}):null,n(De,{class:[h.search],placeholder:"请输入搜索关键词",modelValue:a.search,background:"#F8F9FC","onUpdate:model-value":t=>a.search=t,showAction:!0,onSearch:this.onSearch},{"left-icon":()=>n("img",{class:h.iconSearch,src:Fe},null),label:()=>S()=="/api-student"&&l.subjectOptions&&l.subjectOptions.length===1?null:n(W,{activeColor:"#01C1B5",onClick:t=>{t.preventDefault()}},{default:()=>[n(V,{class:h.searchSelect,"get-container":"#app",modelValue:l.subjectId,options:l.subjectOptions,onChange:t=>{l.subjectId=t,this.onSearch()}},null)]}),action:()=>n("span",{class:h.search_btn,onClick:this.onSearch},[E("搜索")])})]}),n("div",{class:se(h.accompanyList,h.song)},[this.show?n(ne,{loading:a.loading,finishedText:"加载完毕",error:a.error,offset:100,finished:a.finished,immediateCheck:!1,onLoad:this.FetchList},{default:()=>[n(oe,null,lt(e=a.list.map(t=>n($,{size:"large",onClick:()=>this.toDetail(t)},{icon:()=>n("div",{class:h["icon-status"]},[n(X,{class:h.iconMusic,name:Ie},null),t.rankIds?n("div",{class:h.icon},[n("img",{src:xe},null)]):null]),title:()=>n(ie,{background:"none",color:"#444",style:{paddingLeft:(t.rankIds?"4PX":"15PX")+"!important"},text:t.name,key:"notactive"},null)})))?e:{default:()=>[e]})],error:()=>n("span",{onClick:this.FetchList},[E("加载失败,请点击重试")])}):n(Be,{description:"暂无数据"},null)])])}});export{_t as default};