import{d as e,r as a,P as t,o as s,c as i,g as l,f as n,h as o,w as d,j as r,l as c,t as m,u,m as p,n as h,F as g,k as f,e as w,x as v,a4 as x,a5 as _,a6 as b}from"./index.ef18fbfd.js";import{b as C}from"./browser.c7be5676.js";import{h as y}from"./html2canvas.esm.3d083717.js";import{_ as k}from"./plugin-vue_export-helper.21dcd24c.js";var L=k(e({setup(e){const k=a({title:t.getTitle(),data:{},list:[],infoList:[],qrcode:"",preview:{index:0,show:!1,loading:!1}});function L(e){const a=k.list[e];_({url:a.path+"?timestamp="+(new Date).getTime(),success:t=>{if(200===t.statusCode){const s=b("cardbg"+e);s.drawImage(t.tempFilePath,0,0,720,1214),s.draw(),setTimeout((()=>{const t=document.getElementById("card"+e);t&&y(t,{useCORS:!1}).then((e=>{a.showPath=e.toDataURL("image/png")}))}),500)}},fail:()=>{a.showed=!1},complete:()=>{setTimeout((()=>{k.preview.loading=!1}),1e3)}})}function T(e){const a=k.list[e];var t,s,i,l,n,o;if(!a.showed&&!k.preview.loading)if(k.preview.loading=!0,a.showed=!0,k.qrcode)L(e);else if("miniprogram"===window.__wxjs_environment&&k.data.appletCode){var d=k.data.appletCode;t=d,s=function(e){k.qrcode=e},l=document.createElement("CANVAS"),n=l.getContext("2d"),(o=new Image).crossOrigin="Anonymous",o.onload=function(){l.height=o.height,l.width=o.width,n.drawImage(o,0,0);var e=l.toDataURL(i||"image/png");s.call(this,e),l=null},o.src=t,L(e)}else C.toDataURL("https://"+k.data.mallLink+".edstao.com",{width:160,height:160,margin:1}).then((a=>{k.qrcode=a,L(e)})).catch((()=>{k.preview.loading=!1}))}function j(e){k.preview.index=e,T(e)}function I(){t.goBack()}return s((()=>{i.storeCard({link:l("subdomain")}).then((e=>{k.data=e,k.list=e.cards,k.infoList=[{name:"商城名称：",value:k.data.mallName},{name:"商城网址：",value:k.data.mallLink+".edstao.com"},{name:"联系电话：",value:k.data.mallContact},{name:"门店地址：",value:k.data.storeAddress}]}))})),(e,a)=>{const t=w("van-icon"),s=v,i=w("van-sticky"),l=w("van-image"),_=x,b=w("van-grid-item"),C=w("van-grid"),y=w("van-image-preview"),L=w("van-overlay");return n(),o(s,{class:"bg-max bg-gray"},{default:d((()=>[r(i,null,{default:d((()=>[r(s,{class:"justify-center bg-white sh pd-px-20 mg-b-20"},{default:d((()=>[r(t,{class:"top-left",name:"arrow-left",onClick:I}),r(s,{class:"top-center"},{default:d((()=>[c(m(u(k).title),1)])),_:1})])),_:1})])),_:1}),r(C,{"column-num":2,gutter:5,class:"bg-gray pd-b-px-60"},{default:d((()=>[(n(!0),p(g,null,h(u(k).list,((e,a)=>(n(),o(b,{onClick:e=>function(e){k.preview.index=e,k.preview.show=!0,T(e)}(a)},{default:d((()=>[r(s,{class:"text-center bg-white mg-v-px-10-m"},{default:d((()=>[r(l,{src:e.path,width:"322rpx",height:"543rpx","loading-icon":"https://img.edsmall.com/ROOT/ETao/fenxiao/h5/default1.png","icon-size":"322rpx"},null,8,["src"]),r(s,null,{default:d((()=>[c(m(e.name),1)])),_:2},1024)])),_:2},1024),f(" 这个部分是卡片的实体部分，我置底了 "),e.showed?(n(),o(s,{key:0,class:"card",id:"card"+a},{default:d((()=>[r(_,{style:{width:"720px",height:"1214px"},id:"cardbg"+a,"canvas-id":"cardbg"+a},null,8,["id","canvas-id"]),r(s,{class:"info flex"},{default:d((()=>[r(s,null,{default:d((()=>[r(l,{width:"160px",height:"160px",src:u(k).qrcode,"loading-icon":"https://img.edsmall.com/ROOT/ETao/fenxiao/h5/default1.png","icon-size":"160px"},null,8,["src"]),r(s,{class:"tip"},{default:d((()=>[c("扫码获取更多活动信息")])),_:1})])),_:1}),r(s,{class:"detail"},{default:d((()=>[(n(!0),p(g,null,h(u(k).infoList,(e=>(n(),o(s,{class:"flex"},{default:d((()=>[r(s,{class:"name"},{default:d((()=>[c(m(e.name),1)])),_:2},1024),r(s,{class:"value"},{default:d((()=>[c(m(e.value),1)])),_:2},1024)])),_:2},1024)))),256))])),_:2},1024)])),_:2},1024)])),_:2},1032,["id"])):f("v-if",!0)])),_:2},1032,["onClick"])))),256))])),_:1}),r(s,{class:"fixed-bottom text-center bg-white pd-30 br-t",style:{"z-index":"1"}},{default:d((()=>[c("点击查高清图")])),_:1}),r(y,{show:u(k).preview.show,"onUpdate:show":a[0]||(a[0]=e=>u(k).preview.show=e),"start-position":u(k).preview.index,closeable:"",images:u(k).list.map((e=>e.showPath)),onChange:j,showIndex:!1},null,8,["show","start-position","images"]),f(" 因为生成卡片会卡，所以加载完一张之后，再让用户操作 "),r(L,{show:u(k).preview.loading,style:{"z-index":"2003"}},null,8,["show"])])),_:1})}}}),[["__scopeId","data-v-2746652f"]]);export{L as default};
