(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-36ccf8bb"],{6109:function(t,e,n){"use strict";var a=n("f062"),i=n.n(a);i.a},7110:function(t,e,n){},"9cca":function(t,e,n){"use strict";var a,i,s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"box"},[n("div",{staticClass:"canvaspanel"},[n("div",{staticClass:"buttongroup"},[n("div",{staticClass:"left",on:{click:t.reset}},[n("van-icon",{staticStyle:{"margin-right":".03rem"},attrs:{name:"delete-o",size:"18"}}),n("span",{staticClass:"empty"},[t._v("清除")])],1),n("div",{staticClass:"right",on:{click:t.save}},[n("van-icon",{staticStyle:{"margin-right":".03rem"},attrs:{name:"certificate",size:"18"}}),n("span",{staticClass:"empty"},[t._v("确认")])],1)]),n("div",{staticClass:"canvasborder"},[n("canvas",{attrs:{id:"canvas"},on:{touchstart:t.touchStart,touchmove:t.touchMove,touchend:t.touchEnd}})]),n("div",{staticStyle:{margin:"0.1rem auto",width:"1rem"}},[n("van-icon",{attrs:{name:"arrow-up",size:"20"},on:{click:function(e){t.$parent.isSign=!1}}})],1)])])},o=[],c=(n("d3b7"),n("e7e5"),n("d399")),r=function(t){return document.querySelector(t)},d={width:0,height:0,lineWidth:5,strokeStyle:"#000000",lineCap:"round",lineJoin:"round"},l={offsetX:0,offsetY:0},u={name:"esign",components:{},data:function(){return{}},mounted:function(){this.drawingBoardInit()},methods:{handleReset:function(){},confirm:function(){var t=this;this.$refs.esign.generate().then((function(e){var n=t.rotateBase64(e);t.$emit("getSign",n),console.log(e)})).catch((function(t){c["a"].fail("请签名")}))},drawingBoardInit:function(){var t=r(".canvasborder").getBoundingClientRect(),e=t.width,n=t.height,s=t.left,o=t.top;d.width=e,d.height=n,l.offsetX=s,l.offsetY=o,a=r("#canvas"),a.width=d.width,a.height=d.height,i=a.getContext("2d"),i.fillStyle="transparent",i.fillRect(0,0,d.width,d.height)},touchStart:function(t){t.preventDefault();var e=t.changedTouches[0],n=e.clientX,a=e.clientY;i.beginPath(),i.lineWidth=d.lineWidth,i.strokeStyle=d.strokeStyle,i.lineCap=d.lineCap,i.lineJoin=d.lineJoin,i.moveTo(n-l.offsetX,a-l.offsetY)},touchMove:function(t){var e=t.changedTouches[0],n=e.clientX,a=e.clientY;i.lineTo(n-l.offsetX,a-l.offsetY),i.stroke()},touchEnd:function(){i.closePath(),window.removeEventListener("mousemove",this.draw)},reset:function(){i.clearRect(0,0,d.width,d.height)},save:function(){var t=this;return new Promise((function(e,n){t.isCanvasBlank(a)||t.rotateBase64(a.toDataURL("image/png")).then((function(n){var a=n;t.$emit("getSign",a),e(a)}))}))},isCanvasBlank:function(t){var e=document.createElement("canvas");return e.width=d.width,e.height=d.height,t.toDataURL()===e.toDataURL()},rotateBase64:function(t){return new Promise((function(e){var n=new Image;n.src=t;var a=document.createElement("canvas"),i=a.getContext("2d"),s={sx:0,sy:0,ex:0,ey:0};n.onload=function(){var t=n.width,o=n.height,c=o;a.width=2*c,a.height=2*c,s.sx=c,s.sy=c-t,s.ex=c+o,s.ey=c+t,i.translate(c,c),i.rotate(Math.PI/2*3),i.drawImage(n,0,0);for(var r=i.getImageData(s.sx,s.sy,s.ex,s.ey),d=0;d