import{d as a,r as e,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.1720151409021.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(a({setup(a){const k=e({title:t.getTitle(),data:{},list:[],infoList:[],qrcode:"",preview:{index:0,show:!1,loading:!1}});function L(a){const e=k.list[a];_({url:e.path+"?timestamp="+(new Date).getTime(),success:t=>{if(200===t.statusCode){const s=b("cardbg"+a);s.drawImage(t.tempFilePath,0,0,720,1214),s.draw(),setTimeout((()=>{const t=document.getElementById("card"+a);t&&y(t,{useCORS:!1}).then((a=>{e.showPath=a.toDataURL("image/png")}))}),500)}},fail:()=>{e.showed=!1},complete:()=>{setTimeout((()=>{k.preview.loading=!1}),1e3)}})}function T(a){const e=k.list[a];var t,s,i,l,n,o;if(!e.showed&&!k.preview.loading)if(k.preview.loading=!0,e.showed=!0,k.qrcode)L(a);else if("miniprogram"===window.__wxjs_environment&&k.data.appletCode){var d=k.data.appletCode;t=d,s=function(a){k.qrcode=a},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 a=l.toDataURL(i||"image/png");s.call(this,a),l=null},o.src=t,L(a)}else C.toDataURL("https://"+k.data.mallLink+".edstao.com",{width:160,height:160,margin:1}).then((e=>{k.qrcode=e,L(a)})).catch((()=>{k.preview.loading=!1}))}function j(a){k.preview.index=a,T(a)}function I(){t.goBack()}return s((()=>{i.storeCard({link:l("subdomain")}).then((a=>{k.data=a,k.list=a.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}]}))})),(a,e)=>{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,((a,e)=>(n(),o(b,{onClick:a=>function(a){k.preview.index=a,k.preview.show=!0,T(a)}(e)},{default:d((()=>[r(s,{class:"text-center bg-white mg-v-px-10-m"},{default:d((()=>[r(l,{src:a.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(a.name),1)])),_:2},1024)])),_:2},1024),f(" 这个部分是卡片的实体部分，我置底了 "),a.showed?(n(),o(s,{key:0,class:"card",id:"card"+e},{default:d((()=>[r(_,{style:{width:"720px",height:"1214px"},id:"cardbg"+e,"canvas-id":"cardbg"+e},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,(a=>(n(),o(s,{class:"flex"},{default:d((()=>[r(s,{class:"name"},{default:d((()=>[c(m(a.name),1)])),_:2},1024),r(s,{class:"value"},{default:d((()=>[c(m(a.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":e[0]||(e[0]=a=>u(k).preview.show=a),"start-position":u(k).preview.index,closeable:"",images:u(k).list.map((a=>a.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};
