acdr-ui/dist/build/mp-weixin/sheep/components/s-share-modal/canvas-poster/index.js

2 lines
1.8 KiB
JavaScript

"use strict";var e=(e,t,s)=>new Promise(((o,a)=>{var n=e=>{try{i(s.next(e))}catch(t){a(t)}},r=e=>{try{i(s.throw(e))}catch(t){a(t)}},i=e=>e.done?o(e.value):Promise.resolve(e.value).then(n,r);i((s=s.apply(e,t)).next())}));const t=require("../../../../common/vendor.js"),s=require("../../../index.js"),o=require("./poster/index.js");if(!Array){(t.resolveComponent("l-painter")+t.resolveComponent("su-popup"))()}Math||((()=>"../../../../uni_modules/lime-painter/components/l-painter/l-painter.js")+(()=>"../../../ui/su-popup/su-popup.js"))();const a={__name:"index",props:{show:{type:Boolean,default:!1},shareInfo:{type:Object,default:()=>{}}},emits:["success","close"],setup(a,{expose:n,emit:r}){const i=a,p=t.reactive({css:{width:.9*s.sheep.$platform.device.windowWidth,height:600},views:[]}),l=r,u=()=>{l("close")},c=t.ref(),h=t.ref(),f=()=>e(this,null,(function*(){yield c.value.render(t.unref(p))})),d=e=>{h.value=e},v=()=>{["WechatOfficialAccount","H5"].includes(s.sheep.$platform.name)?s.sheep.$helper.toast("请长按图片保存"):t.index.saveImageToPhotosAlbum({filePath:h.value,success:e=>{u(),s.sheep.$helper.toast("保存成功")},fail:e=>{s.sheep.$helper.toast("保存失败")}})};return n({getPoster:function(){return e(this,null,(function*(){h.value=void 0,p.views=yield o.getPosterData({width:p.css.width,shareInfo:i.shareInfo}),yield f()}))}}),(e,o)=>t.e({a:!!h.value},h.value?{b:h.value,c:p.css.height+"px",d:p.css.width+"px"}:{},{e:!!h.value},h.value?{f:t.o(u),g:t.t(["wechatOfficialAccount","H5"].includes(t.unref(s.sheep).$platform.name)?"长按图片保存":"保存图片"),h:t.o(v)}:{},{i:t.sr(c,"8c14f40f-1,8c14f40f-0",{k:"painterRef"}),j:t.o(d),k:t.p({isCanvasToTempFilePath:!0,pathType:"url",hidden:!0}),l:t.o(u),m:t.p({show:a.show,round:"10",type:"center"})})}},n=t._export_sfc(a,[["__scopeId","data-v-8c14f40f"]]);wx.createComponent(n);