(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6a415330"],{"0451":function(t,e,a){},"13d5":function(t,e,a){"use strict";var i=a("23e7"),s=a("d58f").left,n=a("a640"),r=a("2d00"),o=a("605d"),c=!o&&r>79&&r<83,l=c||!n("reduce");i({target:"Array",proto:!0,forced:l},{reduce:function(t){var e=arguments.length;return s(this,t,e,e>1?arguments[1]:void 0)}})},3624:function(t,e,a){},"3c6d":function(t,e,a){},5100:function(t,e,a){},"7f0a":function(t,e,a){"use strict";var i=a("0451"),s=a.n(i);s.a},"9cca":function(t,e,a){"use strict";var i,s,n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"box"},[a("div",{staticClass:"canvaspanel"},[a("div",{staticClass:"buttongroup"},[a("div",{staticClass:"left",on:{click:t.reset}},[a("van-icon",{staticStyle:{"margin-right":"3px"},attrs:{name:"delete-o",size:"18"}}),a("span",{staticClass:"empty"},[t._v("清除")])],1),a("div",{staticClass:"right",on:{click:t.save}},[a("van-icon",{staticStyle:{"margin-right":"3px"},attrs:{name:"certificate",size:"18"}}),a("span",{staticClass:"empty"},[t._v("确认")])],1)]),a("div",{staticClass:"canvasborder"},[a("canvas",{attrs:{id:"canvas"},on:{touchstart:t.touchStart,touchmove:t.touchMove,touchend:t.touchEnd}})]),a("div",{staticStyle:{margin:"10px auto",width:"100px"}},[a("van-icon",{attrs:{name:"arrow-up",size:"20"},on:{click:function(e){t.$parent.isSign=!1}}})],1)])])},r=[],o=(a("d3b7"),a("e7e5"),a("d399")),c=function(t){return document.querySelector(t)},l={width:0,height:0,lineWidth:5,strokeStyle:"#000000",lineCap:"round",lineJoin:"round"},d={offsetX:0,offsetY:0},v={name:"Signature",components:{},data:function(){return{}},mounted:function(){this.drawingBoardInit()},methods:{handleReset:function(){},confirm:function(){var t=this;this.$refs.esign.generate().then((function(e){var a=t.rotateBase64(e);t.$emit("getSign",a),console.log(e)})).catch((function(t){o["a"].fail("请签名")}))},drawingBoardInit:function(){console.log(c(".canvasborder"),"$(canvasborder)");var t=c(".canvasborder").getBoundingClientRect(),e=t.width,a=t.height,n=t.left,r=t.top;l.width=e,l.height=a,d.offsetX=n,d.offsetY=r,i=c("#canvas"),i.width=l.width,i.height=l.height,s=i.getContext("2d"),s.fillStyle="transparent",s.fillRect(0,0,l.width,l.height)},touchStart:function(t){t.preventDefault();var e=t.changedTouches[0],a=e.clientX,i=e.clientY;s.beginPath(),s.lineWidth=l.lineWidth,s.strokeStyle=l.strokeStyle,s.lineCap=l.lineCap,s.lineJoin=l.lineJoin,s.moveTo(a-d.offsetX,i-d.offsetY)},touchMove:function(t){var e=t.changedTouches[0],a=e.clientX,i=e.clientY;s.lineTo(a-d.offsetX,i-d.offsetY),s.stroke()},touchEnd:function(){s.closePath(),window.removeEventListener("mousemove",this.draw)},reset:function(){s.clearRect(0,0,l.width,l.height)},save:function(){var t=this;return new Promise((function(e,a){t.isCanvasBlank(i)||t.rotateBase64(i.toDataURL("image/png")).then((function(a){var i=a;t.$emit("getSign",i),e(i)}))}))},isCanvasBlank:function(t){var e=document.createElement("canvas");return e.width=l.width,e.height=l.height,t.toDataURL()===e.toDataURL()},rotateBase64:function(t){return new Promise((function(e){var a=new Image;a.src=t;var i=document.createElement("canvas"),s=i.getContext("2d"),n={sx:0,sy:0,ex:0,ey:0};a.onload=function(){var t=a.width,r=a.height,o=r;i.width=2*o,i.height=2*o,n.sx=o,n.sy=o-t,n.ex=o+r,n.ey=o+t,s.translate(o,o),s.rotate(Math.PI/2*3),s.drawImage(a,0,0);for(var c=s.getImageData(n.sx,n.sy,n.ex,n.ey),l=0;l