import{d as b,ah as I,ag as S,r as p,$ as D,m as h,c as a,aj as N,F as u,q as c,B as d,a5 as A,bf as v,e as L,o as R,bq as M,p as k,bD as x,bE as G,g as Z}from"./index.332c7f08.js";import{h as y}from"./html2canvas.esm.3d083717.js";import{O as f}from"./index.20ac1dfd.js";import{o as C}from"./orchestra-top_bg.d871f0f3.js";import{O as K}from"./index.d7c1b6ac.js";import{I as r}from"./index.96a8db5e.js";const V="_btnHeader_qv2f4_1",U="_iconBack_qv2f4_6",Y="_saveShareImage_qv2f4_13",H="_previewSection_qv2f4_28",j="_topImage_qv2f4_35",z="_shareContaienr_qv2f4_41",J="_orchestraContainer_qv2f4_50",W="_schoolName_qv2f4_54",X="_schoolLogo_qv2f4_60",Q="_shareType_qv2f4_80",O="_qrcodeSection_qv2f4_89",P="_memo_qv2f4_97",$="_endTime_qv2f4_109",ee="_btnGroup_qv2f4_117",ae="_icon_qv2f4_6",oe="_btn_qv2f4_1";var o={btnHeader:V,iconBack:U,saveShareImage:Y,previewSection:H,topImage:j,shareContaienr:z,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",B="./assets/manage-top_bg.d67ca762.png",F="./assets/logo@2x.f7671d6b.png",he=b({name:"save-share-image",setup(){const i=I();S();const e=p({type:i.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");y(s,{allowTaint:!0,useCORS:!0,backgroundColor:null}).then(async t=>{const l=t.toDataURL("image/png");n.image=l,g()}).catch(()=>{v(),n.saveLoading=!1})}},w=()=>{if(!n.shareLoading)if(n.shareLoading=!0,n.image)m();else{const s=document.getElementById("preview-container");y(s,{allowTaint:!0,useCORS:!0,backgroundColor:null}).then(async t=>{const l=t.toDataURL("image/png");n.image=l,m()}).catch(()=>{v(),n.shareLoading=!1})}},m=()=>{const s=n.image;setTimeout(()=>{n.shareLoading=!1},100),s&&L({api:"shareTripartite",content:{title:"",desc:"",image:s,video:"",type:"image",shareType:"wechat"}},t=>{t&&t.content&&R(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"):G("\u4FDD\u5B58\u5931\u8D25")},T=async()=>{try{const s=(Z.user.data.schoolInfos||[]).map(l=>l.id).join(","),t=await h.get(`/api-school/school/detail/${s}`,{});e.schoolName=t.data.name,e.schoolId=t.data.id,e.schoolLogo=t.data.logo?t.data.logo+"?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{}},q=async()=>{try{const{data:s}=await h.get("/api-school/orchestra/detail/"+i.query.id);e.schoolName=s.name,e.schoolId=s.id,e.schoolLogo=s.schoolLogo+"?t="+ +new Date,s.orchestraRegisterType==="GROUP_BUY"?e.url=window.location.origin+"/orchestra-student/#/preGoodsApply?id="+i.query.id:s.orchestraRegisterType==="PARENT_CONFERENCES"?e.url=window.location.origin+"/orchestra-student/#/pre-register-active?id="+i.query.id:e.url=window.location.origin+"/orchestra-student/#/preApply?id="+i.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 h.get("/api-school/open/paramConfig/queryByParamName",{requestType:"form",params:{paramName:"qr_code_expire_hours"}});e.paramValue=s.paramValue}catch{}e.type==="orchestra"?q():T()}),()=>a("div",{class:[o.saveShareImage]},[a(K,{position:"top",onGetHeight:s=>{e.height=s}},{default:()=>[a(N,{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:B,class:o.topImage,style:{top:e.height+"px"}},null),e.type==="orchestra"&&a(r,{src:C,class:o.topImage,style:{top:e.height+"px"}},null),a("div",{class:[o.shareContaienr,e.type==="orchestra"&&o.orchestraContainer]},[e.type!=="orchestra"?a(u,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(u,null,[a("div",{class:o.schoolName},[c("\u4E50\u56E2\u62A5\u540D")]),a("div",{class:o.shareType},[e.schoolName])]),a("div",{class:o.qrcodeSection},[a(f,{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.saveShareImage,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:B,class:o.topImage},null),e.type==="orchestra"&&a(r,{src:C,class:o.topImage},null),a("div",{class:[o.shareContaienr,e.type==="orchestra"&&o.orchestraContainer]},[e.type!=="orchestra"?a(u,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(u,null,[a("div",{class:o.schoolName},[c("\u4E50\u56E2\u62A5\u540D")]),a("div",{class:o.shareType},[e.schoolName])]),a("div",{class:o.qrcodeSection},[a(f,{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{he as default};