1 |
- import{d as V,e as R,X as c,r as I,p as J,H as E,O as X,f as t,c1 as q,bT as H,k as g,F,c as M,a as K,u as Q,M as Y,U as Z,w as B,ck as ee,cl as $,j as L,v as te,x as se,A as D,W as ie,a6 as ae,l as oe,aV as le}from"./index-18b8b0d9-1706107518515.js";import{i as ne}from"./icon_back-c5ec0a72-1706107518515.js";import{i as ce,P as re,a as W,b as j,c as de,d as ue}from"./index-c439db43-1706107518515.js";import{T as pe}from"./index-50bf2e43-1706107518515.js";import{i as me,a as fe}from"./icon-collect-active-4272e308-1706107518515.js";import{i as ge}from"./icon_default-d1bcaf5f-1706107518515.js";import{T as ve}from"./index-2dfc0ec2-1706107518515.js";import{c as ye,d as he,e as we}from"./api-646781d9-1706107518515.js";import{g as N,s as f,a as _e,b as z}from"./api-afc60053-1706107518515.js";import{T as O}from"./index-1aaceba7-1706107518515.js";import{s as ke}from"./state-ba682549-1706107518515.js";import{u as Se}from"./index-bbc943cc-1706107518515.js";import"./Slider-c3c0528e-1706107518515.js";import"./index-0e750973-1706107518515.js";const be="_container_d7nyk_1",xe="_iconBack_d7nyk_6",Ce="_separator_d7nyk_39",Ie="_wrap_d7nyk_44",Ae="_wrapBottom_d7nyk_50",Pe="_content_d7nyk_53",Be="_tools_d7nyk_60",Le="_contentWrap_d7nyk_84",Ne="_musicList_d7nyk_91",Re="_wrapList_d7nyk_105",Te="_empty_d7nyk_111",Ge="_itemContainer_d7nyk_117",Ue="_item_d7nyk_117",Ee="_active_d7nyk_139",Fe="_arrow_d7nyk_142",Me="_img_d7nyk_145",$e="_title_d7nyk_167",De="_titleName_d7nyk_174",We="_titleDes_d7nyk_181",je="_btn_d7nyk_191",ze="_showPlayLoading_d7nyk_216",Oe="_loadingWrap_d7nyk_219",Ve="_musicStaff_d7nyk_224",Je="_goBtn_d7nyk_239",Xe="_favitor_d7nyk_248",qe="_musicName_d7nyk_266",He="_staffImgs_d7nyk_274",Ke="_previewWindow_d7nyk_291",Qe="_previewClose_d7nyk_296",Ye="_previewIframe_d7nyk_303",a={container:be,iconBack:xe,separator:Ce,wrap:Ie,wrapBottom:Ae,content:Pe,tools:Be,contentWrap:Le,musicList:Ne,wrapList:Re,empty:Te,itemContainer:Ge,item:Ue,active:Ee,arrow:Fe,img:Me,title:$e,titleName:De,titleDes:We,btn:je,showPlayLoading:ze,loadingWrap:Oe,musicStaff:Ve,goBtn:Je,favitor:Xe,musicName:qe,staffImgs:He,previewWindow:Ke,previewClose:Qe,previewIframe:Ye},Ze=""+new URL("icon_goXiaoku-5d0db670.png",import.meta.url).href,et=""+new URL("icon-close-1bf25bcf.png",import.meta.url).href,tt=V({name:"music-guide",emits:["close"],setup(k,{emit:A}){const o=R({box:{height:"0px"},show:!1,steps:[{ele:"",eleRect:{},img:N("music1.png"),handStyle:{top:"0.91rem"},imgStyle:{top:c(-4),left:c(0),width:c(533),height:c(271)},btnsStyle:{bottom:c(40),left:c(159)},eleRectPadding:{left:7,top:7,width:14,height:14},boxStyle:{}},{ele:"",img:N("music2.png"),imgStyle:{top:c(-4),left:c(-205),width:c(420),height:c(228)},btnsStyle:{bottom:c(35),left:c(-48)},boxStyle:{borderRadius:"25px"},eleRectPadding:{left:7,top:7,width:14,height:14}},{ele:"",img:N("music3.png"),imgStyle:{top:"100%",left:c(-130),width:c(401),height:c(304)},btnsStyle:{bottom:c(100),left:c(30)},boxStyle:{borderRadius:"40px"},eleRectPadding:{left:7,top:7,width:14,height:14},type:"bottom"}],step:0}),u=I(!1),e=I({});(async()=>{var l;try{const r=await _e({guideTag:"teacher-guideInfo"});r.data?e.value=JSON.parse((l=r.data)==null?void 0:l.guideValue)||null:e.value={},e.value&&e.value.musicGuide?u.value=!1:u.value=!0}catch(r){console.log(r)}})();const h=()=>{var r,v,_,d;const l=document.getElementById("music-".concat(o.step));if(l){const m=l.getBoundingClientRect();if(console.log(l.style.display,"ele"),l.style.display=="none"){w();return}const y=((r=o.steps[o.step].eleRectPadding)==null?void 0:r.left)||0,C=((v=o.steps[o.step].eleRectPadding)==null?void 0:v.top)||0,i=((_=o.steps[o.step].eleRectPadding)==null?void 0:_.width)||0,s=((d=o.steps[o.step].eleRectPadding)==null?void 0:d.height)||0;o.box={left:m.x-y+"px",top:m.y-C+"px",width:m.width+i+"px",height:m.height+s+"px"}}else w()},x=async l=>{try{if(l!=="xiaoku-music")return;e.value?e.value.musicGuide=!1:e.value={musicGuide:!1};try{await z({guideTag:"teacher-guideInfo",guideValue:JSON.stringify(e.value)})}catch(r){console.log(r)}o.step=0,h(),u.value=!0}catch(r){}};J(()=>{h(),window.addEventListener("resize",S),E.on("teacher-guideInfo",l=>x(l))});const S=()=>{h()};X(()=>{window.removeEventListener("resize",S),E.off("teacher-guideInfo",x)});const w=()=>{if(o.step>=3){b();return}o.step=o.step+1,h()},b=async()=>{e.value?e.value.musicGuide=!0:e.value={musicGuide:!0};try{const l=await z({guideTag:"teacher-guideInfo",guideValue:JSON.stringify(e.value)})}catch(l){console.log(l)}u.value=!1};return()=>t(F,null,[u.value?q(t("div",{"onUpdate:show":l=>u.value=l,class:["n-modal-mask","n-modal-mask-guide"]},[t("div",{class:f.content,onClick:()=>w()},[t("div",{class:f.backBtn,onClick:l=>{l.stopPropagation(),b()}},[g("跳过")]),t("div",{class:f.box,style:{...o.box,...o.steps[o.step].boxStyle},id:"modeType-".concat(o.step)},[o.steps.map((l,r)=>{var v,_,d,m;return t("div",{onClick:y=>y.stopPropagation(),class:f.item,style:l.type=="bottom"?{display:r===o.step?"":"none",left:"".concat((v=l.eleRect)==null?void 0:v.left,"px"),top:"-".concat((_=l.imgStyle)==null?void 0:_.height)}:{display:r===o.step?"":"none",left:"".concat((d=l.eleRect)==null?void 0:d.left,"px"),top:"".concat((m=o.box)==null?void 0:m.height)}},[t("img",{class:f.img,style:l.imgStyle,src:l.img},null),t("div",{class:f.btns,style:l.btnsStyle},[o.step+1==o.steps.length?t(F,null,[t("div",{class:[f.endBtn],onClick:()=>b()},[g("完成")]),t("div",{class:f.nextBtn,onClick:()=>{o.step=0,h()}},[g("再看一遍")])]):t("div",{class:f.btn,onClick:()=>w()},[g("下一步 ("),o.step+1,g("/"),o.steps.length,g(")")])])])})])])]),[[H,u.value,"show"]]):null])}});function st(k){return typeof k=="function"||Object.prototype.toString.call(k)==="[object Object]"&&!le(k)}const ht=V({name:"XiaokuMusic",setup(){const k=M(),A=K(),o=Q(),u=R({page:1,rows:20,status:!0,name:"",musicSheetCategoriesId:A.query.id||""}),e=R({loading:!1,finshed:!1,reshing:!1,tags:[],tagIndex:0,list:[],listActive:0,playState:"pause",showPlayer:!1,previewModal:!1,showPreivew:!1,previewUrl:"",showCloseBtn:!0}),P=I(!1),h=M(),x=async()=>{const i=sessionStorage.getItem("musicSubjectList")?JSON.parse(sessionStorage.getItem("musicSubjectList")):[];e.tags=[{name:"全部",id:0},...i]},S=async()=>{var s;e.loading=!0;let i={};try{i=await ye({...u,musicSubject:e.tagIndex?e.tagIndex:""})}catch(n){console.log(n)}e.reshing&&(e.list=[],e.reshing=!1),(i==null?void 0:i.code)===200&&Array.isArray((s=i==null?void 0:i.data)==null?void 0:s.rows)&&(e.list=[...e.list,...i.data.rows],e.finshed=i.data.rows.length<u.rows,console.log("🚀 ~ data.finshed:",e.finshed)),e.list[e.listActive]&&v(e.list[e.listActive]),e.loading=!1,setTimeout(()=>{P.value=!0},500)},w=()=>{e.listActive=0,e.showPlayer=!1,e.playState="pause",u.page=1,e.finshed=!1,S()},b=I(),l=()=>{console.log(e.finshed),!(e.loading||e.finshed)&&(u.page=u.page+1,S())},r=i=>{var s;((s=i.data)==null?void 0:s.api)==="api_fingerPreView"&&(e.showCloseBtn=!i.data.state)};J(async()=>{Se(document.querySelector(".musicList-container"),s=>{const n=s[0],{height:p}=n.contentRect;console.log(p,"height - 11"),document.documentElement.style.setProperty("--xiaoku-music-height",p+"px")}),x(),await S();const i=new IntersectionObserver(s=>{s[0].intersectionRatio>0&&l()});Y(()=>{i.observe(b.value)}),window.addEventListener("message",r)}),X(()=>{window.removeEventListener("message",r)});const v=async i=>{const s=await he({type:"MUSIC",materialId:i.id});(s==null?void 0:s.code)===200&&(i.favitor=s.data)},_=i=>{const s=e.list.findIndex(n=>n.id===i.id);s>-1&&(e.listActive=s),v(i)},d=Z(()=>{if(e.list[e.listActive]){const i=/(localhost|192)/.test(location.host)?"https://dev.kt.colexiu.com":location.origin;console.log(e.list[e.listActive].xmlFileUrl,"data.list[data.listActive]"),"".concat(i,"/instrument?modelType=practise&id=").concat(e.list[e.listActive].xmlFileUrl,"&Authorization=").concat(h.getToken,"/#/preview")}return e.list[e.listActive]||{}}),m=()=>{e.list[e.listActive].favitor=!e.list[e.listActive].favitor,we({favoriteFlag:e.list[e.listActive].favitor,type:"MUSIC",materialId:e.list[e.listActive].id})},y=i=>{const s=e.list.findIndex(n=>n.id===i.id);s>-1&&(e.listActive===s?e.playState=e.playState==="play"?"pause":"play":e.playState="play",e.showPlayer=!0,e.listActive=s)},C=i=>{i==="play"?e.playState="play":i==="pause"?e.playState="pause":i==="pre"?e.list[e.listActive-1]&&y(e.list[e.listActive-1]):i==="next"?e.list[e.listActive+1]&&y(e.list[e.listActive+1]):i==="favitor"&&m()};return()=>{let i;return t("div",{class:a.container},[t(B,{align:"center",wrapItem:!1,size:16},{default:()=>[t("img",{style:{cursor:"pointer"},src:ne,class:a.iconBack,onClick:()=>o.push({path:"/xiaoku-ai"})},null),t(ee,{separator:""},{default:()=>[t($,{onClick:()=>o.push({path:"/xiaoku-ai"})},{default:()=>[g("全部列表")]}),t("img",{class:a.separator,src:ce},null),t($,null,{default:()=>[A.query.name]})]})]}),t("div",{class:[a.wrap,e.showPlayer?a.wrapBottom:""]},[t("div",{class:a.content},[t("div",{class:a.tools},[t(B,{style:{width:"100%"},size:[24,12],wrapItem:!1},{default:()=>[t("div",{id:"music-0"},[t(B,{style:{width:"100%"},size:[24,12],wrapItem:!1},st(i=e.tags.map(s=>t(L,{round:!0,textColor:e.tagIndex===s.id?"#fff":"#000",color:e.tagIndex===s.id?"#198CFE":"#fff",type:e.tagIndex===s.id?"primary":"default",onClick:()=>{e.tagIndex=s.id,e.reshing=!0,w()}},{default:()=>[s.name]})))?i:{default:()=>[i]})])]}),t(pe,{style:{marginLeft:"auto"},round:!0,border:!1,onSearch:s=>{u.name=s,e.reshing=!0,w()}},null)]),t("div",{class:a.contentWrap},[t("div",{class:[a.musicList,"musicList-container"]},[t("div",{class:a.wrapList},[e.list.map((s,n)=>t("div",{class:a.itemContainer},[t("div",{class:[a.item,e.listActive===n&&a.active],onClick:()=>_(s)},[t("div",{class:a.img},[t(te,{lazy:!0,objectFit:"cover",previewDisabled:!0,src:s.titleImg||ge,onLoad:p=>{p.target.dataset.loaded="true"}},null),t(re,{class:[e.listActive===n&&e.playState==="play"?"":a.showPlayLoading]},null)]),t("div",{class:a.title},[t("div",{class:a.titleName},[t(ve,{text:s.musicSheetName},null)]),t("div",{class:a.titleDes},[s.composer])]),n==0?t(L,se({color:"#259CFE",textColor:"#fff"},{id:"music-1"},{round:!0,class:a.btn,type:"primary",onClick:p=>{p.stopPropagation(),y(s)}}),{default:()=>[g("试听"),t("img",{src:e.listActive===n&&e.playState==="play"?W:j},null)]}):t(L,{color:"#259CFE",textColor:"#fff",round:!0,class:a.btn,type:"primary",onClick:p=>{p.stopPropagation(),y(s)}},{default:()=>[g("试听"),t("img",{src:e.listActive===n&&e.playState==="play"?W:j},null)]}),t("img",{class:a.arrow,src:de},null)])])),!e.finshed&&t("div",{ref:b,class:a.loadingWrap},[t(D,{show:!0},null)]),!e.loading&&e.list.length===0&&t("div",{class:a.empty},[t(O,null,null)])])]),t("div",{class:a.musicStaff},[t("div",{class:a.musicName},[d.value.musicSheetName]),t("img",{id:"music-2",style:{display:d.value.id?"":"none"},class:[a.goBtn],src:Ze,onClick:()=>{C("pause");const s=/(localhost|192)/.test(location.host)?"https://test.lexiaoya.cn":location.origin,n="".concat(s,"/instrument?v=").concat(+new Date,"&platform=pc&showGuide=true&id=").concat(d.value.id,"&Authorization=").concat(k.getToken);window.matchMedia("(display-mode: standalone)").matches?(ke.application=window.matchMedia("(display-mode: standalone)").matches,e.previewModal=!0,e.previewUrl=n,e.showPreivew=!1):window.open(n)}},null),t("div",{style:{display:d.value.id?"":"none"},class:a.favitor,onClick:()=>m()},[t(ie,{name:"favitor",mode:"out-in"},{default:()=>[d.value.favitor?t("img",{src:me,key:"1"},null):t("img",{src:fe,key:"2"},null)]})]),t("div",{class:a.staffImgs},[t(ae,{name:"van-fade"},{default:()=>{var s,n,p,T,G;return[(s=d.value)!=null&&s.musicSvg||(n=d.value)!=null&&n.musicImg?(G=((p=d.value)==null?void 0:p.musicSvg)||((T=d.value)==null?void 0:T.musicImg))==null?void 0:G.split(",").map((U,it)=>t("img",{src:U,key:U},null)):t(O,null,null)]}})])])])])]),e.list.length!==0&&t(ue,{show:e.showPlayer,playState:e.playState,item:d.value,onChange:s=>C(s)},null),P.value?t(tt,null,null):null,t(oe,{show:e.previewModal,"onUpdate:show":[s=>e.previewModal=s,s=>{s||(e.previewUrl="")}],class:a.previewWindow,showIcon:!1,displayDirective:"show"},{default:()=>[t(D,{show:e.showPreivew,style:"--n-opacity-spinning: 1;"},{default:()=>[t("img",{style:{display:e.showCloseBtn?"":"none"},src:et,class:a.previewClose,onClick:()=>{e.previewModal=!1,e.previewUrl=""}},null),t("iframe",{class:a.previewIframe,onLoad:()=>{e.showPreivew=!1},frameborder:"0",src:e.previewUrl},null)]})]})])}}});export{ht as default};
|