colxiu-share.2541b52c.js 7.3 KB

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