1 |
- import{d as gt,e as q,$ as d,r as G,q as vt,C as lt,T as ht,f as s,a0 as It,a1 as St,k as y,F as X,c as ct,a as xt,u as bt,U as $,aP as Ct,A as z,x as O,aQ as Tt,aR as rt,aC as W,j as M,w as kt,y as At,E as ut,z as Bt,_ as Lt,l as Nt,m as Pt,D as Mt,aS as Rt,aT as Et}from"./index-b48b51d2-1720699367816.js";import{i as Ft}from"./icon_back-c5ec0a72-1720699367816.js";import{i as Ut}from"./icon_separator-e0f6c575-1720699367816.js";import{T as $t}from"./index-876d8b60-1720699367816.js";import{P as Gt,T as jt,i as dt,a as pt,b as Dt,c as zt}from"./index-96385afb-1720699367816.js";import{i as Ot,a as Wt}from"./icon-collect-active-4272e308-1720699367816.js";import{i as Vt}from"./icon_default-d1bcaf5f-1720699367816.js";import{u as Jt}from"./catchData-309c65ac-1720699367816.js";import{c as qt,d as Xt,e as Ht}from"./api-d49c298b-1720699367816.js";import{g as V,s as w}from"./index-db345329-1720699367816.js";import{g as Qt,s as mt}from"./api-53c4c1b8-1720699367816.js";import{T as ft}from"./index-a2dc20f3-1720699367816.js";import{u as Kt}from"./index-4d81797f-1720699367816.js";import{v as J}from"./urlUtils-72ef455d-1720699367816.js";import"./Slider-e8b4d094-1720699367816.js";import"./index-966150e9-1720699367816.js";const Yt="_container_8ouit_1",Zt="_iconBack_8ouit_6",te="_separator_8ouit_39",ee="_wrap_8ouit_44",se="_wrapBottom_8ouit_50",ae="_content_8ouit_53",ie="_tools_8ouit_60",oe="_contentWrap_8ouit_84",ne="_musicList_8ouit_91",le="_wrapList_8ouit_105",ce="_empty_8ouit_111",re="_itemContainer_8ouit_117",ue="_item_8ouit_117",de="_active_8ouit_139",pe="_arrow_8ouit_142",me="_img_8ouit_145",fe="_title_8ouit_167",ge="_titleName_8ouit_174",ve="_titleDes_8ouit_181",he="_btn_8ouit_191",we="_showPlayLoading_8ouit_216",ye="_loadingWrap_8ouit_219",_e="_showLoading_8ouit_224",Ie="_musicStaff_8ouit_230",Se="_goBtn_8ouit_245",xe="_rightBtns_8ouit_254",be="_textBtn_8ouit_261",Ce="_transBtn_8ouit_269",Te="_favitor_8ouit_274",ke="_musicName_8ouit_289",Ae="_staffImgs_8ouit_297",Be="_previewWindow_8ouit_314",Le="_previewClose_8ouit_319",Ne="_previewIframe_8ouit_326",Pe="_popSelect_8ouit_332",Me="_popSelect1_8ouit_344",Re="_popTrans_8ouit_354",Ee="_iconArrow_8ouit_365",Fe="_textBtnActive_8ouit_377",i={container:Yt,iconBack:Zt,separator:te,wrap:ee,wrapBottom:se,content:ae,tools:ie,contentWrap:oe,musicList:ne,wrapList:le,empty:ce,itemContainer:re,item:ue,active:de,arrow:pe,img:me,title:fe,titleName:ge,titleDes:ve,btn:he,showPlayLoading:we,loadingWrap:ye,showLoading:_e,musicStaff:Ie,goBtn:Se,rightBtns:xe,textBtn:be,transBtn:Ce,favitor:Te,musicName:ke,staffImgs:Ae,previewWindow:Be,previewClose:Le,previewIframe:Ne,popSelect:Pe,popSelect1:Me,popTrans:Re,iconArrow:Ee,textBtnActive:Fe},Ue=""+new URL("icon_goXiaoku-5d0db670.png",import.meta.url).href,$e=""+new URL("icon-close-1bf25bcf.png",import.meta.url).href,Ge=""+new URL("icon_trans-e9b9e2da.png",import.meta.url).href,je=gt({name:"music-guide",emits:["close"],setup(b,{emit:H}){const n=q({box:{height:"0px"},show:!1,steps:[{ele:"",eleRect:{},img:V("music1.png"),handStyle:{top:"0.91rem"},imgStyle:{top:d(-4),left:d(0),width:d(533),height:d(271)},btnsStyle:{bottom:d(40),left:d(-10)},eleRectPadding:{left:7,top:7,width:14,height:14},boxStyle:{}},{ele:"",img:V("music2.png"),imgStyle:{top:d(-4),left:d(-205),width:d(420),height:d(228)},btnsStyle:{bottom:d(35),left:d(-48)},boxStyle:{borderRadius:"25px"},eleRectPadding:{left:7,top:7,width:14,height:14}},{ele:"",img:V("music3.png"),imgStyle:{top:"100%",left:d(-130),width:d(401),height:d(304)},btnsStyle:{bottom:d(100),left:d(30)},boxStyle:{borderRadius:"40px"},eleRectPadding:{left:7,top:7,width:14,height:14},type:"bottom"}],step:0}),v=G(!1),r=G({});(async()=>{var l;try{const p=await Qt({guideTag:"teacher-guideInfo"});p.data?r.value=JSON.parse((l=p.data)==null?void 0:l.guideValue)||null:r.value={},r.value&&r.value.musicGuide?v.value=!1:v.value=!0}catch(p){console.log(p)}})();const _=()=>{var p,S,x,T;const l=document.getElementById("music-".concat(n.step));if(l){const f=l.getBoundingClientRect();if(console.log(l.style.display,"ele"),l.style.display=="none"){I();return}const m=((p=n.steps[n.step].eleRectPadding)==null?void 0:p.left)||0,E=((S=n.steps[n.step].eleRectPadding)==null?void 0:S.top)||0,B=((x=n.steps[n.step].eleRectPadding)==null?void 0:x.width)||0,k=((T=n.steps[n.step].eleRectPadding)==null?void 0:T.height)||0;n.box={left:f.x-m+"px",top:f.y-E+"px",width:f.width+B+"px",height:f.height+k+"px"}}else I()},P=async l=>{try{if(l!=="xiaoku-music")return;r.value?r.value.musicGuide=!1:r.value={musicGuide:!1};try{await mt({guideTag:"teacher-guideInfo",guideValue:JSON.stringify(r.value)})}catch(p){console.log(p)}n.step=0,_(),v.value=!0}catch(p){}};vt(()=>{_(),window.addEventListener("resize",R),lt.on("teacher-guideInfo",P)});const R=()=>{_()};ht(()=>{window.removeEventListener("resize",R),lt.off("teacher-guideInfo",P)});const I=()=>{if(n.step>=3){C();return}n.step=n.step+1,_()},C=async()=>{r.value?r.value.musicGuide=!0:r.value={musicGuide:!0};try{const l=await mt({guideTag:"teacher-guideInfo",guideValue:JSON.stringify(r.value)})}catch(l){console.log(l)}v.value=!1};return()=>s(X,null,[v.value?It(s("div",{"onUpdate:show":l=>v.value=l,class:["n-modal-mask","n-modal-mask-guide"]},[s("div",{class:w.content,onClick:()=>I()},[s("div",{class:w.backBtn,onClick:l=>{l.stopPropagation(),C()}},[y("跳过")]),s("div",{class:w.box,style:{...n.box,...n.steps[n.step].boxStyle},id:"modeType-".concat(n.step)},[n.steps.map((l,p)=>{var S,x,T,f;return s("div",{onClick:m=>m.stopPropagation(),class:w.item,style:l.type=="bottom"?{display:p===n.step?"":"none",left:"".concat((S=l.eleRect)==null?void 0:S.left,"px"),top:"-".concat((x=l.imgStyle)==null?void 0:x.height)}:{display:p===n.step?"":"none",left:"".concat((T=l.eleRect)==null?void 0:T.left,"px"),top:"".concat((f=n.box)==null?void 0:f.height)}},[s("img",{class:w.img,style:l.imgStyle,src:l.img},null),s("div",{class:w.btns,style:l.btnsStyle},[n.step+1==n.steps.length?s(X,null,[s("div",{class:[w.endBtn],onClick:()=>C()},[y("完成")]),s("div",{class:w.nextBtn,onClick:()=>{n.step=0,_()}},[y("再看一遍")])]):s("div",{class:w.btn,onClick:()=>I()},[y("下一步 ("),n.step+1,y("/"),n.steps.length,y(")")])])])})])])]),[[St,v.value,"show"]]):null])}});function De(b){return typeof b=="function"||Object.prototype.toString.call(b)==="[object Object]"&&!Mt(b)}const is=gt({name:"XiaokuMusic",setup(){const b=Jt(),H=ct(),n=xt(),v=bt(),r=q({page:1,rows:20,status:!0,name:"",musicSheetCategoriesId:n.query.id||""}),t=q({loading:!1,finshed:!1,reshing:!1,tags:[],tagIndex:0,list:[],listActive:0,musicInstrumentIndex:0,playState:"pause",showPlayer:!1,previewModal:!1,showPreivew:!1,previewUrl:"",showCloseBtn:!0,iframeSrc:"",showMusicImg:"staff",trackList:[],showTransBtn:!0,trackName:"切换声轨"}),_=G(!1),P=ct(),R=async()=>{const a=b.getSubjectInstruments,e=sessionStorage.getItem("musicSubjectList")?JSON.parse(sessionStorage.getItem("musicSubjectList")):[],o=[];a.forEach(c=>{e.find(g=>g.id===c.id)&&o.push(c)}),t.tags=[{name:"全部",id:0,value:0,label:"全部"},...o]},I=async()=>{var e;t.loading=!0;let a={};try{a=await qt({...r,musicalInstrumentId:t.tagIndex?t.tagIndex:""})}catch(o){console.log(o)}t.reshing&&(t.list=[],t.reshing=!1),(a==null?void 0:a.code)===200&&Array.isArray((e=a==null?void 0:a.data)==null?void 0:e.rows)?(t.list=[...t.list,...a.data.rows],t.finshed=a.data.rows.length<r.rows):t.finshed=!0,t.list[t.listActive]&&x(t.list[t.listActive]),t.loading=!1,setTimeout(()=>{_.value=!0},500)},C=()=>{t.listActive=0,t.showPlayer=!1,t.playState="pause",r.page=1,t.finshed=!1,I()},l=G(),p=()=>{t.loading||t.finshed||(r.page=r.page+1,I())},S=a=>{var e;((e=a.data)==null?void 0:e.api)==="api_fingerPreView"&&(t.showCloseBtn=!a.data.state)};vt(async()=>{await b.getSubjects(),Kt(document.querySelector(".musicList-container"),e=>{const o=e[0],{height:c}=o.contentRect;document.documentElement.style.setProperty("--xiaoku-music-height",c+"px")}),R(),await I(),new IntersectionObserver(e=>{e[0].intersectionRatio>0&&p()}).observe(l.value),j(),window.addEventListener("message",S)}),ht(()=>{window.removeEventListener("message",S)});const x=async a=>{const e=await Xt({type:"MUSIC",materialId:a.id});(e==null?void 0:e.code)===200&&(a.favitor=e.data)},T=a=>{const e=t.list.findIndex(o=>o.id===a.id);e>-1&&(t.listActive=e),x(a)},f=a=>{const e={};return a==null||a.forEach(o=>{o.id===t.tagIndex&&(e.selected=!0,e.name=o.name)}),e},m=$(()=>(t.list[t.listActive]&&"".concat(J(),"/instrument/?modelType=practise&id=").concat(t.list[t.listActive].xmlFileUrl,"&Authorization=").concat(P.getToken,"/#/preview"),t.list[t.listActive]||{})),E=()=>{t.list[t.listActive].favitor=!t.list[t.listActive].favitor,Ht({favoriteFlag:t.list[t.listActive].favitor,type:"MUSIC",materialId:t.list[t.listActive].id})},B=a=>{const e=t.list.findIndex(o=>o.id===a.id);e>-1&&(t.listActive===e?t.playState=t.playState==="play"?"pause":"play":t.playState="play",t.showPlayer=!0,t.listActive=e)};$(()=>{const a=t.list[t.listActive],e=(a==null?void 0:a.musicalInstruments)||[],o=[];return e.forEach((c,h)=>{o.push({label:c.name,value:h})}),o});const k=$(()=>{var a;return t.list.length?((a=t.list[t.listActive])==null?void 0:a.musicSheetType)!=="SINGLE":!1}),L=()=>{const a=P.getToken,e=t.list[t.listActive],o=t.showMusicImg==="first"?"firstTone":t.showMusicImg==="fixed"?"fixedTone":(t.showMusicImg==="staff","staff");t.iframeSrc="".concat(J(),"/instrument/?id=").concat(e.id,"&modelType=practise&modeType=json&Authorization=").concat(a,"&isPreView=true&part-index=").concat(t.musicInstrumentIndex,"&musicRenderType=").concat(o)},Q=a=>{a==="play"?t.playState="play":a==="pause"?t.playState="pause":a==="pre"?t.list[t.listActive-1]&&B(t.list[t.listActive-1]):a==="next"?t.list[t.listActive+1]&&B(t.list[t.listActive+1]):a==="favitor"&&E()},wt=[{value:"staff",label:"五线谱"},{value:"first",label:"首调"},{value:"fixed",label:"固定调"}],j=async()=>{const a=t.list[t.listActive];if((a==null?void 0:a.musicSheetType)==="CONCERT"){if(a.xmlFileUrl){const e=await fetch(a.xmlFileUrl).then(o=>o.text());yt(e)}}else{const{defaultScore:e,transferFlag:o}=a.musicalInstruments[0]||{};let c="staff";c=e==="STAVE"?"staff":e==="JIAN"?"fixed":e==="FIRST"?"first":"staff",console.log(c,"musicImgType1"),t.showMusicImg=c,t.showTransBtn=o}},yt=a=>{var et,st,F,at,it,ot,nt;const e=new DOMParser().parseFromString(a,"text/xml"),o=((st=(et=e.getElementsByTagName("part-list"))==null?void 0:et[0])==null?void 0:st.getElementsByTagName("score-part"))||[],c=Array.from(o).map(u=>{var A,U,N;return((N=(U=(A=u.getElementsByTagName("part-name"))==null?void 0:A[0])==null?void 0:U.textContent)==null?void 0:N.trim())||""});e.getElementsByTagName("part"),((at=(F=c[0])==null?void 0:F.toLocaleUpperCase)==null?void 0:at.call(F))==="COMMON"&&c.shift();const h=(it=t.list[t.listActive])==null?void 0:it.multiTracksSelection,g=h?h==null?void 0:h.split(","):[],Y=c.map((u,A)=>{const U=!!(g.length==0||g.includes(u)),N=Ct(u),_t=Rt(N,A);return{label:u+(N?"(".concat(N,")"):""),value:A,sortId:_t,canselect:U,track:u}}).filter(u=>u.canselect).sort((u,A)=>u.sortId-A.sortId);t.trackList=Y;let D=(ot=Y.find(u=>u.value===t.musicInstrumentIndex))==null?void 0:ot.track;D=Et(D);let Z="staff",tt=!0;(nt=t.list[t.listActive])==null||nt.musicalInstruments.forEach(u=>{u.code.toLocaleLowerCase()===D.toLocaleLowerCase()&&(Z=u.defaultScore==="STAVE"?"staff":u.defaultScore==="JIAN"?"fixed":u.defaultScore==="FIRST"?"first":"staff",tt=u.transferFlag)}),t.showTransBtn=tt,t.showMusicImg=Z};z(()=>t.listActive,async()=>{t.musicInstrumentIndex=0,j()}),z(()=>t.musicInstrumentIndex,async()=>{var a;t.trackName=((a=t.trackList.find(e=>e.value===t.musicInstrumentIndex))==null?void 0:a.label)||"切换声轨",L()}),z(()=>t.showMusicImg,()=>{k.value&&L()});const K=$(()=>{var e,o,c,h;let a=[];if(t.showMusicImg==="first"){const g=(e=m.value)==null?void 0:e.musicFirstImg;a=g?g.split(","):[]}else if(t.showMusicImg==="fixed"){const g=(o=m.value)==null?void 0:o.musicJianImg;a=g?g.split(","):[]}else if(t.showMusicImg==="staff"){const g=((c=m.value)==null?void 0:c.musicImg)||((h=m.value)==null?void 0:h.musicSvg);a=g?g.split(","):[]}return a});return()=>{let a;return s("div",{class:i.container},[s(O,{align:"center",wrapItem:!1,size:16},{default:()=>[s("img",{style:{cursor:"pointer"},src:Ft,class:i.iconBack,onClick:()=>v.push({path:"/xiaoku-ai"})},null),s(Tt,{separator:""},{default:()=>[s(rt,{onClick:()=>v.push({path:"/xiaoku-ai"})},{default:()=>[y("全部列表")]}),s("img",{class:i.separator,src:Ut},null),s(rt,null,{default:()=>[n.query.name]})]})]}),s("div",{class:[i.wrap,t.showPlayer?i.wrapBottom:""]},[s("div",{class:i.content},[s("div",{class:i.tools},[s(O,{style:{width:"100%"},size:[24,12],wrapItem:!1},{default:()=>[s("div",{id:"music-0"},[s(O,{style:{width:"100%"},size:[24,12],wrapItem:!1},De(a=t.tags.map(e=>e.instruments&&e.instruments.length>1?s(W,{options:e.instruments,trigger:"hover",value:t.tagIndex,"onUpdate:value":[o=>t.tagIndex=o,()=>{t.reshing=!0,document.querySelector(".musicList-container").scroll(0,0),C()}],scrollable:!0,key:e.value,class:[i.popSelect1]},{default:()=>[s(M,{round:!0,textColor:f(e.instruments).selected?"#fff":"#000",color:f(e.instruments).selected?"#198CFE":"#fff",type:f(e.instruments).selected?"primary":"default",class:[i.textBtn,f(e.instruments).selected&&i.textBtnActive]},{default:()=>[f(e.instruments).name||e.name,s("i",{class:i.iconArrow},null)]})]}):s(M,{round:!0,textColor:t.tagIndex===e.value?"#fff":"#000",color:t.tagIndex===e.value?"#198CFE":"#fff",type:t.tagIndex===e.value?"primary":"default",onClick:()=>{t.tagIndex=e.value||0,t.reshing=!0,document.querySelector(".musicList-container").scroll(0,0),C()}},{default:()=>[e.name]})))?a:{default:()=>[a]})])]}),s($t,{style:{marginLeft:"auto"},round:!0,border:!1,onSearch:e=>{r.name=e,t.reshing=!0,C()}},null)]),s("div",{class:i.contentWrap},[s("div",{class:[i.musicList,"musicList-container"]},[s("div",{class:[i.wrapList,"music-wrap-list"]},[t.list.map((e,o)=>s("div",{class:i.itemContainer},[s("div",{class:[i.item,t.listActive===o&&i.active],onClick:()=>{T(e),L()}},[s("div",{class:i.img},[s(kt,{lazy:!0,objectFit:"cover",previewDisabled:!0,src:e.titleImg||Vt,onLoad:c=>{c.target.dataset.loaded="true"}},null),s(Gt,{class:[t.listActive===o&&t.playState==="play"?"":i.showPlayLoading]},null)]),s("div",{class:i.title},[s("div",{class:i.titleName},[s(jt,{text:e.musicSheetName},null)]),s("div",{class:i.titleDes},[e.composer])]),o==0?s(M,At({color:"#259CFE",textColor:"#fff"},{id:"music-1"},{round:!0,class:i.btn,type:"primary",onClick:c=>{c.stopPropagation(),B(e),t.listActive===o&&t.playState==="play"&&k.value&&L()}}),{default:()=>[y("试听"),s("img",{src:t.listActive===o&&t.playState==="play"?dt:pt},null)]}):s(M,{color:"#259CFE",textColor:"#fff",round:!0,class:i.btn,type:"primary",onClick:c=>{c.stopPropagation(),B(e),t.listActive===o&&t.playState==="play"&&k.value&&L()}},{default:()=>[y("试听"),s("img",{src:t.listActive===o&&t.playState==="play"?dt:pt},null)]}),s("img",{class:i.arrow,src:Dt},null)])])),s("div",{ref:l,class:[i.loadingWrap,t.finshed&&i.showLoading]},[s(ut,{show:!0},null)]),!t.loading&&t.list.length===0&&s("div",{class:i.empty},[s(ft,null,null)])])]),s("div",{class:i.musicStaff},[s("div",{class:i.musicName},[m.value.musicSheetName]),s("img",{id:"music-2",style:{display:m.value.id?"":"none"},class:[i.goBtn],src:Ue,onClick:()=>{Q("pause");let e="staff";t.showMusicImg==="first"?e="firstTone":t.showMusicImg==="fixed"?e="fixedTone":t.showMusicImg==="staff"&&(e="staff");const o="".concat(J(),"/instrument?v=").concat(+new Date,"&platform=pc&showGuide=true&id=").concat(m.value.id,"&Authorization=").concat(H.getToken,"&musicRenderType=").concat(e,"&showGuide=true&part-index=").concat(t.musicInstrumentIndex);window.matchMedia("(display-mode: standalone)").matches?(Bt.application=window.matchMedia("(display-mode: standalone)").matches,t.previewModal=!0,t.previewUrl=o,t.showPreivew=!1):window.open(o)}},null),s("div",{class:i.rightBtns,style:{display:m.value.id?"":"none"}},[k.value&&s(W,{options:t.trackList,trigger:"hover",value:t.musicInstrumentIndex,"onUpdate:value":[e=>t.musicInstrumentIndex=e,async e=>{await j()}],class:[i.popSelect]},{default:()=>[s(M,{round:!0,class:[i.textBtn]},{default:()=>[t.trackName,s("i",{class:i.iconArrow},null)]})]}),t.showTransBtn&&s(W,{options:wt,trigger:"hover",value:t.showMusicImg,"onUpdate:value":[e=>t.showMusicImg=e,async e=>{t.showMusicImg=e}],class:[i.popTrans]},{default:()=>[s("img",{class:[i.transBtn],src:Ge},null)]}),s("div",{class:i.favitor,onClick:()=>E()},[s(Lt,{name:"favitor",mode:"out-in"},{default:()=>[m.value.favitor?s("img",{src:Ot,key:"1"},null):s("img",{src:Wt,key:"2"},null)]})])]),s("div",{class:i.staffImgs},[k.value?s("iframe",{id:"staffIframeRef",style:{width:"100%",height:"100%",paddingTop:"20px"},src:t.iframeSrc,onLoad:L},null):s(X,null,[K.value.length>0?K.value.map(e=>s("img",{src:e,key:e},null)):s(ft,null,null)])])])])])]),t.list.length!==0&&s(zt,{show:t.showPlayer,playState:t.playState,item:m.value,onChange:e=>Q(e)},null),_.value?s(je,null,null):null,s(Nt,{maskClosable:Pt,show:t.previewModal,"onUpdate:show":[e=>t.previewModal=e,e=>{e||(t.previewUrl="")}],class:i.previewWindow,showIcon:!1,displayDirective:"show"},{default:()=>[s(ut,{show:t.showPreivew,style:"--n-opacity-spinning: 1;"},{default:()=>[s("img",{style:{display:t.showCloseBtn?"":"none"},src:$e,class:i.previewClose,onClick:()=>{t.previewModal=!1,t.previewUrl=""}},null),s("iframe",{class:i.previewIframe,onLoad:()=>{t.showPreivew=!1},frameborder:"0",src:t.previewUrl},null)]})]})])}}});export{is as default};
|