require('../../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/goods/components/sendGiftPoster/index"],{"739fe":function(t,e,a){"use strict";(function(t){var n=a("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i=n(a("7eb4")),o=n(a("ee10")),s=a("4d38"),r={data:function(){return{aleartData:{},bag:s.HTTP_REQUEST_URL+"/statics/images/canvas-bag.png",giftBorder:s.HTTP_REQUEST_URL+"/statics/images/gift-border.png",giftbag:s.HTTP_REQUEST_URL+"/statics/images/gift-bag.png",codeShow:!1,cid:"1",codeVal:"",size:200,unit:"upx",background:"#FFF",foreground:"#000",pdground:"#000",codeIcon:"",iconsize:40,lv:3,onval:!0,loadMake:!0,PromotionCode:"",posterImageStatus:!1,posterImage:""}},props:{giftData:{type:Object},aleartStatus:{type:Boolean,default:!1}},watch:{aleartStatus:function(t){t?this.PromotionCode=this.giftData.code:this.aleartData={}}},methods:{copyLink:function(){var e=this;t.setClipboardData({data:this.codeVal,success:function(){e.$util.Tips({title:"复制成功"})}})},qrR:function(t){},posterImageClose:function(){this.posterImageStatus=!1,this.$emit("close",!1)},drawPoster:function(e,a,n){function s(t,e){return t.length>e?t.substring(0,e)+"...":t}var r=t.createCanvasContext("posterCanvas");return new Promise(function(){var c=(0,o.default)(i.default.mark((function o(c,u){return i.default.wrap((function(i){while(1)switch(i.prev=i.next){case 0:t.getImageInfo({src:e[0],success:function(i){r.drawImage(e[0],0,0,375,579),r.save();var o=a;r.setFontSize(14);var f=r.measureText("送你一份礼物").width,d=r.measureText(o).width,l=32+d+10+f,g=(375-l)/2,h=g+11;r.save(),r.beginPath(),r.arc(h,58,11,0,2*Math.PI),r.clip(),r.drawImage(e[3],g,47,22,22),r.restore(),r.setFontSize(14),r.setTextAlign("left"),r.fillText(o,g+22+10,64),r.setFontSize(14),r.fillText("送你一份礼物",g+22+10+d+10,64);r.drawImage(e[1],75,100,225,225);r.drawImage(e[2],85,121,205,195);var p=n,v=s(p,20);r.setFontSize(14),r.setTextAlign("center"),r.fillText(v,187.5,351);r.drawImage(e[4],137.5,388,100,100),r.draw(!1,(function(){t.canvasToTempFilePath({canvasId:"posterCanvas",width:375,height:579,success:function(t){c(t.tempFilePath)},fail:function(t){u(t)}})}))}});case 1:case"end":return i.stop()}}),o)})));return function(t,e){return c.apply(this,arguments)}}())},loadImage:function(t){return new Promise((function(e,a){var n=new Image;n.crossOrigin="anonymous",n.src=t,n.onload=function(){e(n)},n.onerror=function(t){return a(t)}}))},share:function(){this.$emit("shareH5")},getPoster:function(){for(var e=this,a=[this.bag,this.giftBorder,this.giftData.image,this.giftData.avatar,this.PromotionCode],n=["","","","",""],i=function(i){t.downloadFile({url:a[i],success:function(t){200==t.statusCode&&(n[i]=t.tempFilePath);var a=n.every((function(t){return""!==t}));a&&e.goPoster(n)},fail:function(){this.$set(this,"PromotionCode","")}})},o=0;o<a.length;o++)i(o)},goPoster:function(t){var e=this;this.drawPoster(t,this.giftData.nickname,this.giftData.title).then((function(t){e.savePosterPathMp(t)})).catch((function(t){}))},savePosterPathMp:function(e){var a=this;t.saveImageToPhotosAlbum({filePath:e,success:function(t){a.$util.Tips({title:"保存成功",icon:"success"})},fail:function(t){a.$util.Tips({title:"保存失败"})}})},savePic:function(t){var e=document.createElement("a");e.download="Gift",e.style.display="none",e.href=t,document.body.appendChild(e),e.click(),e.remove()}}};e.default=r}).call(this,a("df3c")["default"])},a60e:function(t,e,a){"use strict";a.r(e);var n=a("739fe"),i=a.n(n);for(var o in n)["default"].indexOf(o)<0&&function(t){a.d(e,t,(function(){return n[t]}))}(o);e["default"]=i.a},b718f:function(t,e,a){"use strict";a.r(e);var n=a("dcb7"),i=a("a60e");for(var o in i)["default"].indexOf(o)<0&&function(t){a.d(e,t,(function(){return i[t]}))}(o);a("dd77");var s=a("828b"),r=Object(s["a"])(i["default"],n["b"],n["c"],!1,null,"9a638c6a",null,!1,n["a"],void 0);e["default"]=r.exports},dcb7:function(t,e,a){"use strict";a.d(e,"b",(function(){return n})),a.d(e,"c",(function(){return i})),a.d(e,"a",(function(){}));var n=function(){var t=this.$createElement;this._self._c},i=[]},dd77:function(t,e,a){"use strict";var n=a("e1c5"),i=a.n(n);i.a},e1c5:function(t,e,a){}}]);
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
    'pages/goods/components/sendGiftPoster/index-create-component',
    {
        'pages/goods/components/sendGiftPoster/index-create-component':(function(module, exports, __webpack_require__){
            __webpack_require__('df3c')['createComponent'](__webpack_require__("b718f"))
        })
    },
    [['pages/goods/components/sendGiftPoster/index-create-component']]
]);
