musicUtil.23042a44.js 1.9 KB

1
  1. import{d as p,b as u,i as s}from"./index.1b3483ad.js";import{a as d}from"./objectUtil.ec24ceed.js";import{c as m}from"./constant.96766a29.js";const T=p({name:"musicPreView",props:{item:{type:Object,default:()=>{}},scoreType:{type:String,default:"staff"},isMove:{type:Number,default:0,required:!1}},setup(e,{emit:o}){const t=u().getToken,n={dev:"https://dev.kt.colexiu.com",test:"https://test.lexiaoya.cn",online:"https://mec.colexiu.com"},a=location.origin.includes("//dev")?"dev":location.origin.includes("//test")?"test":location.origin.includes("//mec.colexiu")?"online":"dev",c=n[a];let i=(/(localhost|192)/.test(location.host)?"https://dev.kt.colexiu.com/":c)+`/instrument/?_t=${Date.now()}&id=${e.item.id}&modelType=practise&modeType=json&Authorization=${t}&isCbs=true`;return i=e.isMove==1?i+"&isMove=1":i,i+="&musicRenderType="+e.scoreType,()=>s("div",null,[s("iframe",{width:"667px",height:"375px",frameborder:"0",src:i},null)])}}),N=(e,o)=>{if(o=="PLATFORM")return"--";let r="";if(e){const t=e.applicationName;if(o=="ORG"){const n=e.organizationRole?"-"+e.organizationRole:"";r+=t+n}else if(o=="PERSON"){e!=null&&e.userName&&(r=e.userName);let n=d(e.clientType,new Map(Object.entries(m)));n=n?"-"+n:"",r+=" ("+t+n+")"}}return r},R=(e,o)=>{const r=o.toString();let t=document.querySelector("#copy-input");t||(t=document.createElement("input"),t.id="copy-input",t.readOnly=!0,t.style.position="fixed",t.style.left="-1000px",t.style.zIndex="-1000",document.body.appendChild(t)),t.value=r,n(t,0,r.length),document.execCommand("copy")&&(document.execCommand("copy"),e.success("\u590D\u5236\u6210\u529F")),t.blur();function n(a,c,l){if(a.createTextRange){const i=a.createTextRange();i.collapse(!0),i.moveStart("character",c),i.moveEnd("character",l-c),i.select()}else a.setSelectionRange(c,l),a.focus()}},f=e=>{e.map(o=>(o&&(o.disabled=!o.enable),o.children&&o.children.length>0&&f(o.children),e))};export{T as M,R as c,f,N as g};