(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["view-WomensDay-vue","NewYear"],{1885:function(t,e,a){a("a29f"),a("0607"),a("949e")},"4d0a":function(t,e,a){t.exports=a.p+"static/img/word.8784d28b.png"},"559a":function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("section",{staticClass:"womens-day",style:"height:"+(t.SIZE.winH?t.SIZE.winH:1500)+"px"},[t.graphData?a("img",{staticClass:"img",attrs:{src:t.graphData,alt:""}}):t._e(),a("canvas",{staticClass:"canvas",attrs:{id:"canvas",width:"400",height:"800"}}),a("canvas",{staticClass:"canvas",attrs:{id:"canvasText",width:"400",height:"800"}}),a("van-dialog",{attrs:{title:"女神贺卡",overlay:!1,"show-cancel-button":!1,"confirm-button-text":"生成贺卡","before-close":t.generate},on:{confirm:t.verify},model:{value:t.dialogShow,callback:function(e){t.dialogShow=e},expression:"dialogShow"}},[a("van-field",{attrs:{placeholder:"请输入女神名字"},model:{value:t.username,callback:function(e){t.username="string"===typeof e?e.trim():e},expression:"username"}})],1),t.loaded?a("div",{staticClass:"new-button"},[a("van-icon",{attrs:{name:"add",color:"#fff",size:40*t.SIZE.ratio+"px"},on:{click:t.newCanvas}})],1):t._e()],1)},i=[],o=(a("a481"),a("ac6a"),a("5df3"),a("795b")),s=a.n(o),c=a("d225"),r=a("b0b4"),u=a("308d"),l=a("6bb5"),d=a("4e2b"),h=a("9ab4"),v=a("60a3"),f=a("ccfe"),g=a("c674"),m=a.n(g),p=(a("5448"),a("1885"),a("6d29")),w=a.n(p),S=(a("c2d8"),a("d738"),a("fdc4"),a("bb52")),x=a("a5da"),b=a("4d0a"),I=a("f6b5"),E=function(t){function e(){var t;return Object(c["a"])(this,e),t=Object(u["a"])(this,Object(l["a"])(e).apply(this,arguments)),t.dialogShow=!1,t.loaded=!1,t.qiniuToken="",t.SIZE={},t.canvas={},t.canvasText={},t.context={},t.contextText={},t.graphData="",t.username="",t}return Object(d["a"])(e,t),Object(r["a"])(e,[{key:"created",value:function(){this.getSIZE()}},{key:"mounted",value:function(){var t=this;w.a.loading({message:"加载中..."}),this.initCanvas(),this.drawBackground().then(function(){w.a.clear(),t.dialogShow=!0,t.loaded=!0})}},{key:"getSIZE",value:function(){var t=document.body.clientWidth,e=document.body.clientHeight,a=(2*t/750).toFixed(3);this.SIZE={winW:t,winH:e,ratio:a,canvasW:2*t,canvasH:2*e}}},{key:"initCanvas",value:function(){this.canvas=document.getElementById("canvas"),this.canvasText=document.getElementById("canvasText"),this.context=this.canvas.getContext("2d"),this.contextText=this.canvasText.getContext("2d"),this.setCanvasSize(this.canvas),this.setCanvasSize(this.canvasText)}},{key:"setCanvasSize",value:function(t){t.width=this.SIZE.canvasW,t.height=this.SIZE.canvasH,t.style.width=this.SIZE.winW+"px",t.style.height=this.SIZE.winH+"px"}},{key:"drawBackground",value:function(){var t=this;this.context.fillStyle="#2A6974",this.context.fillRect(0,0,this.SIZE.canvasW,this.SIZE.canvasH);var e=function(){return new s.a(function(e,a){var n=new Image;n.onload=function(){var a=n.width/n.height,i=Math.floor(t.SIZE.winW/a);t.SIZE.winH;t.context.drawImage(n,0,0,n.width,n.height,56,60,n.width*t.SIZE.ratio,n.height*t.SIZE.ratio),e()},n.src=S})},a=function(){return new s.a(function(e,a){var n=new Image;n.onload=function(){var a=n.height*t.SIZE.ratio,i=t.SIZE.canvasH/2,o=(i-a)/2;t.context.drawImage(n,0,0,n.width,n.height,255*t.SIZE.ratio,1.5*o,n.width*t.SIZE.ratio,n.height*t.SIZE.ratio),e()},n.src=b})},n=function(){return new s.a(function(e,a){var n=new Image;n.onload=function(){n.height;t.context.drawImage(n,0,0,n.width,n.height,537*t.SIZE.ratio,t.SIZE.canvasH-(n.height+30)*t.SIZE.ratio,n.width*t.SIZE.ratio,n.height*t.SIZE.ratio),e()},n.src=I})},i=function(){return new s.a(function(e,a){var i=new Image;i.onload=function(){var a=i.height,o=i.width/a,s=t.SIZE.canvasH/2,c=t.SIZE.canvasW/o,r=s>c?c:s;t.context.drawImage(i,0,0,i.width,i.height,0,t.SIZE.canvasH-r,t.SIZE.canvasW,i.height*t.SIZE.ratio),e(n())},i.src=x})};return s.a.all([e(),a(),i()])}},{key:"drawNameText",value:function(t,e){this.contextText.fillStyle="rgb(238, 243, 244)",this.contextText.font="".concat(36*this.SIZE.ratio,"px '微软雅黑','宋体'"),this.contextText.textBaseline="top";var a=this.username?this.username+"女神":"";this.contextText.fillText(a,t,e),this.contextText.stroke()}},{key:"compositeCanvas",value:function(){var t=this;return new s.a(function(e,a){t.contextText.clearRect(0,0,t.SIZE.canvasW,t.SIZE.canvasH),t.contextText.drawImage(t.canvas,0,0,t.SIZE.canvasW,t.SIZE.canvasH),t.drawNameText(150,64),t.compositeGraph(),e()})}},{key:"compositeGraph",value:function(){var t=this.canvasText.toDataURL("image/jpeg").replace("image/jpeg","image/octet-stream");this.graphData=t}},{key:"verify",value:function(){var t=this.username;(""===t||t.length>5)&&m()({message:"请输入1-5个字符",duration:3e3,background:"rgba(255, 68, 68, 0.7)"})}},{key:"generate",value:function(t,e){var a=this.username;if(""===a||a.length>5)return e(!1);e(),w.a.loading({message:"生成中...",duration:800}),this.compositeCanvas().then(function(){m()({message:"图片已生成，请长按屏幕分享！",duration:4e3,background:"rgba(0, 0, 0, 0.28)"})})}},{key:"newCanvas",value:function(){this.dialogShow=!0,this.username=""}}]),e}(f["a"]);E=h["a"]([Object(v["a"])({components:{}})],E);var k=E,y=k,Z=(a("883d"),a("2877")),A=Object(Z["a"])(y,n,i,!1,null,null,null);e["default"]=A.exports},"883d":function(t,e,a){"use strict";var n=a("cedf"),i=a.n(n);i.a},a015:function(t,e,a){"use strict";var n=a("4ea4");e.__esModule=!0,e.default=void 0;var i=n(a("a559")),o=n(a("861b")),s=a("e5f6"),c=a("dc8a"),r=a("e8a2"),u=n(a("cb5c")),l=(0,s.createNamespace)("notify"),d=l[0],h=l[1];function v(t,e,a,n){var i={color:e.color,background:e.background};return t(u.default,(0,o.default)([{attrs:{value:e.value,position:"top",overlay:!1,duration:.2,lockScroll:!1},style:i,class:[h([e.type]),e.className]},(0,c.inherit)(n,!0)]),[e.message])}v.props=(0,i.default)({},r.popupMixinProps,{color:String,message:[Number,String],duration:[Number,String],className:null,background:String,getContainer:[String,Function],type:{type:String,default:"danger"}});var f=d(v);e.default=f},a5da:function(t,e,a){t.exports=a.p+"static/img/img.6d5332d1.png"},bb52:function(t,e){t.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAAA6CAMAAADstQVpAAAAolBMVEUAAAD///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8ELnaCAAAANXRSTlMA5PZCDAP60MJ5soVHKyQWDvHt6d2qoGTKrZF/cmlWSzwZCPzgxaVbNy8b15mVUB8Ri2EouV5VSRsAAAIJSURBVFjD7dXXbqNAGAXgYzpumBI7gBvudhK35Lz/q22iJWMYJAes5WbDdzUgNOUvAxqN32SeoB5d5YpaDBQ+oR6vbKMeR45Rjyl3qEdk6ajF0Tzj39OdWRickDpMxxdbHeABvUlnYwUtwV/Ss7V0kZGlBAY/DReVW61NScv6nhc7czMHtFlI0jyhisQy2vHkqKqqQU/90ltAmLhTUd3kqsqu+6soSXuOfIYkNrpiPCSrFLgWRCLYLPTcmDGEs0L6Gsp6U0TNdsk3KQGGO8h1OzlCSY5hifGItPPnabGDjHeSF5Q0zlxnMblFlk3FQdaKDL9LPBq+454nmtkMzXNb9uRb1KL4PJTTLVuTYukPso+MK0Uwbmu30uEL6eq4w6S3x+3jRf48cr46t41eFcO+Hw1/L8YufWToHqkWZv4QNZjgrkkPqUKjHEj2kbMhI1QnN8qeZFLIygyViEaRnuV/ik9DQ3Vyo8xJTvOdQ27wgI40UVK4gCZc9vGAtZwwRQq8HnCIB2gGW3Kt5/c4ZTC4Vc7ltez+Z6QN6fC5nOqmss+10RqlDF640QHp9FRu9R4pXQiiu3+w6Gvt1RayLUk/nVrveLtcJRnLuESILZLuylyHDnLsJeltv152rfYJOc4BPzo/8y9FLQTf5Sfz2bdmeMTCOfV26nG7R8GgG4fDzshBo9FoNP4HfwB4Uz382KHxNQAAAABJRU5ErkJggg=="},c674:function(t,e,a){"use strict";var n=a("4ea4");e.__esModule=!0,e.default=void 0;var i,o,s=n(a("a559")),c=n(a("2b0e")),r=n(a("a015")),u=a("e5f6"),l=a("dc8a");function d(t){return(0,u.isObject)(t)?t:{message:t}}function h(t){if(!u.isServer)return o||(o=(0,l.mount)(r.default,{on:{click:function(t){o.onClick&&o.onClick(t)},close:function(){o.onClose&&o.onClose()},opened:function(){o.onOpened&&o.onOpened()}}})),t=(0,s.default)({},h.currentOptions,{},d(t)),(0,s.default)(o,t),clearTimeout(i),t.duration&&t.duration>0&&(i=setTimeout(h.clear,t.duration)),o}function v(){return{type:"danger",value:!0,message:"",color:void 0,background:void 0,duration:3e3,className:"",onClose:null,onClick:null,onOpened:null}}h.clear=function(){o&&(o.value=!1)},h.currentOptions=v(),h.setDefaultOptions=function(t){(0,s.default)(h.currentOptions,t)},h.resetDefaultOptions=function(){h.currentOptions=v()},h.install=function(){c.default.use(r.default)},c.default.prototype.$notify=h;var f=h;e.default=f},cedf:function(t,e,a){},f6b5:function(t,e,a){t.exports=a.p+"static/img/erweima.51ad03fe.png"}}]);