1234567891011 |
- (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/sin-signature/sin-signature"],{558:function(t,n,e){"use strict";e.r(n);var r=e(559),i=e(561);for(var s in i)["default"].indexOf(s)<0&&function(t){e.d(n,t,(function(){return i[t]}))}(s);e(563);var a,o=e(32),c=Object(o["default"])(i["default"],r["render"],r["staticRenderFns"],!1,null,null,null,!1,r["components"],a);c.options.__file="components/sin-signature/sin-signature.vue",n["default"]=c.exports},559:function(t,n,e){"use strict";e.r(n);var r=e(560);e.d(n,"render",(function(){return r["render"]})),e.d(n,"staticRenderFns",(function(){return r["staticRenderFns"]})),e.d(n,"recyclableRender",(function(){return r["recyclableRender"]})),e.d(n,"components",(function(){return r["components"]}))},560:function(t,n,e){"use strict";var r;e.r(n),e.d(n,"render",(function(){return i})),e.d(n,"staticRenderFns",(function(){return a})),e.d(n,"recyclableRender",(function(){return s})),e.d(n,"components",(function(){return r}));var i=function(){var t=this,n=t.$createElement;t._self._c},s=!1,a=[];i._withStripped=!0},561:function(t,n,e){"use strict";e.r(n);var r=e(562),i=e.n(r);for(var s in r)["default"].indexOf(s)<0&&function(t){e.d(n,t,(function(){return r[t]}))}(s);n["default"]=i.a},562:function(t,n,e){"use strict";(function(t){var r=e(4);Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i=r(e(166)),s=r(e(168)),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=function(t){t=t.replace(/\r\n/g,"\n");for(var n="",e=0;e<t.length;e++){var r=t.charCodeAt(e);r<128?n+=String.fromCharCode(r):r>127&&r<2048?(n+=String.fromCharCode(r>>6|192),n+=String.fromCharCode(63&r|128)):(n+=String.fromCharCode(r>>12|224),n+=String.fromCharCode(r>>6&63|128),n+=String.fromCharCode(63&r|128))}return n},c=function(t){var n,e,r,i,s,c,u,h="",l=0;t=o(t);while(l<t.length)n=t.charCodeAt(l++),e=t.charCodeAt(l++),r=t.charCodeAt(l++),i=n>>2,s=(3&n)<<4|e>>4,c=(15&e)<<2|r>>6,u=63&r,isNaN(e)?c=u=64:isNaN(r)&&(u=64),h=h+a.charAt(i)+a.charAt(s)+a.charAt(c)+a.charAt(u);return h},u={cxt:null,data:function(){return{VERSION:"1.0.0",cid:"cvs",show:!1,ctrl:null,listeners:[],prevView:"",draws:[],lines:[],line:null}},props:{value:{default:""},title:{type:String,default:"请签字"},disabled:{type:Boolean,default:!1}},watch:{value:function(){this.prevView=this.value}},computed:{titles:function(){return this.title.split("")},absPrevView:function(){var t=this.prevView;return t}},mounted:function(){this.prevView=this.value,console.log("dx")},methods:{onOK:function(){var t=this.ctrl.getValue();this.$emit("input",t),this.prevView=t,this.hideSignature();var n=this.listeners.shift();n&&n(t)},touchSignature:function(){var t=this.prevView;t&&t.length||this.showSignature()},showSignature:function(){this.disabled||(this.ctrl?this.show||(this.clearSignature(),this.show=!0):this.initCtrl())},getSyncSignature:function(){var t=this;return(0,s.default)(i.default.mark((function n(){return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return t.showSignature(),n.next=3,new Promise(function(){var n=(0,s.default)(i.default.mark((function n(e,r){return i.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:t.listeners.push((function(t){e(t)}));case 1:case"end":return n.stop()}}),n)})));return function(t,e){return n.apply(this,arguments)}}());case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n)})))()},cancelSignature:function(){this.listeners.map((function(t){t(null)})),this.hideSignature()},hideSignature:function(){this.ctrl&&this.ctrl.clear(),this.show=!1},clearSignature:function(){this.ctrl&&this.ctrl.clear()},initCtrl:function(){var n=this;return(0,s.default)(i.default.mark((function e(){var r;return i.default.wrap((function(e){while(1)switch(e.prev=e.next){case 0:n.show=!0,r=t.createCanvasContext(n.cid,n),n.cxt=r,n.ctrl={width:0,height:0,clear:function(){n.lines=[];var e=t.createSelectorQuery().in(n).select("."+n.cid);e.boundingClientRect((function(t){t&&(r.clearRect(0,0,t.width,t.height),t.width&&t.height&&(n.ctrl.width=t.width,n.ctrl.height=t.height))})).exec(),n.redraw()},getValue:function(){if(!n.lines.length)return"";var t=n._get_svg(),e=c(t),r="data:image/svg+xml;base64,"+e;return r}},n.$nextTick((function(){this.ctrl.clear()}));case 5:case"end":return e.stop()}}),e)})))()},_get_svg:function(){var t=-90,n=[],e=this.ctrl.width,r=this.ctrl.height,i=90!=Math.abs(t)?e:r,s=90==Math.abs(t)?e:r,a=e/2,o=r/2,c=Math.PI,u=(t||0)%360,h=Math.cos(u*c/180),l=Math.sin(u*c/180),d=(i-e)/2,f=(s-r)/2,g=function(t){if(u){var n=(t.x-a)*h-(t.y-o)*l+a,e=(t.x-a)*l+(t.y-o)*h+o;return{x:n+d,y:e+f}}return t};this.lines.map((function(t){if(!(t.points.length<2)){var e=g(t.start),r=["M ".concat(e.x," ").concat(Number(e.y))];t.points.map((function(t){var n=g(t);r.push("L ".concat(n.x," ").concat(Number(n.y)))})),n.push('<path stroke-linejoin="round" stroke-linecap="round" stroke-width="3" stroke="rgb(0,0,0)" fill="none" d="'.concat(r.join(" "),'"/>'))}}));var p='<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'.concat(i,'" height="').concat(s,'">').concat(n.join("\n"),"</svg>");return p},_get_svg_raw:function(){var t=[];this.lines.map((function(n){if(!(n.points.length<2)){var e=["M ".concat(n.start.x," ").concat(Number(n.start.y))];n.points.map((function(t){e.push("L ".concat(t.x," ").concat(Number(t.y)))})),t.push('<path stroke-linejoin="round" stroke-linecap="round" stroke-width="3" stroke="rgb(0,0,0)" fill="none" d="'.concat(e.join(" "),'"/>'))}}));var n=this.ctrl.width,e=this.ctrl.height,r='<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'.concat(n,'" height="').concat(e,'" transform="rotate(-90)">').concat(t.join("\n"),"</svg>");return r},_get_point:function(t){return{x:t.changedTouches[0].x.toFixed(1),y:t.changedTouches[0].y.toFixed(1)}},touchstart:function(t){var n=this._get_point(t);this.line={start:n,points:[n]},this.lines.push(this.line)},touchmove:function(t){var n=this,e=this._get_point(t);this.line.points.push(e),this.tm||(this.tm=setTimeout((function(){n.redraw(),n.tm=0}),10))},touchend:function(t){var n=this._get_point(t);this.line.points.push(n),this.line.end=n,this.redraw()},redraw:function(){var t=this.cxt;t.setStrokeStyle("#000"),t.setLineWidth(3);this.lines.map((function(n){t.beginPath(),n.points.length<2||(t.moveTo(n.start.x,n.start.y),n.points.map((function(n){t.lineTo(n.x,n.y)})),t.stroke())})),t.draw()},canvasIdErrorCallback:function(t){console.error(t.detail.errMsg)}}};n.default=u}).call(this,e(2)["default"])},563:function(t,n,e){"use strict";e.r(n);var r=e(564),i=e.n(r);for(var s in r)["default"].indexOf(s)<0&&function(t){e.d(n,t,(function(){return r[t]}))}(s);n["default"]=i.a},564:function(t,n,e){}}]);
- //# sourceMappingURL=../../../.sourcemap/mp-weixin/components/sin-signature/sin-signature.js.map
- ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
- 'components/sin-signature/sin-signature-create-component',
- {
- 'components/sin-signature/sin-signature-create-component':(function(module, exports, __webpack_require__){
- __webpack_require__('2')['createComponent'](__webpack_require__(558))
- })
- },
- [['components/sin-signature/sin-signature-create-component']]
- ]);
|