1 |
- import{b as L,u as $,r as p,d as z,w as j,a as e,g as x,B as A,i as _,S as X,E as H,F as C,M as K,P as J,o as Z,l as I,a4 as E,a5 as G,a6 as Q,H as M,Z as Y,T as ee,q as w,v as te,x as ae,y as se,f as oe,$ as ne,D as ie,c as re}from"./App.3b52122c.js";import"./lib-flexible.08f197e6.js";/* empty css */import{w as ce}from"./wx_bg.fc243df2.js";import{I as D}from"./index.50e45983.js";function _e(){import("data:text/javascript,")}const le="_musicSheet_19i2y_7",ue="_btnWraper_19i2y_21",de="_btn_19i2y_21",pe="_btnCont_19i2y_37",me="_popup_19i2y_43",ge="_share_19i2y_50",he="_avatar_19i2y_66",ve="_mate_19i2y_71",ye="_info_19i2y_79",fe="_topbtn_19i2y_94",we="_fullimg_19i2y_102";var g={musicSheet:le,btnWraper:ue,btn:de,btnCont:pe,popup:me,share:ge,avatar:he,mate:ve,info:ye,topbtn:fe,fullimg:we},Se="/orchestra-music-score/assets/right.5d046f40.svg";const v=L(),t=$(),U=p(0),B=()=>{if(v.isApp){if(v.isTeacher){E.alert({message:"\u8BF7\u4F7F\u7528\u9177\u4E50\u79C0\u5B66\u751F\u7AEF\u626B\u7801\u6253\u5F00"}).then(()=>{M({api:"back"})});return}const u=sessionStorage.getItem("behaviorId")||""+new Date().valueOf(),o=Y.stringifyUrl({url:location.origin+"/orchestra-music-score",query:{id:t.id,behaviorId:u,client:v.isTeacher?"teacher":"student",recomUserId:t.userType&&t.userType=="STUDENT"?"":t.recomUserId,activityId:t.activityId||"0",discounts:U.value}});M({api:"openAccompanyWebView",content:{url:o,orientation:0,isHideTitle:!0,statusBarTextColor:!1,isOpenLight:!0}});return}const{origin:n}=location;let a=n+"/student/#/share-music-sheet";a+=`?recomUserId=${t.userType&&t.userType=="STUDENT"?"":t.recomUserId}&id=${t.id}&activityId=${t.activityId||"0"}`;const l={url:a,action:t.action||"h5",pageTag:t.pageTag||1},i=encodeURIComponent(JSON.stringify(l));/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)?window.location.href=`ColexiuStudent://linkUrl=${i}`:/(Android)/i.test(navigator.userAgent)?(l.url=encodeURIComponent(l.url),window.location.href=`colexiustudent://html:8888/SplashActivity?url=${encodeURIComponent(JSON.stringify(l))}`):ee("\u8BF7\u7528\u624B\u673A\u6216\u79FB\u52A8\u8BBE\u5907\u6253\u5F00")},be=async(n,a)=>{const l=await w(n);let i=p("");const u=te(l);i.value=ae(u.parsedXML,{title:a.musicSheetName});const o=Number(t["part-index"])||0;return i.value=se(i.value,o),i},ke=n=>{const a=p("loading"),l=p({}),i=p({}),u=p(!1);return Z(async()=>{t.activityId&&I.post("/open/activity/state/"+t.activityId,{prefix:"/api-teacher"}).then(o=>{U.value=o.data.check,u.value=!!o.data.check,u.value||E.alert({message:"\u4F18\u60E0\u6D3B\u52A8\u5DF2\u7ED3\u675F\uFF0C\u60A8\u5C06\u6309\u539F\u4EF7\u8D2D\u4E70"})}).catch(()=>{}),a.value="loading";try{const o=await I.post("/open/musicShareProfit",{prefix:G(),requestType:"json",data:{bizId:t.id,userId:t.recomUserId}}),{musicSheet:d,...y}=o.data;l.value={...d},i.value=y,a.value="success"}catch(o){a.value="error",console.log(o)}}),[a,l,i,u]};var xe=z({name:"Colexiu",setup(){const n=p(!1),a=p(!0),l=p(!1),i=p(""),u=p(""),[o,d,y,R]=ke(t.id);j(o,async()=>{if(o.value==="success"&&d.value.xmlFileUrl){if(d.value.musicImg){a.value=!1,u.value=await Q(d.value.musicImg+"?_t="+new Date().valueOf());return}const s=await be(d.value.xmlFileUrl,d.value);i.value=s.value}});const P=s=>{const h=s.Drawer.Backends[0],c=Math.max(h.width,h.height),S=Math.floor(c/240)*5,O=Math.floor(c/200)*5,f=h.CanvasRenderingCtx;f.font="50px \u5B8B\u4F53",f.fillStyle="rgba(0,0,0,.1)",f.rotate(-30*Math.PI/180);for(let b=0;b<S;b++)for(let k=0;k<O;k++)f.fillText("\u9177\u4E50\u79C0",b*240-c,k*200-c/2)},F=s=>I("/open/getUploadSign",{method:"post",data:s,requestType:"json"}),W=async s=>F({filename:s,bucketName:"daya",postData:{filename:s,acl:"public-read",key:s,unknowValueField:[]}}),N=async(s,r,m)=>{const h=await w(s,{responseType:"blob"}),c=new FormData;c.append("policy",m.policy),c.append("signature",m.signature),c.append("acl","public-read"),c.append("KSSAccessKeyId",m.kssAccessKeyId),c.append("name",r),c.append("key",r),c.append("file",h);const S=await w("https://ks3-cn-beijing.ksyuncs.com/daya",{method:"POST",body:c});console.log(S),await w("/api-student/open/music/sheet/img",{method:"post",data:{musicImg:"https://ks3-cn-beijing.ksyuncs.com/daya/"+r,musicSheetId:d.value.id}})},q=async s=>{try{const r="music-sheet/"+d.value.musicSheetName+".png",m=s.Drawer.Backends[0].canvas.toDataURL("image/png"),h=await W(r);await N(m,r,h.data)}catch(r){console.log(r)}P(s),B(),a.value=!1},V=()=>{l.value=!0,a.value=!1},T=()=>{v.weixin?n.value=!0:(B(),v.isApp||setTimeout(()=>{location.href=location.origin+"/student/#/download"},3e3))};return()=>{const s=a.value||o.value==="loading",r=l.value||o.value==="error",m=y.value&&R.value;return e("div",{class:[_.container],style:{background:"#fff",paddingTop:m?"80px":0}},[m&&e("div",{class:g.share},[e(D,{radius:"100%",class:g.avatar,src:y.value.avatar},null),e("div",{class:g.mate},[e("div",{class:g.info},[e("span",null,[y.value.name,x("\u8001\u5E08")]),e("span",null,[x("\u4E13\u5C5E\u5206\u4EAB\uFF5E")])]),e(A,{class:g.topbtn,onClick:T},{default:()=>[x("\u5F00\u901A\u4F1A\u5458\u4E13\u5C5E\u4F18\u60E0"),e("img",{src:Se},null)]})])]),e("div",{id:"colexiu-detail-music-sheet",class:[_.musicSheet,g.musicSheet],style:{paddingBottom:"100px!important"}},[s&&!r&&e(X,{class:_.skeleton,rowWidth:"80%",title:!0,row:3},null),r&&e(H,null,null),u.value&&e(C,null,[e("h3",{style:{fontSize:"24px",fontWeight:"normal",textAlign:"center",padding:"0 10px",marginTop:"36px",marginBottom:"0px"},class:"van-ellipsis"},[d.value.musicSheetName]),e(D,{class:g.fullimg,src:u.value,alt:"",style:{width:"100%",display:"block!important"}},null)]),!u.value&&i.value&&e(C,null,[e("h3",{style:{fontSize:"24px",fontWeight:"normal",textAlign:"center",padding:"0 10px",marginTop:"36px",marginBottom:"0px"},class:"van-ellipsis"},[d.value.musicSheetName]),e(K,{score:i.value,showSection:!1,opotions:{drawTitle:!1,drawComposer:!0,drawLyricist:!1,drawMetronomeMarks:!0,drawMeasureNumbers:!0,autoResize:!1,backend:"canvas"},EngravingRules:{VoiceSpacingMultiplierVexflow:.65,VoiceSpacingAddendVexflow:2,MinSkyBottomDistBetweenStaves:2,MinSkyBottomDistBetweenSystems:3,BetweenStaffDistance:2.5,StaffDistance:3.5,MinimumDistanceBetweenSystems:1,PageBottomMargin:0,PageLeftMargin:2,PageRightMargin:2},onRerender:q,onRenderError:V},null)])]),e("div",{class:g.btnWraper},[e(A,{onClick:T,class:g.btn,color:"linear-gradient(to bottom, #55F1CC, #2DC7AA)"},{default:()=>[v.isApp?"\u6253\u5361\u5C0F\u9177Ai\u5F00\u59CB\u7EC3\u4E60\u5427\uFF01":"\u4E0B\u8F7D\u9177\u4E50\u79C0\u7ACB\u5373\u7EC3\u4E60"]})]),e(J,{show:n.value,position:"top",style:{background:"none"}},{default:()=>[e("img",{src:ce,style:{width:"80%",display:"block",margin:"auto"}},null)]})])}}});document.body.style.setProperty("--osdm-zoom",""+oe());ne({api:"getToken"}).then(n=>{var a;console.log("\u83B7\u53D6token",n),(a=n==null?void 0:n.content)!=null&&a.accessToken&&sessionStorage.setItem("Authorization",n.content.tokenType+" "+n.content.accessToken)});ie();re(xe).mount("#app");export{_e as __vite_legacy_guard};
|