import{d as Z,P as ee,U as l,S as te,a3 as se,V as ae,Y as $,W as oe,i as e,F as D,A as u,N as S,B as le,aT as K,e as W,s as ue,b as ne}from"./index.7994470a.js";import{C as ie}from"./index.c5bf3ab5.js";import{C as x}from"./index.777f4790.js";import{C as ce}from"./index.9cdb5783.js";import{I as _}from"./index.2fbdc579.js";import{R as re,a as T}from"./index.9dc8689d.js";import"./index.c9af17c2.js";import{S as me}from"./index.6449f9de.js";import{T as fe}from"./index.0262b810.js";import{i as de,a as _e,V as pe,A as ve,e as he,b as ge,c as Ce,d as ye,D as be,s as Ie,f as je,g as Se}from"./download.974c7297.js";import{g as xe}from"./music.d2ae34a8.js";import{C as Fe}from"./index.aaa3ed2b.js";import{i as we}from"./icon_album.fa329df6.js";import{i as Ee}from"./icon_teacher.40b6f077.js";import{a as A,i as B}from"./icon_checkbox_default.2fe5d57e.js";import{P as ke}from"./plyr.623e6d1e.js";import{i as De}from"./icon_exquisite.69e33c80.js";import{i as Te}from"./icon_album_active.ce98b2a8.js";import{w as Ae}from"./wx_bg.cce2a6c0.js";import{i as Be,s as Ne}from"./share.905d1919.js";import{q as qe}from"./index.570461cd.js";import"./index.0a2aeb2c.js";import"./use-height.ffa5a0f3.js";import"./index.889feca1.js";const Le="_base_1urjh_1",Ve="_detail_1urjh_4",Pe="_shareBtn_1urjh_21",Re="_bgImg_1urjh_33",Ue="_bgContent_1urjh_42",Oe="_musicContent_1urjh_51",ze="_musicTitle_1urjh_66",Me="_musicImg_1urjh_70",Ge="_finch_1urjh_73",Je="_finchLoad_1urjh_77",He="_collectCell_1urjh_92",$e="_videoOperation_1urjh_99",Ke="_audition_1urjh_106",We="_collect_1urjh_92",Ye="_userInfo_1urjh_132",Qe="_collectSection_1urjh_152",Xe="_lookAlbum_1urjh_171",Ze="_bg_1urjh_33",et="_musicContainer_1urjh_197",tt="_shareMate_1urjh_204",st="_icon_1urjh_214",at="_info_1urjh_219",ot="_tagDiscount_1urjh_235",lt="_shareVip_1urjh_248",ut="_buttonDiscount_1urjh_290",nt="_pImg_1urjh_303",it="_musicInfo_1urjh_310",ct="_coomposer_1urjh_315",rt="_tag_1urjh_235",mt="_download_1urjh_349",ft="_exquisiteFlag_1urjh_360",dt="_songAlbum_1urjh_365",_t="_colSticky_1urjh_375",pt="_priceSection_1urjh_380",vt="_price_1urjh_380",ht="_buyBtn_1urjh_394",gt="_primry_1urjh_408",Ct="_member_1urjh_411",yt="_functionSection_1urjh_414",bt="_empty_1urjh_417",It="_emptyImg_1urjh_425",jt="_staffContainer_1urjh_428",St="_staffTitle_1urjh_431",xt="_staffImg_1urjh_437",Ft="_name_1urjh_441",wt="_boxStyle_1urjh_447",Et="_active_1urjh_453";var t={base:Le,detail:Ve,shareBtn:Pe,bgImg:Re,bgContent:Ue,musicContent:Oe,musicTitle:ze,musicImg:Me,finch:Ge,finchLoad:Je,collectCell:He,videoOperation:$e,audition:Ke,collect:We,userInfo:Ye,collectSection:Qe,lookAlbum:Xe,bg:Ze,musicContainer:et,shareMate:tt,icon:st,info:at,tagDiscount:ot,shareVip:lt,buttonDiscount:ut,pImg:nt,musicInfo:it,coomposer:ct,tag:rt,download:mt,exquisiteFlag:ft,songAlbum:dt,colSticky:_t,priceSection:pt,price:vt,buyBtn:ht,primry:gt,member:Ct,functionSection:yt,empty:bt,emptyImg:It,staffContainer:jt,staffTitle:St,staffImg:xt,name:Ft,boxStyle:wt,active:Et},Zt=Z({name:"MusicDetail",setup(){localStorage.setItem("behaviorId",xe());const N=ee(),I=l(!1),q=l(!1),L=l(null),V=l(null),P=l("0"),s=l(null),h=l(""),F=l(!1);let f=[];const R=l([]),U=l([]),O=l([]);l("");const z=l(!1),i=te({status:!1,radio:"staff"}),Y=`${location.origin}/student/#/music-detail?${qe.stringify(N.query)}`,M=l(Y),G={FREE:{color:"#01B84F",text:"\u514D\u8D39"},VIP:{color:"#CD863E",text:"\u4F1A\u5458"},CHARGE:{color:"#3591CE",text:"\u70B9\u64AD"}},w=o=>{i.radio=o,i.status=!1};se(()=>i.radio,o=>{o=="first"?f=R.value:o=="fixed"?f=U.value:f=O.value});const Q=async o=>{var n,r,c,d,m,C,y,a;if(!I.value){I.value=!0,q.value=!1;try{const p=N.query,b=await W.post("/open/musicShareProfit",{prefix:"/api-teacher",requestType:"json",data:{bizId:p.id,userId:p.recomUserId}}),v=b.data.musicSheet.background;h.value=v&&v.length>0?v[0].audioFileUrl:"",console.log(h.value),s.value=b.data.musicSheet,f=(n=s.value)!=null&&n.musicImg?(r=s.value)==null?void 0:r.musicImg.split(","):[],R.value=(c=s.value)!=null&&c.firstTone?(d=s.value)==null?void 0:d.firstTone.split(","):[],U.value=(m=s.value)!=null&&m.fixedTone?(C=s.value)==null?void 0:C.fixedTone.split(","):[],O.value=(y=s.value)!=null&&y.musicImg?(a=s.value)==null?void 0:a.musicImg.split(","):[]}catch{q.value=!0}I.value=!1}},E=l(null),J=l(null),k=l(0),X=async()=>{var r;const o=await W.get(ue.platformApi+"/sysConfig/queryByParamNameList",{params:{paramNames:"music_sheet_free_rate"}});k.value=((r=o.data[0])==null?void 0:r.paramValue)||0;const n=["play","progress","duration"];E.value=new ke(J.value,{controls:n}),E.value.on("timeupdate",()=>{var m;const c=E.value,d=c.duration*k.value/100||0;c.currentTime>=d&&((m=s.value)==null?void 0:m.orderStatus)!=="PAID"&&!j.value.includes("FREE")&&c.pause()})};ae(async()=>{Be(M.value),await Q();const{height:o}=$(L),n=$(V);P.value=o+n.height,h.value&&X()});const j=oe(()=>{var n;let o=(n=s.value)==null?void 0:n.paymentType;return typeof o=="string"?(o=o.split(","),o):[]}),g=()=>{if(ne().weixin){F.value=!0;return}Ne(M.value),setTimeout(()=>{window.location.href=location.origin+"/student/#/download"},3e3)};return()=>{var o,n,r,c,d,m,C,y;return e("div",{class:t.detail},[e(me,{position:"top"},{default:()=>[e("div",{ref:L},[e(ie,{background:"transparent",border:!1,isFixed:!1,color:"#fff",backIconColor:"white"},null)])]}),e("img",{class:t.bgImg,src:(o=s.value)==null?void 0:o.titleImg},null),e("div",{class:t.bgContent},null),e("div",{class:t.musicContainer,style:{marginTop:"16px",height:`calc(100vh - ${P.value+16+"px"})`}},[e(x,{border:!1,center:!0,class:t.musicInfo},{icon:()=>{var a;return e(_,{class:t.pImg,src:(a=s.value)==null?void 0:a.titleImg},null)},title:()=>{var a,p,b,v;return e("div",{class:t.info},[e("h4",{class:"van-ellipsis"},[(a=s.value)==null?void 0:a.musicSheetName]),e("p",{style:{display:"flex"}},[j.value.map(H=>e(fe,{style:{color:G[H].color},class:t.tag,type:"success",plain:!0},{default:()=>[G[H].text]})),((p=s.value)==null?void 0:p.exquisiteFlag)===1&&e(_,{class:t.exquisiteFlag,src:De},null),((b=s.value)==null?void 0:b.albumNums)>0&&e(_,{class:t.songAlbum,src:Te},null),e("span",{style:{paddingTop:"2px",paddingLeft:"6px"}},[(v=s.value)==null?void 0:v.composer])])])},value:()=>{var a;return e(D,null,[(a=s.value)!=null&&a.notation?e("span",{class:t.download,onClick:()=>g()},[e("img",{src:de},null),e("span",null,[u("\u8F6C\u8C31")])]):null,e("span",{class:t.download,onClick:()=>g()},[e("img",{src:_e},null),e("span",null,[u("\u4E0B\u8F7D\u66F2\u8C31")])])])}}),e("div",{class:t.musicContent},[e("p",{class:t.musicTitle},[(n=s.value)==null?void 0:n.musicSheetName]),f.length>0?e("img",{src:f[0],alt:"",class:t.musicImg},null):I.value?e(D,null,[e(pe,{animationData:ve,class:t.finch},null),e("p",{class:t.finchLoad},[u("\u52A0\u8F7D\u4E2D...")])]):e("div",{class:t.empty},[e(_,{src:he,class:t.emptyImg},null),e("p",{class:t.emptyTip},[u("\u6682\u65E0\u4E50\u8C31\u9884\u89C8\u56FE")])]),e("div",{class:t.videoOperation},[h.value&&e(D,null,[(j.value.includes("CHARGE")||j.value.includes("VIP"))&&((r=s.value)==null?void 0:r.orderStatus)!=="PAID"&&e("div",{class:[t.audition]},[e("img",{src:ge},null),e("span",null,[u("\u6BCF\u9996\u66F2\u76EE\u53EF\u8BD5\u542C"),k.value,u("%")])]),e("div",{class:[t.audio,t.collectCell]},[e("audio",{id:"player",controls:!0,ref:J},[e("source",{src:h.value,type:"audio/mp3"},null)])])]),e("div",{class:[t.collect,t.collectCell]},[e("div",{class:[t.userInfo]},[e("img",{src:((c=s.value)==null?void 0:c.userAvatar)||Ee},null),e("span",null,[(d=s.value)==null?void 0:d.userName])]),e("div",{class:[t.collectSection],onClick:()=>g()},[e("span",null,[(m=s.value)==null?void 0:m.favoriteCount,u("\u4EBA\u6536\u85CF")]),e("img",{src:(C=s.value)!=null&&C.favorite?Ce:ye},null)])])])]),e("div",{class:[t.lookAlbum,t.collectCell],onClick:()=>{g()}},[e("div",null,[e("img",{src:we},null),e("span",null,[u("\u8FDB\u5165\u66F2\u76EE\u6240\u5728\u4E13\u8F91\u5217\u8868")])]),e(S,{name:"arrow",size:16,color:"#666"},null)])]),((y=s.value)==null?void 0:y.id)&&e(Fe,{position:"bottom",background:"white"},{default:()=>[e("div",{ref:V},[e(le,{round:!0,block:!0,type:"primary",color:"linear-gradient(180deg, #59E5D5 0%, #2DC7AA 100%)",onClick:()=>g()},{default:()=>[u("\u4E0B\u8F7D\u9177\u4E50\u79C0\u8FDB\u5165\u8BE6\u60C5")]})])]}),e(K,{show:z.value,"onUpdate:show":a=>z.value=a,position:"bottom",round:!0},{default:()=>[e(be,{imgList:JSON.parse(JSON.stringify(f)),musicSheetName:s.value.musicSheetName},null)]}),e(K,{show:i.status,"onUpdate:show":a=>i.status=a,teleport:"body",closeable:!0,style:{width:"80%"},round:!0},{default:()=>[e("div",{class:t.staffContainer},[e("div",{class:t.staffTitle},[u("\u9009\u62E9\u8F6C\u6362\u66F2\u8C31")]),e(re,{modelValue:i.radio,"onUpdate:modelValue":a=>i.radio=a},{default:()=>[e(ce,{border:!1},{default:()=>[e(x,{center:!0,border:!1,class:i.radio==="staff"?t.active:"",onClick:()=>w("staff")},{icon:()=>e(_,{src:Ie,class:t.staffImg},null),title:()=>e("span",{class:t.name},[u("\u4E94\u7EBF\u8C31")]),value:()=>e(T,{name:"staff"},{icon:a=>e(S,{class:t.boxStyle,size:16,name:a.checked?A:B},null)})}),e(x,{center:!0,border:!1,class:i.radio==="first"?t.active:"",onClick:()=>w("first")},{icon:()=>e(_,{src:je,class:t.staffImg},null),title:()=>e("span",{class:t.name},[u("\u7B80\u8C31-\u9996\u8C03")]),value:()=>e(T,{name:"first"},{icon:a=>e(S,{class:t.boxStyle,size:16,name:a.checked?A:B},null)})}),e(x,{center:!0,border:!1,class:i.radio==="fixed"?t.active:"",onClick:()=>w("fixed")},{icon:()=>e(_,{src:Se,class:t.staffImg},null),title:()=>e("span",{class:t.name},[u("\u7B80\u8C31-\u56FA\u5B9A\u8C03")]),value:()=>e(T,{name:"fixed"},{icon:a=>e(S,{class:t.boxStyle,size:16,name:a.checked?A:B},null)})})]})]})])]}),F.value&&e("div",{class:t.wxpopup,onClick:()=>{F.value=!1}},[e("img",{src:Ae,alt:""},null)])])}}});export{Zt as default};