!function(){function e(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function t(t){for(var n=1;ne.length)&&(t=e.length);for(var o=0,n=new Array(t);o=8&&(c=o+n));if(c)for(h=u.getUint16(c,r),l=0;l=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,s=!1;return{s:function(){o=o.call(e)},n:function(){var e=o.next();return c=e.done,e},e:function(e){s=!0,i=e},f:function(){try{c||null==o.return||o.return()}finally{if(s)throw i}}}}(t);try{for(r.s();!(o=r.n()).done;){var c=i(o.value,2),s=c[0],l=c[1];n[s]=l}}catch(u){r.e(u)}finally{r.f()}return n},oe=c({data:function(){return{w:0,h:0,scale:1,x:0,y:0,loading:!0,trueWidth:0,trueHeight:0,move:!0,moveX:0,moveY:0,crop:!1,cropping:!1,cropW:0,cropH:0,cropOldW:0,cropOldH:0,canChangeX:!1,canChangeY:!1,changeCropTypeX:1,changeCropTypeY:1,cropX:0,cropY:0,cropChangeX:0,cropChangeY:0,cropOffsertX:0,cropOffsertY:0,support:"",touches:[],touchNow:!1,rotate:0,isIos:!1,orientation:0,imgs:"",coe:.2,scaling:!1,scalingSet:"",coeStatus:"",isCanShow:!0}},props:{img:{type:[String,Blob,null,File],default:""},outputSize:{type:Number,default:1},outputType:{type:String,default:"jpeg"},info:{type:Boolean,default:!0},canScale:{type:Boolean,default:!0},autoCrop:{type:Boolean,default:!1},autoCropWidth:{type:[Number,String],default:0},autoCropHeight:{type:[Number,String],default:0},fixed:{type:Boolean,default:!1},fixedNumber:{type:Array,default:function(){return[1,1]}},fixedBox:{type:Boolean,default:!1},full:{type:Boolean,default:!1},canMove:{type:Boolean,default:!0},canMoveBox:{type:Boolean,default:!0},original:{type:Boolean,default:!1},centerBox:{type:Boolean,default:!1},high:{type:Boolean,default:!0},infoTrue:{type:Boolean,default:!1},maxImgSize:{type:[Number,String],default:2e3},enlarge:{type:[Number,String],default:1},preW:{type:[Number,String],default:0},mode:{type:String,default:"contain"},limitMinSize:{type:[Number,Array,String],default:function(){return 10}}},computed:{cropInfo:function(){var e={};if(e.top=this.cropOffsertY>21?"-21px":"0px",e.width=this.cropW>0?this.cropW:0,e.height=this.cropH>0?this.cropH:0,this.infoTrue){var t=1;this.high&&!this.full&&(t=window.devicePixelRatio),1!==this.enlarge&!this.full&&(t=Math.abs(Number(this.enlarge))),e.width=e.width*t,e.height=e.height*t,this.full&&(e.width=e.width/this.scale,e.height=e.height/this.scale)}return e.width=e.width.toFixed(0),e.height=e.height.toFixed(0),e},isIE:function(){var e=!!window.ActiveXObject||"ActiveXObject"in window;return e},passive:function(){return this.isIE?null:{passive:!1}}},watch:{img:function(){this.checkedImg()},imgs:function(e){""!==e&&this.reload()},cropW:function(){this.showPreview()},cropH:function(){this.showPreview()},cropOffsertX:function(){this.showPreview()},cropOffsertY:function(){this.showPreview()},scale:function(e,t){this.showPreview()},x:function(){this.showPreview()},y:function(){this.showPreview()},autoCrop:function(e){e&&this.goAutoCrop()},autoCropWidth:function(){this.autoCrop&&this.goAutoCrop()},autoCropHeight:function(){this.autoCrop&&this.goAutoCrop()},mode:function(){this.checkedImg()},rotate:function(){this.showPreview(),(this.autoCrop||this.cropW>0||this.cropH>0)&&this.goAutoCrop(this.cropW,this.cropH)}},methods:{getVersion:function(e){for(var t=navigator.userAgent.split(" "),o="",n=new RegExp(e,"i"),r=0;r=81)t=-1;else if(this.getVersion("safari")[0]>=605){var i=this.getVersion("version");i[0]>13&&i[1]>1&&(t=-1)}else{var a=navigator.userAgent.toLowerCase().match(/cpu iphone os (.*?) like mac os/);if(a){var c=a[1];((c=c.split("_"))[0]>13||c[0]>=13&&c[1]>=4)&&(t=-1)}}var s=document.createElement("canvas"),l=s.getContext("2d");switch(l.save(),t){case 2:s.width=o,s.height=n,l.translate(o,0),l.scale(-1,1);break;case 3:s.width=o,s.height=n,l.translate(o/2,n/2),l.rotate(180*Math.PI/180),l.translate(-o/2,-n/2);break;case 4:s.width=o,s.height=n,l.translate(0,n),l.scale(1,-1);break;case 5:s.height=o,s.width=n,l.rotate(.5*Math.PI),l.scale(1,-1);break;case 6:s.width=n,s.height=o,l.translate(n/2,o/2),l.rotate(90*Math.PI/180),l.translate(-o/2,-n/2);break;case 7:s.height=o,s.width=n,l.rotate(.5*Math.PI),l.translate(o,-n),l.scale(-1,1);break;case 8:s.height=o,s.width=n,l.translate(n/2,o/2),l.rotate(-90*Math.PI/180),l.translate(-o/2,-n/2);break;default:s.width=o,s.height=n}l.drawImage(e,0,0,o,n),l.restore(),s.toBlob((function(e){var t=URL.createObjectURL(e);URL.revokeObjectURL(r.imgs),r.imgs=t}),"image/"+this.outputType,1)},checkedImg:function(){var e=this;if(null===this.img||""===this.img)return this.imgs="",void this.clearCrop();this.loading=!0,this.scale=1,this.rotate=0,this.clearCrop();var t=new Image;if(t.onload=function(){if(""===e.img)return e.$emit("img-load","error"),!1;var o=t.width,n=t.height;ee.getData(t).then((function(r){e.orientation=r.orientation||1;var i=Number(e.maxImgSize);!e.orientation&&oi&&(n=n/o*i,o=i),n>i&&(o=o/n*i,n=i),e.checkOrientationImage(t,e.orientation,o,n))}))},t.onerror=function(){e.$emit("img-load","error")},"data"!==this.img.substr(0,4)&&(t.crossOrigin=""),this.isIE){var o=new XMLHttpRequest;o.onload=function(){var e=URL.createObjectURL(this.response);t.src=e},o.open("GET",this.img,!0),o.responseType="blob",o.send()}else t.src=this.img},startMove:function(e){if(e.preventDefault(),this.move&&!this.crop){if(!this.canMove)return!1;this.moveX=("clientX"in e?e.clientX:e.touches[0].clientX)-this.x,this.moveY=("clientY"in e?e.clientY:e.touches[0].clientY)-this.y,e.touches?(window.addEventListener("touchmove",this.moveImg),window.addEventListener("touchend",this.leaveImg),2==e.touches.length&&(this.touches=e.touches,window.addEventListener("touchmove",this.touchScale),window.addEventListener("touchend",this.cancelTouchScale))):(window.addEventListener("mousemove",this.moveImg),window.addEventListener("mouseup",this.leaveImg)),this.$emit("imgMoving",{moving:!0,axis:this.getImgAxis()}),this.$emit("img-moving",{moving:!0,axis:this.getImgAxis()})}else this.cropping=!0,window.addEventListener("mousemove",this.createCrop),window.addEventListener("mouseup",this.endCrop),window.addEventListener("touchmove",this.createCrop),window.addEventListener("touchend",this.endCrop),this.cropOffsertX=e.offsetX?e.offsetX:e.touches[0].pageX-this.$refs.cropper.offsetLeft,this.cropOffsertY=e.offsetY?e.offsetY:e.touches[0].pageY-this.$refs.cropper.offsetTop,this.cropX="clientX"in e?e.clientX:e.touches[0].clientX,this.cropY="clientY"in e?e.clientY:e.touches[0].clientY,this.cropChangeX=this.cropOffsertX,this.cropChangeY=this.cropOffsertY,this.cropW=0,this.cropH=0},touchScale:function(e){var t=this;e.preventDefault();var o=this.scale,n=this.touches[0].clientX,r=this.touches[0].clientY,i=e.touches[0].clientX,a=e.touches[0].clientY,c=this.touches[1].clientX,s=this.touches[1].clientY,l=e.touches[1].clientX,u=e.touches[1].clientY,h=Math.sqrt(Math.pow(n-c,2)+Math.pow(r-s,2)),d=Math.sqrt(Math.pow(i-l,2)+Math.pow(a-u,2))-h,p=1,f=(p=(p=p/this.trueWidth>p/this.trueHeight?p/this.trueHeight:p/this.trueWidth)>.1?.1:p)*d;if(!this.touchNow){if(this.touchNow=!0,d>0?o+=Math.abs(f):d<0&&o>Math.abs(f)&&(o-=Math.abs(f)),this.touches=e.touches,setTimeout((function(){t.touchNow=!1}),8),!this.checkoutImgAxis(this.x,this.y,o))return!1;this.scale=o}},cancelTouchScale:function(e){window.removeEventListener("touchmove",this.touchScale)},moveImg:function(e){var t=this;if(e.preventDefault(),e.touches&&2===e.touches.length)return this.touches=e.touches,window.addEventListener("touchmove",this.touchScale),window.addEventListener("touchend",this.cancelTouchScale),window.removeEventListener("touchmove",this.moveImg),!1;var o,n,r="clientX"in e?e.clientX:e.touches[0].clientX,i="clientY"in e?e.clientY:e.touches[0].clientY;o=r-this.moveX,n=i-this.moveY,this.$nextTick((function(){if(t.centerBox){var e,r,i,a,c=t.getImgAxis(o,n,t.scale),s=t.getCropAxis(),l=t.trueHeight*t.scale,u=t.trueWidth*t.scale;switch(t.rotate){case 1:case-1:case 3:case-3:e=t.cropOffsertX-t.trueWidth*(1-t.scale)/2+(l-u)/2,r=t.cropOffsertY-t.trueHeight*(1-t.scale)/2+(u-l)/2,i=e-l+t.cropW,a=r-u+t.cropH;break;default:e=t.cropOffsertX-t.trueWidth*(1-t.scale)/2,r=t.cropOffsertY-t.trueHeight*(1-t.scale)/2,i=e-u+t.cropW,a=r-l+t.cropH}c.x1>=s.x1&&(o=e),c.y1>=s.y1&&(n=r),c.x2<=s.x2&&(o=i),c.y2<=s.y2&&(n=a)}t.x=o,t.y=n,t.$emit("imgMoving",{moving:!0,axis:t.getImgAxis()}),t.$emit("img-moving",{moving:!0,axis:t.getImgAxis()})}))},leaveImg:function(e){window.removeEventListener("mousemove",this.moveImg),window.removeEventListener("touchmove",this.moveImg),window.removeEventListener("mouseup",this.leaveImg),window.removeEventListener("touchend",this.leaveImg),this.$emit("imgMoving",{moving:!1,axis:this.getImgAxis()}),this.$emit("img-moving",{moving:!1,axis:this.getImgAxis()})},scaleImg:function(){this.canScale&&window.addEventListener(this.support,this.changeSize,this.passive)},cancelScale:function(){this.canScale&&window.removeEventListener(this.support,this.changeSize)},changeSize:function(e){var t=this;e.preventDefault();var o=this.scale,n=e.deltaY||e.wheelDelta;n=navigator.userAgent.indexOf("Firefox")>0?30*n:n,this.isIE&&(n=-n);var r=this.coe,i=(r=r/this.trueWidth>r/this.trueHeight?r/this.trueHeight:r/this.trueWidth)*n;i<0?o+=Math.abs(i):o>Math.abs(i)&&(o-=Math.abs(i));var a=i<0?"add":"reduce";if(a!==this.coeStatus&&(this.coeStatus=a,this.coe=.2),this.scaling||(this.scalingSet=setTimeout((function(){t.scaling=!1,t.coe=t.coe+=.01}),50)),this.scaling=!0,!this.checkoutImgAxis(this.x,this.y,o))return!1;this.scale=o},changeScale:function(e){var t=this.scale;e=e||1;var o=20;if((e*=o=o/this.trueWidth>o/this.trueHeight?o/this.trueHeight:o/this.trueWidth)>0?t+=Math.abs(e):t>Math.abs(e)&&(t-=Math.abs(e)),!this.checkoutImgAxis(this.x,this.y,t))return!1;this.scale=t},createCrop:function(e){var t=this;e.preventDefault();var o="clientX"in e?e.clientX:e.touches?e.touches[0].clientX:0,n="clientY"in e?e.clientY:e.touches?e.touches[0].clientY:0;this.$nextTick((function(){var e=o-t.cropX,r=n-t.cropY;if(e>0?(t.cropW=e+t.cropChangeX>t.w?t.w-t.cropChangeX:e,t.cropOffsertX=t.cropChangeX):(t.cropW=t.w-t.cropChangeX+Math.abs(e)>t.w?t.cropChangeX:Math.abs(e),t.cropOffsertX=t.cropChangeX+e>0?t.cropChangeX+e:0),t.fixed){var i=t.cropW/t.fixedNumber[0]*t.fixedNumber[1];i+t.cropOffsertY>t.h?(t.cropH=t.h-t.cropOffsertY,t.cropW=t.cropH/t.fixedNumber[1]*t.fixedNumber[0],t.cropOffsertX=e>0?t.cropChangeX:t.cropChangeX-t.cropW):t.cropH=i,t.cropOffsertY=t.cropOffsertY}else r>0?(t.cropH=r+t.cropChangeY>t.h?t.h-t.cropChangeY:r,t.cropOffsertY=t.cropChangeY):(t.cropH=t.h-t.cropChangeY+Math.abs(r)>t.h?t.cropChangeY:Math.abs(r),t.cropOffsertY=t.cropChangeY+r>0?t.cropChangeY+r:0)}))},changeCropSize:function(e,t,o,n,r){e.preventDefault(),window.addEventListener("mousemove",this.changeCropNow),window.addEventListener("mouseup",this.changeCropEnd),window.addEventListener("touchmove",this.changeCropNow),window.addEventListener("touchend",this.changeCropEnd),this.canChangeX=t,this.canChangeY=o,this.changeCropTypeX=n,this.changeCropTypeY=r,this.cropX="clientX"in e?e.clientX:e.touches[0].clientX,this.cropY="clientY"in e?e.clientY:e.touches[0].clientY,this.cropOldW=this.cropW,this.cropOldH=this.cropH,this.cropChangeX=this.cropOffsertX,this.cropChangeY=this.cropOffsertY,this.fixed&&this.canChangeX&&this.canChangeY&&(this.canChangeY=0),this.$emit("change-crop-size",{width:this.cropW,height:this.cropH})},changeCropNow:function(e){var t=this;e.preventDefault();var o="clientX"in e?e.clientX:e.touches?e.touches[0].clientX:0,n="clientY"in e?e.clientY:e.touches?e.touches[0].clientY:0,r=this.w,i=this.h,a=0,c=0;if(this.centerBox){var s=this.getImgAxis(),l=s.x2,u=s.y2;a=s.x1>0?s.x1:0,c=s.y1>0?s.y1:0,r>l&&(r=l),i>u&&(i=u)}this.$nextTick((function(){var e=o-t.cropX,s=n-t.cropY;if(t.canChangeX&&(1===t.changeCropTypeX?t.cropOldW-e>0?(t.cropW=r-t.cropChangeX-e<=r-a?t.cropOldW-e:t.cropOldW+t.cropChangeX-a,t.cropOffsertX=r-t.cropChangeX-e<=r-a?t.cropChangeX+e:a):(t.cropW=Math.abs(e)+t.cropChangeX<=r?Math.abs(e)-t.cropOldW:r-t.cropOldW-t.cropChangeX,t.cropOffsertX=t.cropChangeX+t.cropOldW):2===t.changeCropTypeX&&(t.cropOldW+e>0?(t.cropW=t.cropOldW+e+t.cropOffsertX<=r?t.cropOldW+e:r-t.cropOffsertX,t.cropOffsertX=t.cropChangeX):(t.cropW=r-t.cropChangeX+Math.abs(e+t.cropOldW)<=r-a?Math.abs(e+t.cropOldW):t.cropChangeX-a,t.cropOffsertX=r-t.cropChangeX+Math.abs(e+t.cropOldW)<=r-a?t.cropChangeX-Math.abs(e+t.cropOldW):a))),t.canChangeY&&(1===t.changeCropTypeY?t.cropOldH-s>0?(t.cropH=i-t.cropChangeY-s<=i-c?t.cropOldH-s:t.cropOldH+t.cropChangeY-c,t.cropOffsertY=i-t.cropChangeY-s<=i-c?t.cropChangeY+s:c):(t.cropH=Math.abs(s)+t.cropChangeY<=i?Math.abs(s)-t.cropOldH:i-t.cropOldH-t.cropChangeY,t.cropOffsertY=t.cropChangeY+t.cropOldH):2===t.changeCropTypeY&&(t.cropOldH+s>0?(t.cropH=t.cropOldH+s+t.cropOffsertY<=i?t.cropOldH+s:i-t.cropOffsertY,t.cropOffsertY=t.cropChangeY):(t.cropH=i-t.cropChangeY+Math.abs(s+t.cropOldH)<=i-c?Math.abs(s+t.cropOldH):t.cropChangeY-c,t.cropOffsertY=i-t.cropChangeY+Math.abs(s+t.cropOldH)<=i-c?t.cropChangeY-Math.abs(s+t.cropOldH):c))),t.canChangeX&&t.fixed){var l=t.cropW/t.fixedNumber[0]*t.fixedNumber[1];l+t.cropOffsertY>i?(t.cropH=i-t.cropOffsertY,t.cropW=t.cropH/t.fixedNumber[1]*t.fixedNumber[0]):t.cropH=l}if(t.canChangeY&&t.fixed){var u=t.cropH/t.fixedNumber[1]*t.fixedNumber[0];u+t.cropOffsertX>r?(t.cropW=r-t.cropOffsertX,t.cropH=t.cropW/t.fixedNumber[0]*t.fixedNumber[1]):t.cropW=u}}))},checkCropLimitSize:function(){this.cropW,this.cropH;var e=this.limitMinSize,t=new Array;return t=Array.isArray[e]?e:[e,e],[parseFloat(t[0]),parseFloat(t[1])]},changeCropEnd:function(e){window.removeEventListener("mousemove",this.changeCropNow),window.removeEventListener("mouseup",this.changeCropEnd),window.removeEventListener("touchmove",this.changeCropNow),window.removeEventListener("touchend",this.changeCropEnd)},endCrop:function(){0===this.cropW&&0===this.cropH&&(this.cropping=!1),window.removeEventListener("mousemove",this.createCrop),window.removeEventListener("mouseup",this.endCrop),window.removeEventListener("touchmove",this.createCrop),window.removeEventListener("touchend",this.endCrop)},startCrop:function(){this.crop=!0},stopCrop:function(){this.crop=!1},clearCrop:function(){this.cropping=!1,this.cropW=0,this.cropH=0},cropMove:function(e){if(e.preventDefault(),!this.canMoveBox)return this.crop=!1,this.startMove(e),!1;if(e.touches&&2===e.touches.length)return this.crop=!1,this.startMove(e),this.leaveCrop(),!1;window.addEventListener("mousemove",this.moveCrop),window.addEventListener("mouseup",this.leaveCrop),window.addEventListener("touchmove",this.moveCrop),window.addEventListener("touchend",this.leaveCrop);var t,o,n="clientX"in e?e.clientX:e.touches[0].clientX,r="clientY"in e?e.clientY:e.touches[0].clientY;t=n-this.cropOffsertX,o=r-this.cropOffsertY,this.cropX=t,this.cropY=o,this.$emit("cropMoving",{moving:!0,axis:this.getCropAxis()}),this.$emit("crop-moving",{moving:!0,axis:this.getCropAxis()})},moveCrop:function(e,t){var o=this,n=0,r=0;e&&(e.preventDefault(),n="clientX"in e?e.clientX:e.touches[0].clientX,r="clientY"in e?e.clientY:e.touches[0].clientY),this.$nextTick((function(){var e,i,a=n-o.cropX,c=r-o.cropY;if(t&&(a=o.cropOffsertX,c=o.cropOffsertY),e=a<=0?0:a+o.cropW>o.w?o.w-o.cropW:a,i=c<=0?0:c+o.cropH>o.h?o.h-o.cropH:c,o.centerBox){var s=o.getImgAxis();e<=s.x1&&(e=s.x1),e+o.cropW>s.x2&&(e=s.x2-o.cropW),i<=s.y1&&(i=s.y1),i+o.cropH>s.y2&&(i=s.y2-o.cropH)}o.cropOffsertX=e,o.cropOffsertY=i,o.$emit("cropMoving",{moving:!0,axis:o.getCropAxis()}),o.$emit("crop-moving",{moving:!0,axis:o.getCropAxis()})}))},getImgAxis:function(e,t,o){e=e||this.x,t=t||this.y,o=o||this.scale;var n={x1:0,x2:0,y1:0,y2:0},r=this.trueWidth*o,i=this.trueHeight*o;switch(this.rotate){case 0:n.x1=e+this.trueWidth*(1-o)/2,n.x2=n.x1+this.trueWidth*o,n.y1=t+this.trueHeight*(1-o)/2,n.y2=n.y1+this.trueHeight*o;break;case 1:case-1:case 3:case-3:n.x1=e+this.trueWidth*(1-o)/2+(r-i)/2,n.x2=n.x1+this.trueHeight*o,n.y1=t+this.trueHeight*(1-o)/2+(i-r)/2,n.y2=n.y1+this.trueWidth*o;break;default:n.x1=e+this.trueWidth*(1-o)/2,n.x2=n.x1+this.trueWidth*o,n.y1=t+this.trueHeight*(1-o)/2,n.y2=n.y1+this.trueHeight*o}return n},getCropAxis:function(){var e={x1:0,x2:0,y1:0,y2:0};return e.x1=this.cropOffsertX,e.x2=e.x1+this.cropW,e.y1=this.cropOffsertY,e.y2=e.y1+this.cropH,e},leaveCrop:function(e){window.removeEventListener("mousemove",this.moveCrop),window.removeEventListener("mouseup",this.leaveCrop),window.removeEventListener("touchmove",this.moveCrop),window.removeEventListener("touchend",this.leaveCrop),this.$emit("cropMoving",{moving:!1,axis:this.getCropAxis()}),this.$emit("crop-moving",{moving:!1,axis:this.getCropAxis()})},getCropChecked:function(e){var t=this,o=document.createElement("canvas"),n=new Image,r=this.rotate,i=this.trueWidth,a=this.trueHeight,c=this.cropOffsertX,s=this.cropOffsertY;function l(e,t){o.width=Math.round(e),o.height=Math.round(t)}n.onload=function(){if(0!==t.cropW){var u=o.getContext("2d"),h=1;t.high&!t.full&&(h=window.devicePixelRatio),1!==t.enlarge&!t.full&&(h=Math.abs(Number(t.enlarge)));var d=t.cropW*h,p=t.cropH*h,f=i*t.scale*h,g=a*t.scale*h,m=(t.x-c+t.trueWidth*(1-t.scale)/2)*h,v=(t.y-s+t.trueHeight*(1-t.scale)/2)*h;switch(l(d,p),u.save(),r){case 0:t.full?(l(d/t.scale,p/t.scale),u.drawImage(n,m/t.scale,v/t.scale,f/t.scale,g/t.scale)):u.drawImage(n,m,v,f,g);break;case 1:case-3:t.full?(l(d/t.scale,p/t.scale),m=m/t.scale+(f/t.scale-g/t.scale)/2,v=v/t.scale+(g/t.scale-f/t.scale)/2,u.rotate(90*r*Math.PI/180),u.drawImage(n,v,-m-g/t.scale,f/t.scale,g/t.scale)):(m+=(f-g)/2,v+=(g-f)/2,u.rotate(90*r*Math.PI/180),u.drawImage(n,v,-m-g,f,g));break;case 2:case-2:t.full?(l(d/t.scale,p/t.scale),u.rotate(90*r*Math.PI/180),m/=t.scale,v/=t.scale,u.drawImage(n,-m-f/t.scale,-v-g/t.scale,f/t.scale,g/t.scale)):(u.rotate(90*r*Math.PI/180),u.drawImage(n,-m-f,-v-g,f,g));break;case 3:case-1:t.full?(l(d/t.scale,p/t.scale),m=m/t.scale+(f/t.scale-g/t.scale)/2,v=v/t.scale+(g/t.scale-f/t.scale)/2,u.rotate(90*r*Math.PI/180),u.drawImage(n,-v-f/t.scale,m,f/t.scale,g/t.scale)):(m+=(f-g)/2,v+=(g-f)/2,u.rotate(90*r*Math.PI/180),u.drawImage(n,-v-f,m,f,g));break;default:t.full?(l(d/t.scale,p/t.scale),u.drawImage(n,m/t.scale,v/t.scale,f/t.scale,g/t.scale)):u.drawImage(n,m,v,f,g)}u.restore()}else{var b=i*t.scale,w=a*t.scale,y=o.getContext("2d");switch(y.save(),r){case 0:l(b,w),y.drawImage(n,0,0,b,w);break;case 1:case-3:l(w,b),y.rotate(90*r*Math.PI/180),y.drawImage(n,0,-w,b,w);break;case 2:case-2:l(b,w),y.rotate(90*r*Math.PI/180),y.drawImage(n,-b,-w,b,w);break;case 3:case-1:l(w,b),y.rotate(90*r*Math.PI/180),y.drawImage(n,-b,0,b,w);break;default:l(b,w),y.drawImage(n,0,0,b,w)}y.restore()}e(o)},"data"!==this.img.substr(0,4)&&(n.crossOrigin="Anonymous"),n.src=this.imgs},getCropData:function(e){var t=this;this.getCropChecked((function(o){e(o.toDataURL("image/"+t.outputType,t.outputSize))}))},getCropBlob:function(e){var t=this;this.getCropChecked((function(o){o.toBlob((function(t){return e(t)}),"image/"+t.outputType,t.outputSize)}))},showPreview:function(){var e=this;if(!this.isCanShow)return!1;this.isCanShow=!1,setTimeout((function(){e.isCanShow=!0}),16);var t=this.cropW,o=this.cropH,n=this.scale,r={};r.div={width:"".concat(t,"px"),height:"".concat(o,"px")};var i=(this.x-this.cropOffsertX)/n,a=(this.y-this.cropOffsertY)/n;r.w=t,r.h=o,r.url=this.imgs,r.img={width:"".concat(this.trueWidth,"px"),height:"".concat(this.trueHeight,"px"),transform:"scale(".concat(n,")translate3d(").concat(i,"px, ").concat(a,"px, ").concat(0,"px)rotateZ(").concat(90*this.rotate,"deg)")},r.html='\n
\n
\n \n
\n
'),this.$emit("realTime",r),this.$emit("real-time",r)},reload:function(){var e=this,t=new Image;t.onload=function(){e.w=parseFloat(window.getComputedStyle(e.$refs.cropper).width),e.h=parseFloat(window.getComputedStyle(e.$refs.cropper).height),e.trueWidth=t.width,e.trueHeight=t.height,e.original?e.scale=1:e.scale=e.checkedMode(),e.$nextTick((function(){e.x=-(e.trueWidth-e.trueWidth*e.scale)/2+(e.w-e.trueWidth*e.scale)/2,e.y=-(e.trueHeight-e.trueHeight*e.scale)/2+(e.h-e.trueHeight*e.scale)/2,e.loading=!1,e.autoCrop&&e.goAutoCrop(),e.$emit("img-load","success"),e.$emit("imgLoad","success"),setTimeout((function(){e.showPreview()}),20)}))},t.onerror=function(){e.$emit("imgLoad","error"),e.$emit("img-load","error")},t.src=this.imgs},checkedMode:function(){var e=1,t=(this.trueWidth,this.trueHeight),o=this.mode.split(" ");switch(o[0]){case"contain":this.trueWidth>this.w&&(e=this.w/this.trueWidth),this.trueHeight*e>this.h&&(e=this.h/this.trueHeight);break;case"cover":(t*=e=this.w/this.trueWidth)0,i=(r?this.trueHeight:this.trueWidth)*this.scale,a=(r?this.trueWidth:this.trueHeight)*this.scale;o=io?o:c,s=s>n?n:s,this.fixed&&(s=c/this.fixedNumber[0]*this.fixedNumber[1]),s>this.h&&(c=(s=this.h)/this.fixedNumber[1]*this.fixedNumber[0]),this.changeCrop(c,s)}},changeCrop:function(e,t){var o=this;if(this.centerBox){var n=this.getImgAxis();e>n.x2-n.x1&&(t=(e=n.x2-n.x1)/this.fixedNumber[0]*this.fixedNumber[1]),t>n.y2-n.y1&&(e=(t=n.y2-n.y1)/this.fixedNumber[1]*this.fixedNumber[0])}this.cropW=e,this.cropH=t,this.checkCropLimitSize(),this.$nextTick((function(){o.cropOffsertX=(o.w-o.cropW)/2,o.cropOffsertY=(o.h-o.cropH)/2,o.centerBox&&o.moveCrop(null,!0)}))},refresh:function(){var e=this;this.img,this.imgs="",this.scale=1,this.crop=!1,this.rotate=0,this.w=0,this.h=0,this.trueWidth=0,this.trueHeight=0,this.clearCrop(),this.$nextTick((function(){e.checkedImg()}))},rotateLeft:function(){this.rotate=this.rotate<=-3?0:this.rotate-1},rotateRight:function(){this.rotate=this.rotate>=3?0:this.rotate+1},rotateClear:function(){this.rotate=0},checkoutImgAxis:function(e,t,o){e=e||this.x,t=t||this.y,o=o||this.scale;var n=!0;if(this.centerBox){var r=this.getImgAxis(e,t,o),i=this.getCropAxis();r.x1>=i.x1&&(n=!1),r.x2<=i.x2&&(n=!1),r.y1>=i.y1&&(n=!1),r.y2<=i.y2&&(n=!1)}return n}},mounted:function(){this.support="onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll";var e=this,t=navigator.userAgent;this.isIOS=!!t.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(t,o,n){for(var r=atob(this.toDataURL(o,n).split(",")[1]),i=r.length,a=new Uint8Array(i),c=0;c0&&e.areas.forEach((function(e){o.areas.push({name:e.name,code:e.code})})),t.push(o)})),i.columns=t||[],e.next=7,A.post("/api-school/open/subject/page",{data:{page:1,rows:50}});case 7:n=e.sent,r=n.data,a=r.rows||[],c=[],a.forEach((function(e){c.push({text:e.name,value:e.id})})),i.columnSubject=c,e.next=18;break;case 15:e.prev=15,e.t0=e.catch(1),H({message:"信息获取失败,请联系老师",theme:"round-button",confirmButtonColor:"#64A9FF"});case 18:case"end":return e.stop()}}),e,null,[[1,15]])})))),function(){return v("div",{class:J.register},[v("div",{class:J.title},[v("p",{class:J.tips},[v("img",{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAAXNSR0IArs4c6QAAApVJREFUWEftl82rjVEUxn9PknC7mCEuKUJKSRkoIyUpwztBGbi+RtQt/gRRBkou7ogSZSIxMVEY+EgKRVKui5gQIhKP1m2/2k7nnPd8Stw1Ou8++13796691rPXFn+ZqRM8tmcDPyS9btdf20C2twKHAQN7JZ1qB6plINtzgePA+gqAy8AOSS9aAWsJyPZ24BDQW2PR98CgpOFmoZoCsj0fOAmsrVjoChC+qo0PSBppFKwhINsxbzdwAOjJnP8WCdsDKXLTsjkfgf3AMUmRZ3WtFMh2H3AaWFPh6RKwszJXbM8BTlTJravAJkmv6hE1AnQbWJk5edtINWXVNyN795akVS0D2Y7t+ZDyI/xcSFFpSG9szwKGgI0ZRI+kT7Wg6kbI9nTgXfZyn6TRsjzI/7c9D3iWjfVKiryqauNAoV2lEbI9OalunrwR0gnAog5v2eM49zKfIQV3krp/Gdsy25tTaZelRydyqNYaIQlnCqAQvaNlNEA3gXZJGqoG9BDYl+CmAuc6vGX9wOfk8yCwNP2uCXRN0pgqd7vsbV8HVv+7QLYXA9uA5ekr7wHDkqKSxqyeMHY0Qrb3AJEDEyuK4VvqhY78MSDbkZhnszOuskBDW/olne96hICXwBNgQaKIs63oqQeBaD/CngILQypqnWUd2TIgmq/7RYpE2Up6lLZnCRCyUZyRUdJR4lUP104BLQOikQ8blRQR+GW2owGLtiNsHRAJ3lWgqKiLacERSdFn50DPgbiRhG1IERsHGo9QEYFI4P8sh2zfAGZmQhe3jAcpJNEx5teWu8AUIM6wsK9AjOW2ApiUBkKfQodirLCbwPf0EBJSXMdDSN/IdultsmLBrj7+lUBbuvrJTTovvUo36a/t6T8B6vz6SJbFLFUAAAAASUVORK5CYII="},null),v("span",null,[i.name])])]),v(n,{validateFirst:!0,scrollToError:!0,onSubmit:a,ref:"form",class:J.form},{default:function(){return[v(W,{inset:!0,class:J["cell-group"]},{default:function(){return[v(D,{required:!0,label:"真实姓名",modelValue:i.forms.realName,"onUpdate:modelValue":function(e){return i.forms.realName=e},rules:[{required:!0,message:"请填写真实姓名"}],name:"realName",placeholder:"请填写真实姓名",maxlength:"50"},null),v(D,{required:!0,label:"手机号码",modelValue:i.forms.phone,"onUpdate:modelValue":function(e){return i.forms.phone=e},rules:[{required:!0,message:"请输入手机号码"}],name:"phone",placeholder:"请输入手机号码"},null),v(D,{required:!0,label:"验证码",modelValue:i.forms.smsValidCode,"onUpdate:modelValue":function(e){return i.forms.smsValidCode=e},name:"smsValidCode",rules:[{required:!0,message:"请选择声部",trigger:"onChange"}],placeholder:"请输入验证码"},{button:function(){return i.countDownStatus?v(j,{type:"primary",round:!0,size:"small",color:"#ff8057",onClick:u},{default:function(){return[T("发送验证码")]}}):v(j,{type:"default",round:!0,size:"small",disabled:!0,style:{minWidth:"60px"},onClick:u},{default:function(){return[i.countDownTime+"s"]}})}}),v("div",{class:J.phoneTips},[v(O,{name:"warning",size:"16"},null),T("提示:手机号码将成为您管乐团管理端登录账号")]),v(D,{required:!0,label:"身份证号码",modelValue:i.forms.idCardNo,"onUpdate:modelValue":function(e){return i.forms.idCardNo=e},rules:[{required:!0,message:"请输入身份证号"},{pattern:/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/,message:"请输入正确的身份证号"}],name:"idCardNo",placeholder:"请输入身份证号码"},null),v(D,{required:!0,label:"性别",name:"gender",rules:[{required:!0,message:"请选择性别"}]},{input:function(){return v(L,{"checked-color":"#FF8057",modelValue:i.forms.gender,"onUpdate:modelValue":function(e){return i.forms.gender=e},direction:"horizontal"},{default:function(){return[v(Q,{size:"large",type:"primary",plain:!(1===i.forms.gender),color:"#FF8057",class:J.radioSection},{default:function(){return[v(F,{class:J.radioItem,name:1},null),T("男")]}}),v(Q,{size:"large",type:"primary",plain:!(0===i.forms.gender),color:"#FF8057",class:J.radioSection},{default:function(){return[v(F,{class:J.radioItem,name:0},null),T("女")]}})]}})}}),v(D,{required:!0,label:"身份证照片正面",modelValue:i.forms.idcardFrontImg,"onUpdate:modelValue":function(e){return i.forms.idcardFrontImg=e},readonly:!0,name:"idcardFrontImg",onClick:function(){return i.showPicker=!0},rules:[{required:!0,message:"请选择身份证照片正面",trigger:"onChange"}],placeholder:"请选择身份证照片正面"},{input:function(){return v(be,{style:{width:"100%"},tips:"上传身份证正面",modelValue:i.forms.idcardFrontImg,"onUpdate:modelValue":function(e){return i.forms.idcardFrontImg=e}},null)}}),v(D,{required:!0,label:"身份证照片反面",modelValue:i.forms.idcardFrontImg,"onUpdate:modelValue":function(e){return i.forms.idcardFrontImg=e},readonly:!0,name:"idcardFrontImg",onClick:function(){return i.showPicker=!0},rules:[{required:!0,message:"请选择身份证照片反面",trigger:"onChange"}],placeholder:"请选择身份证照片反面"},{input:function(){return v(be,{style:{width:"100%"},tips:"上传身份证正面",modelValue:i.forms.idcardFrontImg,"onUpdate:modelValue":function(e){return i.forms.idcardFrontImg=e}},null)}}),v(D,{required:!0,label:"学历",modelValue:i.forms.educationBackground,"onUpdate:modelValue":function(e){return i.forms.educationBackground=e},readonly:!0,name:"educationBackground",onClick:function(){return i.showEducation=!0},rules:[{required:!0,message:"请选择学历",trigger:"onChange"}],placeholder:"请选择学历"},{"right-icon":function(){return v(O,{name:"arrow",color:i.checkPhone?"#aaa":"#323233",size:"16"},null)}}),v(D,{required:!0,label:"毕业学校",modelValue:i.forms.graduateSchool,"onUpdate:modelValue":function(e){return i.forms.graduateSchool=e},rules:[{required:!0,message:"请输入毕业学校"}],name:"graduateSchool",placeholder:"请输入毕业学校"},null),v(D,{required:!0,label:"所在城市",modelValue:i.forms.cityCodeName,"onUpdate:modelValue":function(e){return i.forms.cityCodeName=e},readonly:!0,name:"cityCodeName",onClick:function(){return i.showPicker=!0},rules:[{required:!0,message:"请选择所在城市",trigger:"onChange"}],placeholder:"请选择所在城市"},{"right-icon":function(){return v(O,{name:"arrow",color:i.checkPhone?"#aaa":"#323233",size:"16"},null)}}),v(D,{required:!0,label:"声部(可多选)",modelValue:i.forms.cityCodeName,"onUpdate:modelValue":function(e){return i.forms.cityCodeName=e},readonly:!0,name:"cityCodeName",onClick:function(){return i.showSubject=!0},rules:[{required:!0,message:"请选择声部",trigger:"onChange"}],placeholder:"请选择声部"},{"right-icon":function(){return v(O,{name:"arrow",color:i.checkPhone?"#aaa":"#323233",size:"16"},null)},input:function(){return v(M,null,[i.forms.subjectIds.length<=0?v("div",{class:J.subjectPlaceholder,style:"color:#c8c9cc"},[T("请选择声部")]):"",i.forms.subjectIds.length>0?v("div",null,[i.selectSubjects.map((function(e,t){return v(Q,{closeable:!0,size:"medium",color:"#FF8057",onClose:function(){return function(e,t){H({title:"提示",message:"您是否删除选中的声部",confirmButtonColor:"#ff8057",showCancelButton:!0}).then((function(){i.selectSubjects.splice(t,1);var e=[];i.selectSubjects.forEach((function(t){e.push(t.value)})),i.forms.subjectIds=e}))}(0,t)}},{default:function(){return[e.text]}})}))]):""])}})]}}),v("div",{class:J.protocol},[v(U,{modelValue:i.checked,"onUpdate:modelValue":function(e){return i.checked=e},"icon-size":"16",style:"margin-right: 6px","checked-color":"#FF8057"},null),v("span",{onClick:function(){i.checked=!i.checked}},[T("请认真阅读并勾选")]),v("span",{class:J.c},[T("《乐团伴学老师注册协议》")])]),v(j,{size:"large",block:!0,round:!0,class:J["btn-submit"],color:"#FF8057",loading:i.btnLoading,"native-type":"submit"},{default:function(){return[T("完成")]}})]}}),v(R,{show:i.showPicker,"onUpdate:show":function(e){return i.showPicker=e},position:"bottom",round:!0},{default:function(){return[v(N,{showToolbar:!0,columns:i.columns,onCancel:function(){return i.showPicker=!1},onConfirm:c,columnsFieldNames:{text:"name",value:"code",children:"areas"}},null)]}}),v(R,{show:i.showSubject,"onUpdate:show":function(e){return i.showSubject=e},position:"bottom",round:!0},{default:function(){return[v(N,{showToolbar:!0,columns:i.columnSubject,onCancel:function(){return i.showSubject=!1},onConfirm:s},null)]}}),v(R,{show:i.showSubject,"onUpdate:show":function(e){return i.showSubject=e},position:"bottom",round:!0},{default:function(){return[v(N,{showToolbar:!0,columns:i.columnSubject,onCancel:function(){return i.showSubject=!1},onConfirm:s},null)]}}),v(R,{show:i.showEducation,"onUpdate:show":function(e){return i.showEducation=e},position:"bottom",round:!0},{default:function(){return[v(N,{showToolbar:!0,columns:[{text:"专科",value:"专科"},{text:"本科",value:"本科"},{text:"硕士",value:"硕士"},{text:"博士",value:"博士"},{text:"其他",value:"其他"}],onCancel:function(){return i.showEducation=!1},onConfirm:l},null)]}}),v(R,{show:i.submitStatus,"onUpdate:show":function(e){return i.submitStatus=e},round:!0,style:"width: 75%",closeOnClickOverlay:!0},{default:function(){return[v("div",{class:J.stautsS},[v("img",{class:J["icon-close"],src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADQAAAA0CAYAAADFeBvrAAAAAXNSR0IArs4c6QAAA7dJREFUaEPdmk1oE0EUgN/bpUkxm20rHqvU4E9OLSI0/pxERFG8eOhNj3qooKDgwbMHoYJCe/Cqt4JeREEseLKagqg9xb9YtDelP7MTSVJ2n0zYlW2adGd/0obJcfPem/ftm33z3swgJPhbXV3dr2naCQAYBoCDRJRDRBMAsu4wFhExRCwDwGcAmHcc53VfX9/XpNzAuIY458OO41xCxDEi2h3FHiL+IqJpTdMeGYYxH8WGpxMZqFKpnLVt+zYAHIvjQAvdWV3X72QymRdR7IYGWllZOaxp2hQAFKIMGEKn6DjOeH9///sQOiANRERpzvldIroKAHqYQWLI2og4aRjGLUSsydiRAqpWq/vW1tamieiQjNGkZRDxQ09Pz1hvb++3INuBQIwx8Y08A4CdQcY6/P8SAJw3TXN2s3E2BeKcn7Zt+yki7uiws1LmieivrusXDMN42U6hLZCIDBG96hYYD0BAIeKpdpFqCSS+mXq9XuyCadYuEEupVKrQ6pvaAORms7fblQCk5h4AiERhGMbR5uy3AciyrPtEdE3W8HbKIeKDbDZ73e/DOiB30RRTbavWmbjvw3Ycp+BffNcBMcbebUEFEBeiWb9omuaRDbWcW5s9lxmNcw6Li4uQy+UglUrJqATK1Ot1KJfLMDg4CIZhBMr7BXRdP+fVfv8jxBh7I1tolkolWFhYgEwmA6Ojo5BOp0M50Cxcq9Vgbm4OKpUKDA0NQT6fD2tv1jTN40KpAbS8vDyi6/pHWSvibRaLxYYDcaH8MMJWoVCIFHVN00ZE69EAYoxNAMANWSAh1+xIlEglYcPn8z3TNG82gCzL+hmlOYvjUBzdVi9eNInZbHYPirYZEb+EiY5fNopjUXRk/COiA2hZ1mUieiij0E4mjINhZMP6hIhXBNAkEY2HVd4sU7VLFJ2EaWQ4xCkx5WYQ8WRcoKBE0WkYF2gGGWPfASCXBFA7KPHcW2fipvkAP8tiyv0mol1JAbWCEs+SWLOCfETEPwKoKlqGIOGw//unmNDtcGQa7olWQkkgtaaccklBubSt3MKqXOmjXHGqXPugZIPnnsJ9kq0Gur4Fd6OkziaJWzyKI0Z1trHcKKmz0SiAlNsKdlO4Opv1Aki54xQBpdSBl7cWKXUk6UFxzs/Ytv2kW85ZYx0a+yOlzLG+B6XUxQsPSqmrMf6iVZnLS82VuDLXy5rB3NO/i0lcALRt+/HAwIB0G9Oq3Qm8vCTbIwk5/xVNx3HyiLi31RVNIvqhaVqpE1c0/wHHpUliZEbjnQAAAABJRU5ErkJggg==",onClick:function(){return i.submitStatus=!1}},null),v("img",{src:"./assets/top-banner1.af55128a.png",class:J["submit-img"]},null),v("div",{class:J["submit-container"]},[v("p",{class:J["submit-title"]},[T("恭喜您已成功登记为")]),v("p",{class:J["submit-o"]},[i.name,T(" "),v("span",null,[T("【伴学老师】")])]),v("p",{class:J["submit-tips"]},[T("请下载管乐团管理端APP进行授课")]),v(j,{type:"primary",color:"#FF8057",block:!0,round:!0,onClick:function(){return i.submitStatus=!1}},{default:function(){return[T("立即下载")]}})])])]}}),i.imgCodeStatus?v(Y,{value:i.imgCodeStatus,"onUpdate:value":function(e){return i.imgCodeStatus=e},phone:i.forms.phone,onClose:function(){i.imgCodeStatus=!1},onSendCode:h},null):null])}}}))}}}))}();