import{d as q,ah as I,ag as S,r as p,$ as D,m,c as a,aj as z,F as i,q as c,B as d,a5 as A,bj as y,e as N,o as L,bv as M,p as k,bG as x,bH as Z,g as G}from"./index.5f7ffb46.js";import{h as v}from"./html2canvas.esm.bd39409e.js";import{O as C}from"./index.6369cc1e.js";import{o as B}from"./orchestra-top_bg.d871f0f3.js";import{O as K}from"./index.7790de2a.js";import{I as r}from"./index.276a5d68.js";const R="_btnHeader_3lqnz_1",V="_iconBack_3lqnz_6",U="_saveShareImage_3lqnz_13",H="_previewSection_3lqnz_28",j="_topImage_3lqnz_47",Y="_shareContaienr_3lqnz_53",J="_orchestraContainer_3lqnz_62",W="_schoolName_3lqnz_66",X="_schoolLogo_3lqnz_72",Q="_shareType_3lqnz_92",O="_qrcodeSection_3lqnz_101",P="_memo_3lqnz_109",$="_endTime_3lqnz_121",ee="_btnGroup_3lqnz_129",ae="_icon_3lqnz_6",oe="_btn_3lqnz_1";var o={btnHeader:R,iconBack:V,saveShareImage:U,previewSection:H,topImage:j,shareContaienr:Y,orchestraContainer:J,schoolName:W,schoolLogo:X,shareType:Q,qrcodeSection:O,memo:P,endTime:$,btnGroup:ee,icon:ae,btn:oe},se="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEwAAABMCAMAAADwSaEZAAAAilBMVEUAAAD////////////+/v7////+/v7////////////////////////+/v7////////////////////////////////////9/f3////////////////////////////////+/v7////+/v7////////////////////////////////9/f3////+/v4G95Y1AAAALXRSTlMACTZV8QX86k7KKSUN+c+lcEgc4Na8m5I1Mi0T8+3awb+3sYp5Z1tDPCIZhYJUHFgjAAABR0lEQVRYw+3V15KDIBiG4d8ERGNJjy3Z9LrL/d/epgzjEfqhHGV4D5F5BkZQcrlcLhcev+cDXcXMiBqNmWxKZA/YmviyLRaglgTyp9gefYkkYgQbS6wTYHEGYiGA3SXYGsDyejo7Di+rRKt57dhAqhbvw1kIG1gSfQYCG9hejcwtYJkaWVrAxmoktYCpIx5ZeZsreuVtrWByPyA+TWVfTKXuvBWsVo9RfFvawZJAfVD6bDNcbl6X9Erv+KEHlo6ewJ8vcvXQ23bG5tXncj5JVRx2xFiN1FULI6zllzGbd8EmmgmRMMdWpKvcmGIhJ22BKXalhhaGWEUNHQyxiBpKDbFf0neThlgyGeq6CAMMCMUKGOPt2Ay1GAEJENshWAZiZwR7MMj64YQU+IDFSsKaivZ1lYQWn8J106p2Z05Gedo4uVwu15f3D+OJ24iJRosgAAAAAElFTkSuQmCC",te="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEwAAABMCAMAAADwSaEZAAAAn1BMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8Kd3m4AAAANHRSTlMA/fnsCBD06NLazbkW46eVj2A4CwXVycSim4AxKCHdroiEeWdUShluPhzui3VyW0K9tX3v38nzcAAAAfJJREFUWMPt1dmWojAUBdATBkFBUMBZy3meuqrP/39bVzehRRdE0HpkP90sQibuJahUKpVKCaOz19A1alZj0B7jHZvhB9M6ZxcvMlsaH2lHE6+4NpnFuqC8o2AOP0JJfeb7ZaCUFlWmKGNFyfbqTIje1JLhEcWZ8iWxBKIpY7UrEHbkgwCFzRlr4NtaNvr4dpKNLooydMY+0lv+TE/DHQpaM9F3MelQGoYIdEqDFz6lsAT/0+KhLMefzRcoyGG++mKMyXr7NV+0AwMF2PlDrTDym5Q0px3hmTpzDMKdI5jWPBlQ6zKT1jZago/sEZQ8ZhFt186eAypbZlm4HWYSSyhMRNavIuoyh1iVzA0xHiZn7hxkZDkyhw8u8gWCj6abmqzXEKYdF5uJsFegHnw+WicL+wIQx/7teDXV0owG79UMO0kFE5t6vDIXZtJvCYXNB+90TUFJ79Zk9LuXRPSgsu8wzRtRqQElc8qUwY5KdTzxyZv+iEpdPNHkjWMKqvSh9m9jljxjHR2qXKDmk82tAYxXp1lrFs6poBtQs5rLdJe9xnxnqI2XEe7MFIkRoSTDzt3kBKVt6sxUC/CCfeZoeoCXhIOMO2CCV617fODhDUFfp1T7m9GHCG8ZXxaz1rA9Alxf4xU/ZuK18IP2qFQqlUoBfwBY2/iSCspkkQAAAABJRU5ErkJggg==",E="./assets/teacher-top_bg.aed1eb2a.png",f="./assets/manage-top_bg.d67ca762.png",F="./assets/logo@2x.f7671d6b.png",me=q({name:"save-share-image",setup(){const u=I();S();const e=p({type:u.query.type,height:0,paramValue:2,schoolName:"",schoolId:"",url:null,schoolLogo:"",loading:!1,name:""}),n=p({saveLoading:!1,image:null,shareLoading:!1}),_=async()=>{if(!n.saveLoading)if(n.saveLoading=!0,n.image)g();else{const s=document.getElementById("preview-container");v(s,{allowTaint:!0,useCORS:!0,backgroundColor:null}).then(async t=>{const l=t.toDataURL("image/png");n.image=l,console.log(l),g()}).catch(()=>{y(),n.saveLoading=!1})}},w=()=>{if(!n.shareLoading)if(n.shareLoading=!0,n.image)h();else{const s=document.getElementById("preview-container");v(s,{allowTaint:!0,useCORS:!0,backgroundColor:null}).then(async t=>{const l=t.toDataURL("image/png");n.image=l,h()}).catch(()=>{y(),n.shareLoading=!1})}},h=()=>{const s=n.image;setTimeout(()=>{n.shareLoading=!1},100),s&&N({api:"shareTripartite",content:{title:"",desc:"",image:s,video:"",type:"image",shareType:"wechat"}},t=>{t&&t.content&&L(t.content.message||(t.content.status?"\u5206\u4EAB\u6210\u529F":"\u5206\u4EAB\u5931\u8D25"))})},g=async()=>{var t;M({message:"\u56FE\u7247\u751F\u6210\u4E2D...",forbidClick:!0}),setTimeout(()=>{n.saveLoading=!1},100);const s=await k({api:"savePicture",content:{base64:n.image}});((t=s==null?void 0:s.content)==null?void 0:t.status)==="success"?x("\u4FDD\u5B58\u6210\u529F"):Z("\u4FDD\u5B58\u5931\u8D25")},T=async()=>{try{const s=(G.user.data.schoolInfos||[]).map(l=>l.id).join(","),t=await m.get(`/api-school/school/detail/${s}`,{});e.schoolName=t.data.name,e.schoolId=t.data.id,e.schoolLogo=t.data.logo?t.data.logo+"@base@tag=imgScale&w=570?t="+ +new Date:"",e.type==="teacher"?e.url=location.origin+"/orchestra-school/#/companion-teacher-register?id="+t.data.id+"&name="+t.data.name+"&t="+ +new Date:e.type==="manage"&&(e.url=location.origin+"/orchestra-school/#/manage-teacher-register?id="+t.data.id+"&name="+t.data.name+"&t="+ +new Date)}catch{}},b=async()=>{try{const s=await m.get("/api-school/orchestra/detail/"+u.query.id);e.schoolName=s.data.name,e.schoolId=s.data.id,e.schoolLogo=s.data.schoolLogo+"@base@tag=imgScale&w=570?t="+ +new Date,e.url=window.location.origin+"/orchestra-student/#/preApply?id="+u.query.id}catch{}};return D(async()=>{e.type==="teacher"?e.name="\u4E50\u56E2\u4F34\u5B66\u8001\u5E08\u6CE8\u518C":e.type==="manage"?e.name="\u4E50\u56E2\u7BA1\u7406\u8001\u5E08\u6CE8\u518C":e.type==="orchestra"&&(e.name="\u4E50\u56E2\u62A5\u540D"),document.title=e.name;try{const{data:s}=await m.get("/api-school/open/paramConfig/queryByParamName",{requestType:"form",params:{paramName:"qr_code_expire_hours"}});e.paramValue=s.paramValue}catch{}e.type==="orchestra"?b():T()}),()=>a("div",{class:[o.saveShareImage]},[a(K,{position:"top",onGetHeight:s=>{e.height=s}},{default:()=>[a(z,{title:e.name},null)]}),e.type==="teacher"&&a(r,{src:E,class:o.topImage,style:{top:e.height+"px"}},null),e.type==="manage"&&a(r,{src:f,class:o.topImage,style:{top:e.height+"px"}},null),e.type==="orchestra"&&a(r,{src:B,class:o.topImage,style:{top:e.height+"px"}},null),a("div",{class:[o.shareContaienr,e.type==="orchestra"&&o.orchestraContainer]},[e.type!=="orchestra"?a(i,null,[a("img",{class:[o.schoolLogo],src:e.schoolLogo||F,crossorigin:"anonymous",style:{objectFit:"cover"}},null),a("div",{class:o.schoolName},[e.schoolName]),a("div",{class:o.shareType},[c("\u9080\u8BF7\u60A8\u6210\u4E3A"),a("span",null,[e.type==="teacher"&&"\u4E50\u56E2\u4F34\u5B66\u8001\u5E08",e.type==="manage"&&"\u4E50\u56E2\u7BA1\u7406\u8001\u5E08"])])]):a(i,null,[a("div",{class:o.schoolName},[c("\u4E50\u56E2\u62A5\u540D")]),a("div",{class:o.shareType},[e.schoolName])]),a("div",{class:o.qrcodeSection},[a(C,{text:e.url,logoSize:"small",size:"100%"},null)]),a("div",{class:o.memo},[c("\u626B\u63CF\u4E0A\u65B9\u4E8C\u7EF4\u7801\u5B8C\u6210\u8D44\u6599\u586B\u5199")]),e.type!=="orchestra"&&a("div",{class:o.endTime},[c("\u4E8C\u7EF4\u7801\u5C06\u5728"),a("span",null,[e.paramValue,c("\u5C0F\u65F6\u540E")]),c("\u5931\u6548\uFF0C\u8BF7\u53CA\u65F6\u767B\u8BB0")])]),a("div",{class:o.btnGroup},[a(d,{class:o.btn,round:!0,block:!0,onClick:_},{default:()=>[a(A,{name:se,class:o.icon},null),c("\u4FDD\u5B58\u56FE\u7247")]}),a(d,{class:o.btn,round:!0,block:!0,onClick:w},{default:()=>[a(A,{name:te,class:o.icon},null),c("\u5206\u4EAB\u5230\u5FAE\u4FE1")]})]),!e.loading&&a("div",{class:[o.previewSection],style:{top:e.height+"px"},id:"preview-container"},[e.type==="teacher"&&a(r,{src:E,class:o.topImage},null),e.type==="manage"&&a(r,{src:f,class:o.topImage},null),e.type==="orchestra"&&a(r,{src:B,class:o.topImage},null),a("div",{class:[o.shareContaienr,e.type==="orchestra"&&o.orchestraContainer]},[e.type!=="orchestra"?a(i,null,[a("img",{class:[o.schoolLogo],src:e.schoolLogo||F,crossorigin:"anonymous",style:{objectFit:"cover"}},null),a("div",{class:o.schoolName},[e.schoolName]),a("div",{class:o.shareType},[c("\u9080\u8BF7\u60A8\u6210\u4E3A"),a("span",null,[e.type==="teacher"&&"\u4E50\u56E2\u4F34\u5B66\u8001\u5E08",e.type==="manage"&&"\u4E50\u56E2\u7BA1\u7406\u8001\u5E08"])])]):a(i,null,[a("div",{class:o.schoolName},[c("\u4E50\u56E2\u62A5\u540D")]),a("div",{class:o.shareType},[e.schoolName])]),a("div",{class:o.qrcodeSection},[a(C,{text:e.url,logoSize:"small",size:"100%"},null)]),a("div",{class:o.memo},[c("\u626B\u63CF\u4E0A\u65B9\u4E8C\u7EF4\u7801\u5B8C\u6210\u8D44\u6599\u586B\u5199")]),e.type!=="orchestra"&&a("div",{class:o.endTime},[c("\u4E8C\u7EF4\u7801\u5C06\u5728"),a("span",null,[e.paramValue,c("\u5C0F\u65F6\u540E")]),c("\u5931\u6548\uFF0C\u8BF7\u53CA\u65F6\u767B\u8BB0")])])])])}});export{me as default};