1 |
- !function(){function e(e,t,o,i,r,n,a){try{var s=e[n](a),c=s.value}catch(h){return void o(h)}s.done?t(c):Promise.resolve(c).then(i,r)}function t(t){return function(){var o=this,i=arguments;return new Promise((function(r,n){var a=t.apply(o,i);function s(t){e(a,r,n,s,c,"next",t)}function c(t){e(a,r,n,s,c,"throw",t)}s(void 0)}))}}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==o)return;var i,r,n=[],a=!0,s=!1;try{for(o=o.call(e);!(a=(i=o.next()).done)&&(n.push(i.value),!t||n.length!==t);a=!0);}catch(c){s=!0,r=c}finally{try{a||null==o.return||o.return()}finally{if(s)throw r}}return n}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){if(e){if("string"==typeof e)return r(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?r(e,t):void 0}}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,i=new Array(t);o<t;o++)i[o]=e[o];return i}var n=document.createElement("style");n.innerHTML="._uploadSection_cslsh_1{width:150px;height:85px;background:#f8faf9;border-radius:4px;border:1px solid rgba(45,199,170,.26);font-size:14px;color:#2dc7aa;line-height:20px}._uploadClass_cslsh_11{height:85px;width:100%}._uploadClass_cslsh_11 .el-loading-spinner{margin-top:-33px;height:85px}._avatar-upload-preview_range_cslsh_19,._avatar-upload-preview_cslsh_19{width:180px;height:180px;box-shadow:0 0 4px #ccc;overflow:hidden}._avatar-upload-preview_range_cslsh_19 img,._avatar-upload-preview_cslsh_19 img{background-color:#f7f7f7;height:100%}._avatar-upload-preview_range_cslsh_19{border-radius:0}._previewImg_cslsh_34{padding-left:50px;padding-top:10px}._previewImg_cslsh_34>span{display:block;color:#212121;font-size:16px;padding-bottom:15px}._operation_cslsh_44{font-size:24px;display:flex;align-items:center;margin-top:20px}._operation_cslsh_44>i{margin-left:12px;cursor:pointer}._operation_cslsh_44 ._icon-rate_cslsh_54{display:inline-block;width:20px;height:20px;background:url(./images/icon_rate.png) no-repeat center;background-size:contain}._vue-cropper_cslsh_61{border-radius:5px;overflow:hidden}:deep(._el-dialog_cslsh_65){margin-bottom:10vh}:deep(._el-dialog_cslsh_65) ._el-dialog__header_cslsh_68{background:#fff;padding:15px 20px}:deep(._el-dialog_cslsh_65) ._el-dialog__header_cslsh_68 ._el-dialog__title_cslsh_72{color:#212121}:deep(._el-dialog_cslsh_65) ._el-dialog__header_cslsh_68 ._el-dialog__headerbtn_cslsh_75 ._el-dialog__close_cslsh_75{color:#212121}:deep(._el-dialog_cslsh_65) ._el-dialog__body_cslsh_78{padding-top:0}.vue-cropper[data-v-be5e5ddc]{position:relative;width:100%;height:100%;box-sizing:border-box;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;direction:ltr;touch-action:none;text-align:left;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC)}.cropper-box[data-v-be5e5ddc],.cropper-box-canvas[data-v-be5e5ddc],.cropper-drag-box[data-v-be5e5ddc],.cropper-crop-box[data-v-be5e5ddc],.cropper-face[data-v-be5e5ddc]{position:absolute;top:0;right:0;bottom:0;left:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.cropper-box-canvas img[data-v-be5e5ddc]{position:relative;text-align:left;-webkit-user-select:none;-moz-user-select:none;user-select:none;transform:none;max-width:none;max-height:none}.cropper-box[data-v-be5e5ddc]{overflow:hidden}.cropper-move[data-v-be5e5ddc]{cursor:move}.cropper-crop[data-v-be5e5ddc]{cursor:crosshair}.cropper-modal[data-v-be5e5ddc]{background:rgba(0,0,0,.5)}.cropper-view-box[data-v-be5e5ddc]{display:block;overflow:hidden;width:100%;height:100%;outline:1px solid #39f;outline-color:rgba(51,153,255,.75);-webkit-user-select:none;-moz-user-select:none;user-select:none}.cropper-view-box img[data-v-be5e5ddc]{-webkit-user-select:none;-moz-user-select:none;user-select:none;text-align:left;max-width:none;max-height:none}.cropper-face[data-v-be5e5ddc]{top:0;left:0;background-color:#fff;opacity:.1}.crop-info[data-v-be5e5ddc]{position:absolute;left:0px;min-width:65px;text-align:center;color:#fff;line-height:20px;background-color:rgba(0,0,0,.8);font-size:12px}.crop-line[data-v-be5e5ddc]{position:absolute;display:block;width:100%;height:100%;opacity:.1}.line-w[data-v-be5e5ddc]{top:-3px;left:0;height:5px;cursor:n-resize}.line-a[data-v-be5e5ddc]{top:0;left:-3px;width:5px;cursor:w-resize}.line-s[data-v-be5e5ddc]{bottom:-3px;left:0;height:5px;cursor:s-resize}.line-d[data-v-be5e5ddc]{top:0;right:-3px;width:5px;cursor:e-resize}.crop-point[data-v-be5e5ddc]{position:absolute;width:8px;height:8px;opacity:.75;background-color:#39f;border-radius:100%}.point1[data-v-be5e5ddc]{top:-4px;left:-4px;cursor:nw-resize}.point2[data-v-be5e5ddc]{top:-5px;left:50%;margin-left:-3px;cursor:n-resize}.point3[data-v-be5e5ddc]{top:-4px;right:-4px;cursor:ne-resize}.point4[data-v-be5e5ddc]{top:50%;left:-4px;margin-top:-3px;cursor:w-resize}.point5[data-v-be5e5ddc]{top:50%;right:-4px;margin-top:-3px;cursor:e-resize}.point6[data-v-be5e5ddc]{bottom:-5px;left:-4px;cursor:sw-resize}.point7[data-v-be5e5ddc]{bottom:-5px;left:50%;margin-left:-3px;cursor:s-resize}.point8[data-v-be5e5ddc]{bottom:-5px;right:-4px;cursor:se-resize}@media screen and (max-width: 500px){.crop-point[data-v-be5e5ddc]{position:absolute;width:20px;height:20px;opacity:.45;background-color:#39f;border-radius:100%}.point1[data-v-be5e5ddc]{top:-10px;left:-10px}.point2[data-v-be5e5ddc],.point4[data-v-be5e5ddc],.point5[data-v-be5e5ddc],.point7[data-v-be5e5ddc]{display:none}.point3[data-v-be5e5ddc]{top:-10px;right:-10px}.point4[data-v-be5e5ddc]{top:0;left:0}.point6[data-v-be5e5ddc]{bottom:-10px;left:-10px}.point8[data-v-be5e5ddc]{bottom:-10px;right:-10px}}\n",document.head.appendChild(n),System.register(["./icon_upload-legacy.0e79f69b.js","./index-legacy.90803b59.js"],(function(e){"use strict";var r,n,a,s,c,h,p,l,u,d,g,f,v,m,w,x,b,A,C,y,L,M,_,I,S;return{setters:[function(e){r=e.E,n=e.i},function(e){a=e.d,s=e.v,c=e.x,h=e.a0,p=e.a1,l=e.y,u=e.J,d=e.I,g=e.A,f=e.a2,v=e.b,m=e.c4,w=e.be,x=e.c,b=e.a$,A=e.bg,C=e.bh,y=e.H,L=e.c5,M=e.c6,_=e.a,I=e.bK,S=e.aX}],execute:function(){var O={uploadSection:"_uploadSection_cslsh_1",uploadClass:"_uploadClass_cslsh_11","avatar-upload-preview_range":"_avatar-upload-preview_range_cslsh_19","avatar-upload-preview":"_avatar-upload-preview_cslsh_19",previewImg:"_previewImg_cslsh_34",operation:"_operation_cslsh_44","icon-rate":"_icon-rate_cslsh_54","vue-cropper":"_vue-cropper_cslsh_61","el-dialog":"_el-dialog_cslsh_65","el-dialog__header":"_el-dialog__header_cslsh_68","el-dialog__title":"_el-dialog__title_cslsh_72","el-dialog__headerbtn":"_el-dialog__headerbtn_cslsh_75","el-dialog__close":"_el-dialog__close_cslsh_75","el-dialog__body":"_el-dialog__body_cslsh_78"},k={};k.getData=function(e){return new Promise((function(t,o){var i={};(function(e){var t=null;return new Promise((function(o,i){if(e.src)if(/^data\:/i.test(e.src))t=function(e){e=e.replace(/^data\:([^\;]+)\;base64,/gim,"");for(var t=atob(e),o=t.length,i=new ArrayBuffer(o),r=new Uint8Array(i),n=0;n<o;n++)r[n]=t.charCodeAt(n);return i}(e.src),o(t);else if(/^blob\:/i.test(e.src)){var r=new FileReader;r.onload=function(e){t=e.target.result,o(t)},function(e,t){var o=new XMLHttpRequest;o.open("GET",e,!0),o.responseType="blob",o.onload=function(e){200!=this.status&&0!==this.status||t(this.response)},o.send()}(e.src,(function(e){r.readAsArrayBuffer(e)}))}else{var n=new XMLHttpRequest;n.onload=function(){if(200!=this.status&&0!==this.status)throw"Could not load image";t=n.response,o(t),n=null},n.open("GET",e.src,!0),n.responseType="arraybuffer",n.send(null)}else i("img error")}))})(e).then((function(e){i.arrayBuffer=e,i.orientation=function(e){var t,o,i,r,n,a,s,c,h,p=new DataView(e),l=p.byteLength;if(255===p.getUint8(0)&&216===p.getUint8(1))for(c=2;c<l;){if(255===p.getUint8(c)&&225===p.getUint8(c+1)){a=c;break}c++}a&&(o=a+10,"Exif"===function(e,t,o){var i,r="";for(i=t,o+=t;i<o;i++)r+=String.fromCharCode(e.getUint8(i));return r}(p,a+4,4)&&((r=18761===(n=p.getUint16(o)))||19789===n)&&42===p.getUint16(o+2,r)&&(i=p.getUint32(o+4,r))>=8&&(s=o+i));if(s)for(l=p.getUint16(s,r),h=0;h<l;h++)if(c=s+12*h+2,274===p.getUint16(c,r)){c+=8,t=p.getUint16(c,r);break}return t}(e),t(i)})).catch((function(e){o(e)}))}))};var X=function(e,t){var r,n=e.__vccOpts||e,a=function(e,t){var o="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!o){if(Array.isArray(e)||(o=i(e))||t&&e&&"number"==typeof e.length){o&&(e=o);var r=0,n=function(){};return{s:n,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:n}}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 a,s=!0,c=!1;return{s:function(){o=o.call(e)},n:function(){var e=o.next();return s=e.done,e},e:function(e){c=!0,a=e},f:function(){try{s||null==o.return||o.return()}finally{if(c)throw a}}}}(t);try{for(a.s();!(r=a.n()).done;){var s=o(r.value,2),c=s[0],h=s[1];n[c]=h}}catch(p){a.e(p)}finally{a.f()}return n},H=a({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="",i=new RegExp(e,"i"),r=0;r<t.length;r++)i.test(t[r])&&(o=t[r]);return o?o.split("/")[1].split("."):["0","0","0"]},checkOrientationImage:function(e,t,o,i){var r=this;if(this.getVersion("chrome")[0]>=81)t=-1;else if(this.getVersion("safari")[0]>=605){var n=this.getVersion("version");n[0]>13&&n[1]>1&&(t=-1)}else{var a=navigator.userAgent.toLowerCase().match(/cpu iphone os (.*?) like mac os/);if(a){var s=a[1];((s=s.split("_"))[0]>13||s[0]>=13&&s[1]>=4)&&(t=-1)}}var c=document.createElement("canvas"),h=c.getContext("2d");switch(h.save(),t){case 2:c.width=o,c.height=i,h.translate(o,0),h.scale(-1,1);break;case 3:c.width=o,c.height=i,h.translate(o/2,i/2),h.rotate(180*Math.PI/180),h.translate(-o/2,-i/2);break;case 4:c.width=o,c.height=i,h.translate(0,i),h.scale(1,-1);break;case 5:c.height=o,c.width=i,h.rotate(.5*Math.PI),h.scale(1,-1);break;case 6:c.width=i,c.height=o,h.translate(i/2,o/2),h.rotate(90*Math.PI/180),h.translate(-o/2,-i/2);break;case 7:c.height=o,c.width=i,h.rotate(.5*Math.PI),h.translate(o,-i),h.scale(-1,1);break;case 8:c.height=o,c.width=i,h.translate(i/2,o/2),h.rotate(-90*Math.PI/180),h.translate(-o/2,-i/2);break;default:c.width=o,c.height=i}h.drawImage(e,0,0,o,i),h.restore(),c.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,i=t.height;k.getData(t).then((function(r){e.orientation=r.orientation||1;var n=Number(e.maxImgSize);!e.orientation&&o<n&i<n?e.imgs=e.img:(o>n&&(i=i/o*n,o=n),i>n&&(o=o/i*n,i=n),e.checkOrientationImage(t,e.orientation,o,i))}))},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,i=this.touches[0].clientX,r=this.touches[0].clientY,n=e.touches[0].clientX,a=e.touches[0].clientY,s=this.touches[1].clientX,c=this.touches[1].clientY,h=e.touches[1].clientX,p=e.touches[1].clientY,l=Math.sqrt(Math.pow(i-s,2)+Math.pow(r-c,2)),u=Math.sqrt(Math.pow(n-h,2)+Math.pow(a-p,2))-l,d=1,g=(d=(d=d/this.trueWidth>d/this.trueHeight?d/this.trueHeight:d/this.trueWidth)>.1?.1:d)*u;if(!this.touchNow){if(this.touchNow=!0,u>0?o+=Math.abs(g):u<0&&o>Math.abs(g)&&(o-=Math.abs(g)),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,i,r="clientX"in e?e.clientX:e.touches[0].clientX,n="clientY"in e?e.clientY:e.touches[0].clientY;o=r-this.moveX,i=n-this.moveY,this.$nextTick((function(){if(t.centerBox){var e,r,n,a,s=t.getImgAxis(o,i,t.scale),c=t.getCropAxis(),h=t.trueHeight*t.scale,p=t.trueWidth*t.scale;switch(t.rotate){case 1:case-1:case 3:case-3:e=t.cropOffsertX-t.trueWidth*(1-t.scale)/2+(h-p)/2,r=t.cropOffsertY-t.trueHeight*(1-t.scale)/2+(p-h)/2,n=e-h+t.cropW,a=r-p+t.cropH;break;default:e=t.cropOffsertX-t.trueWidth*(1-t.scale)/2,r=t.cropOffsertY-t.trueHeight*(1-t.scale)/2,n=e-p+t.cropW,a=r-h+t.cropH}s.x1>=c.x1&&(o=e),s.y1>=c.y1&&(i=r),s.x2<=c.x2&&(o=n),s.y2<=c.y2&&(i=a)}t.x=o,t.y=i,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,i=e.deltaY||e.wheelDelta;i=navigator.userAgent.indexOf("Firefox")>0?30*i:i,this.isIE&&(i=-i);var r=this.coe,n=(r=r/this.trueWidth>r/this.trueHeight?r/this.trueHeight:r/this.trueWidth)*i;n<0?o+=Math.abs(n):o>Math.abs(n)&&(o-=Math.abs(n));var a=n<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,i="clientY"in e?e.clientY:e.touches?e.touches[0].clientY:0;this.$nextTick((function(){var e=o-t.cropX,r=i-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 n=t.cropW/t.fixedNumber[0]*t.fixedNumber[1];n+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=n,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,i,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=i,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,i="clientY"in e?e.clientY:e.touches?e.touches[0].clientY:0,r=this.w,n=this.h,a=0,s=0;if(this.centerBox){var c=this.getImgAxis(),h=c.x2,p=c.y2;a=c.x1>0?c.x1:0,s=c.y1>0?c.y1:0,r>h&&(r=h),n>p&&(n=p)}this.$nextTick((function(){var e=o-t.cropX,c=i-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-c>0?(t.cropH=n-t.cropChangeY-c<=n-s?t.cropOldH-c:t.cropOldH+t.cropChangeY-s,t.cropOffsertY=n-t.cropChangeY-c<=n-s?t.cropChangeY+c:s):(t.cropH=Math.abs(c)+t.cropChangeY<=n?Math.abs(c)-t.cropOldH:n-t.cropOldH-t.cropChangeY,t.cropOffsertY=t.cropChangeY+t.cropOldH):2===t.changeCropTypeY&&(t.cropOldH+c>0?(t.cropH=t.cropOldH+c+t.cropOffsertY<=n?t.cropOldH+c:n-t.cropOffsertY,t.cropOffsertY=t.cropChangeY):(t.cropH=n-t.cropChangeY+Math.abs(c+t.cropOldH)<=n-s?Math.abs(c+t.cropOldH):t.cropChangeY-s,t.cropOffsertY=n-t.cropChangeY+Math.abs(c+t.cropOldH)<=n-s?t.cropChangeY-Math.abs(c+t.cropOldH):s))),t.canChangeX&&t.fixed){var h=t.cropW/t.fixedNumber[0]*t.fixedNumber[1];h+t.cropOffsertY>n?(t.cropH=n-t.cropOffsertY,t.cropW=t.cropH/t.fixedNumber[1]*t.fixedNumber[0]):t.cropH=h}if(t.canChangeY&&t.fixed){var p=t.cropH/t.fixedNumber[1]*t.fixedNumber[0];p+t.cropOffsertX>r?(t.cropW=r-t.cropOffsertX,t.cropH=t.cropW/t.fixedNumber[0]*t.fixedNumber[1]):t.cropW=p}}))},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,i="clientX"in e?e.clientX:e.touches[0].clientX,r="clientY"in e?e.clientY:e.touches[0].clientY;t=i-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,i=0,r=0;e&&(e.preventDefault(),i="clientX"in e?e.clientX:e.touches[0].clientX,r="clientY"in e?e.clientY:e.touches[0].clientY),this.$nextTick((function(){var e,n,a=i-o.cropX,s=r-o.cropY;if(t&&(a=o.cropOffsertX,s=o.cropOffsertY),e=a<=0?0:a+o.cropW>o.w?o.w-o.cropW:a,n=s<=0?0:s+o.cropH>o.h?o.h-o.cropH:s,o.centerBox){var c=o.getImgAxis();e<=c.x1&&(e=c.x1),e+o.cropW>c.x2&&(e=c.x2-o.cropW),n<=c.y1&&(n=c.y1),n+o.cropH>c.y2&&(n=c.y2-o.cropH)}o.cropOffsertX=e,o.cropOffsertY=n,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 i={x1:0,x2:0,y1:0,y2:0},r=this.trueWidth*o,n=this.trueHeight*o;switch(this.rotate){case 0:i.x1=e+this.trueWidth*(1-o)/2,i.x2=i.x1+this.trueWidth*o,i.y1=t+this.trueHeight*(1-o)/2,i.y2=i.y1+this.trueHeight*o;break;case 1:case-1:case 3:case-3:i.x1=e+this.trueWidth*(1-o)/2+(r-n)/2,i.x2=i.x1+this.trueHeight*o,i.y1=t+this.trueHeight*(1-o)/2+(n-r)/2,i.y2=i.y1+this.trueWidth*o;break;default:i.x1=e+this.trueWidth*(1-o)/2,i.x2=i.x1+this.trueWidth*o,i.y1=t+this.trueHeight*(1-o)/2,i.y2=i.y1+this.trueHeight*o}return i},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"),i=new Image,r=this.rotate,n=this.trueWidth,a=this.trueHeight,s=this.cropOffsertX,c=this.cropOffsertY;function h(e,t){o.width=Math.round(e),o.height=Math.round(t)}i.onload=function(){if(0!==t.cropW){var p=o.getContext("2d"),l=1;t.high&!t.full&&(l=window.devicePixelRatio),1!==t.enlarge&!t.full&&(l=Math.abs(Number(t.enlarge)));var u=t.cropW*l,d=t.cropH*l,g=n*t.scale*l,f=a*t.scale*l,v=(t.x-s+t.trueWidth*(1-t.scale)/2)*l,m=(t.y-c+t.trueHeight*(1-t.scale)/2)*l;switch(h(u,d),p.save(),r){case 0:t.full?(h(u/t.scale,d/t.scale),p.drawImage(i,v/t.scale,m/t.scale,g/t.scale,f/t.scale)):p.drawImage(i,v,m,g,f);break;case 1:case-3:t.full?(h(u/t.scale,d/t.scale),v=v/t.scale+(g/t.scale-f/t.scale)/2,m=m/t.scale+(f/t.scale-g/t.scale)/2,p.rotate(90*r*Math.PI/180),p.drawImage(i,m,-v-f/t.scale,g/t.scale,f/t.scale)):(v+=(g-f)/2,m+=(f-g)/2,p.rotate(90*r*Math.PI/180),p.drawImage(i,m,-v-f,g,f));break;case 2:case-2:t.full?(h(u/t.scale,d/t.scale),p.rotate(90*r*Math.PI/180),v/=t.scale,m/=t.scale,p.drawImage(i,-v-g/t.scale,-m-f/t.scale,g/t.scale,f/t.scale)):(p.rotate(90*r*Math.PI/180),p.drawImage(i,-v-g,-m-f,g,f));break;case 3:case-1:t.full?(h(u/t.scale,d/t.scale),v=v/t.scale+(g/t.scale-f/t.scale)/2,m=m/t.scale+(f/t.scale-g/t.scale)/2,p.rotate(90*r*Math.PI/180),p.drawImage(i,-m-g/t.scale,v,g/t.scale,f/t.scale)):(v+=(g-f)/2,m+=(f-g)/2,p.rotate(90*r*Math.PI/180),p.drawImage(i,-m-g,v,g,f));break;default:t.full?(h(u/t.scale,d/t.scale),p.drawImage(i,v/t.scale,m/t.scale,g/t.scale,f/t.scale)):p.drawImage(i,v,m,g,f)}p.restore()}else{var w=n*t.scale,x=a*t.scale,b=o.getContext("2d");switch(b.save(),r){case 0:h(w,x),b.drawImage(i,0,0,w,x);break;case 1:case-3:h(x,w),b.rotate(90*r*Math.PI/180),b.drawImage(i,0,-x,w,x);break;case 2:case-2:h(w,x),b.rotate(90*r*Math.PI/180),b.drawImage(i,-w,-x,w,x);break;case 3:case-1:h(x,w),b.rotate(90*r*Math.PI/180),b.drawImage(i,-w,0,w,x);break;default:h(w,x),b.drawImage(i,0,0,w,x)}b.restore()}e(o)},"data"!==this.img.substr(0,4)&&(i.crossOrigin="Anonymous"),i.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,i=this.scale,r={};r.div={width:"".concat(t,"px"),height:"".concat(o,"px")};var n=(this.x-this.cropOffsertX)/i,a=(this.y-this.cropOffsertY)/i;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(i,")translate3d(").concat(n,"px, ").concat(a,"px, ").concat(0,"px)rotateZ(").concat(90*this.rotate,"deg)")},r.html='\n <div class="show-preview" style="width: '.concat(r.w,"px; height: ").concat(r.h,'px,; overflow: hidden">\n <div style="width: ').concat(t,"px; height: ").concat(o,'px">\n <img src=').concat(r.url,' style="width: ').concat(this.trueWidth,"px; height: ").concat(this.trueHeight,"px; transform:\n scale(").concat(i,")translate3d(").concat(n,"px, ").concat(a,"px, ").concat(0,"px)rotateZ(").concat(90*this.rotate,'deg)">\n </div>\n </div>'),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)<this.h&&(e=(t=this.h)/this.trueHeight);break;default:try{var i=o[0];if(-1!==i.search("px")){i=i.replace("px","");var r=parseFloat(i)/this.trueWidth,n=1,a=o[1];-1!==a.search("px")&&(a=a.replace("px",""),n=(t=parseFloat(a))/this.trueHeight),e=Math.min(r,n)}if(-1!==i.search("%")&&(i=i.replace("%",""),e=parseFloat(i)/100*this.w/this.trueWidth),2===o.length&&"auto"===i){var s=o[1];-1!==s.search("px")&&(s=s.replace("px",""),e=(t=parseFloat(s))/this.trueHeight),-1!==s.search("%")&&(s=s.replace("%",""),e=(t=parseFloat(s)/100*this.h)/this.trueHeight)}}catch(c){e=1}}return e},goAutoCrop:function(e,t){if(""!==this.imgs&&null!==this.imgs){this.clearCrop(),this.cropping=!0;var o=this.w,i=this.h;if(this.centerBox){var r=Math.abs(this.rotate)%2>0,n=(r?this.trueHeight:this.trueWidth)*this.scale,a=(r?this.trueWidth:this.trueHeight)*this.scale;o=n<o?n:o,i=a<i?a:i}var s=e||parseFloat(this.autoCropWidth),c=t||parseFloat(this.autoCropHeight);0!==s&&0!==c||(s=.8*o,c=.8*i),s=s>o?o:s,c=c>i?i:c,this.fixed&&(c=s/this.fixedNumber[0]*this.fixedNumber[1]),c>this.h&&(s=(c=this.h)/this.fixedNumber[1]*this.fixedNumber[0]),this.changeCrop(s,c)}},changeCrop:function(e,t){var o=this;if(this.centerBox){var i=this.getImgAxis();e>i.x2-i.x1&&(t=(e=i.x2-i.x1)/this.fixedNumber[0]*this.fixedNumber[1]),t>i.y2-i.y1&&(e=(t=i.y2-i.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 i=!0;if(this.centerBox){var r=this.getImgAxis(e,t,o),n=this.getCropAxis();r.x1>=n.x1&&(i=!1),r.x2<=n.x2&&(i=!1),r.y1>=n.y1&&(i=!1),r.y2<=n.y2&&(i=!1)}return i}},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,i){for(var r=atob(this.toDataURL(o,i).split(",")[1]),n=r.length,a=new Uint8Array(n),s=0;s<n;s++)a[s]=r.charCodeAt(s);t(new Blob([a],{type:e.type||"image/png"}))}}),this.showPreview(),this.checkedImg()},destroyed:function(){window.removeEventListener("mousemove",this.moveCrop),window.removeEventListener("mouseup",this.leaveCrop),window.removeEventListener("touchmove",this.moveCrop),window.removeEventListener("touchend",this.leaveCrop),this.cancelScale()}}),W={key:0,class:"cropper-box"},Y=["src"],E={class:"cropper-view-box"},B=["src"],T={key:1};var U=X(H,[["render",function(e,t,o,i,r,n){return s(),c("div",{class:"vue-cropper",ref:"cropper",onMouseover:t[28]||(t[28]=function(){return e.scaleImg&&e.scaleImg.apply(e,arguments)}),onMouseout:t[29]||(t[29]=function(){return e.cancelScale&&e.cancelScale.apply(e,arguments)})},[e.imgs?(s(),c("div",W,[h(l("div",{class:"cropper-box-canvas",style:u({width:e.trueWidth+"px",height:e.trueHeight+"px",transform:"scale("+e.scale+","+e.scale+") translate3d("+e.x/e.scale+"px,"+e.y/e.scale+"px,0)rotateZ("+90*e.rotate+"deg)"})},[l("img",{src:e.imgs,alt:"cropper-img",ref:"cropperImg"},null,8,Y)],4),[[p,!e.loading]])])):d("",!0),l("div",{class:g(["cropper-drag-box",{"cropper-move":e.move&&!e.crop,"cropper-crop":e.crop,"cropper-modal":e.cropping}]),onMousedown:t[0]||(t[0]=function(){return e.startMove&&e.startMove.apply(e,arguments)}),onTouchstart:t[1]||(t[1]=function(){return e.startMove&&e.startMove.apply(e,arguments)})},null,34),h(l("div",{class:"cropper-crop-box",style:u({width:e.cropW+"px",height:e.cropH+"px",transform:"translate3d("+e.cropOffsertX+"px,"+e.cropOffsertY+"px,0)"})},[l("span",E,[l("img",{style:u({width:e.trueWidth+"px",height:e.trueHeight+"px",transform:"scale("+e.scale+","+e.scale+") translate3d("+(e.x-e.cropOffsertX)/e.scale+"px,"+(e.y-e.cropOffsertY)/e.scale+"px,0)rotateZ("+90*e.rotate+"deg)"}),src:e.imgs,alt:"cropper-img"},null,12,B)]),l("span",{class:"cropper-face cropper-move",onMousedown:t[2]||(t[2]=function(){return e.cropMove&&e.cropMove.apply(e,arguments)}),onTouchstart:t[3]||(t[3]=function(){return e.cropMove&&e.cropMove.apply(e,arguments)})},null,32),e.info?(s(),c("span",{key:0,class:"crop-info",style:u({top:e.cropInfo.top})},f(e.cropInfo.width)+" × "+f(e.cropInfo.height),5)):d("",!0),e.fixedBox?d("",!0):(s(),c("span",T,[l("span",{class:"crop-line line-w",onMousedown:t[4]||(t[4]=function(t){return e.changeCropSize(t,!1,!0,0,1)}),onTouchstart:t[5]||(t[5]=function(t){return e.changeCropSize(t,!1,!0,0,1)})},null,32),l("span",{class:"crop-line line-a",onMousedown:t[6]||(t[6]=function(t){return e.changeCropSize(t,!0,!1,1,0)}),onTouchstart:t[7]||(t[7]=function(t){return e.changeCropSize(t,!0,!1,1,0)})},null,32),l("span",{class:"crop-line line-s",onMousedown:t[8]||(t[8]=function(t){return e.changeCropSize(t,!1,!0,0,2)}),onTouchstart:t[9]||(t[9]=function(t){return e.changeCropSize(t,!1,!0,0,2)})},null,32),l("span",{class:"crop-line line-d",onMousedown:t[10]||(t[10]=function(t){return e.changeCropSize(t,!0,!1,2,0)}),onTouchstart:t[11]||(t[11]=function(t){return e.changeCropSize(t,!0,!1,2,0)})},null,32),l("span",{class:"crop-point point1",onMousedown:t[12]||(t[12]=function(t){return e.changeCropSize(t,!0,!0,1,1)}),onTouchstart:t[13]||(t[13]=function(t){return e.changeCropSize(t,!0,!0,1,1)})},null,32),l("span",{class:"crop-point point2",onMousedown:t[14]||(t[14]=function(t){return e.changeCropSize(t,!1,!0,0,1)}),onTouchstart:t[15]||(t[15]=function(t){return e.changeCropSize(t,!1,!0,0,1)})},null,32),l("span",{class:"crop-point point3",onMousedown:t[16]||(t[16]=function(t){return e.changeCropSize(t,!0,!0,2,1)}),onTouchstart:t[17]||(t[17]=function(t){return e.changeCropSize(t,!0,!0,2,1)})},null,32),l("span",{class:"crop-point point4",onMousedown:t[18]||(t[18]=function(t){return e.changeCropSize(t,!0,!1,1,0)}),onTouchstart:t[19]||(t[19]=function(t){return e.changeCropSize(t,!0,!1,1,0)})},null,32),l("span",{class:"crop-point point5",onMousedown:t[20]||(t[20]=function(t){return e.changeCropSize(t,!0,!1,2,0)}),onTouchstart:t[21]||(t[21]=function(t){return e.changeCropSize(t,!0,!1,2,0)})},null,32),l("span",{class:"crop-point point6",onMousedown:t[22]||(t[22]=function(t){return e.changeCropSize(t,!0,!0,1,2)}),onTouchstart:t[23]||(t[23]=function(t){return e.changeCropSize(t,!0,!0,1,2)})},null,32),l("span",{class:"crop-point point7",onMousedown:t[24]||(t[24]=function(t){return e.changeCropSize(t,!1,!0,0,2)}),onTouchstart:t[25]||(t[25]=function(t){return e.changeCropSize(t,!1,!0,0,2)})},null,32),l("span",{class:"crop-point point8",onMousedown:t[26]||(t[26]=function(t){return e.changeCropSize(t,!0,!0,2,2)}),onTouchstart:t[27]||(t[27]=function(t){return e.changeCropSize(t,!0,!0,2,2)})},null,32)]))],4),[[p,e.cropping]])],544)}],["__scopeId","data-v-be5e5ddc"]]);"undefined"!=typeof window&&window.Vue&&window.Vue.createApp({}).component("VueCropper",U);var K=a({name:"cropper",props:{cropperNo:{type:Function,default:function(e){}},cropperOk:{type:Function,default:function(e){}},bucket:{type:String,default:"daya"}},data:function(){return{ossUploadUrl:"https://ks3-cn-beijing.ksyuncs.com/"+this.bucket,dataObj:{policy:"",signature:"",key:"",KSSAccessKeyId:"",acl:"public-read",name:""},visible:!1,img:null,options:{img:"",autoCrop:!0,autoCropWidth:180,autoCropHeight:180,fixedBox:!0,full:!1,enlarge:1,previewsCircle:!0,centerBox:!0,outputType:"png",title:"修改头像",name:null},previews:{},url:{upload:"/sys/common/saveToImgByStr"},submitLoading:!1}},methods:{edit:function(e){var t=this.options;this.visible=!0,this.options=Object.assign({},t,e),console.log(this.options)},cancelHandel:function(){this.visible=!1,this.cropperNo()},okHandel:function(){var e=this;this.$refs.cropperRef.getCropBlob(function(){var o=t(regeneratorRuntime.mark((function t(o){var i,r,n,a,s,c,h,p;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.submitLoading=!0,i=e.options,r=(i.name?i.name.split(".")[0]:+new Date)+".png",t.prev=3,n=(new Date).getTime()+r,a={filename:r,bucketName:e.bucket,postData:{filename:r,acl:"public-read",key:n,unknowValueField:[]}},t.next=8,v.post("/api-website/getUploadSign",{data:a});case 8:for(h in s=t.sent,e.dataObj={policy:s.data.policy,signature:s.data.signature,key:n,KSSAccessKeyId:s.data.kssAccessKeyId,acl:"public-read",name:r},c=new FormData,e.dataObj)c.append(h,e.dataObj[h]);return c.append("file",e.blobToFile(o,r),r),t.next=15,m(e.ossUploadUrl,{method:"POST",data:c});case 15:console.log(e.ossUploadUrl+"/"+n),p=e.ossUploadUrl+"/"+n,e.cropperOk(p),t.next=23;break;case 20:t.prev=20,t.t0=t.catch(3),w.error(t.t0);case 23:return t.prev=23,e.submitLoading=!1,e.cancelHandel(),t.finish(23);case 27:case"end":return t.stop()}}),t,null,[[3,20,23,27]])})));return function(e){return o.apply(this,arguments)}}())},blobToFile:function(e,t){return e.lastModifiedDate=new Date,e.name=t,e},base64ToFile:function(e,t){for(var o=e.split(","),i=o[0].match(/:(.*?);/)[1],r=atob(o[1]),n=r.length,a=new Uint8Array(n);n--;)a[n]=r.charCodeAt(n);return new File([a],t,{type:i})},realTime:function(e){this.previews=e},changeScale:function(e){e=e||1,this.$refs.cropperRef.changeScale(e)},rotateLeft:function(){this.$refs.cropperRef.rotateLeft()},rotateRight:function(){this.$refs.cropperRef.rotateRight()}},render:function(){var e=this;return x(b,{modelValue:this.visible,"onUpdate:modelValue":function(t){return e.visible=t},appendToBody:!0,title:this.options.title,closeOnClickModal:!1,width:"900px"},{default:function(){return[x(A,null,{default:function(){return[x(C,{xs:24,md:12,style:{width:"350px"}},{default:function(){return[x(U,{ref:"cropperRef",img:e.options.img,info:!0,autoCrop:e.options.autoCrop,autoCropWidth:e.options.autoCropWidth,full:e.options.full,outputType:e.options.outputType,autoCropHeight:e.options.autoCropHeight,fixedBox:e.options.fixedBox,enlarge:e.options.enlarge,onRealTime:e.realTime,style:{height:"350px"}},null),x("div",{class:"flex pt-2"},[x("div",{onClick:function(){e.changeScale(1)},class:"mr-2 cursor-pointer",title:"放大"},[x(y,{size:30,color:"#333"},{default:function(){return[x(L,null,null)]}})]),x("div",{onClick:function(){e.changeScale(-1)},class:"mr-2 cursor-pointer",title:"缩小"},[x(y,{size:30,color:"#333"},{default:function(){return[x(M,null,null)]}})]),x("div",{onClick:e.rotateRight,title:"向右旋转",class:"cursor-pointer"},[x("img",{src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABBlJREFUaEPtmVuoVkUUx3/HFxWflFIQFPGCL0mBmhdCBEW8PqhkUSEmomjpiyTqiwpeUXxIFE1KyEIzCcUoBStQwhteMJTIEgzRoBTSXnoy/jIT6wyz9579fXt/ng8c2Jzz7Zm91v+/1po1M2s6aPPW0eb4eU4g8OArwERgODDIPH8Dv5vnHHASeNxsBFThgZnAXAdcoMu0L4EfgGPA/TIf+rHNEBDwxcCsRhQH39wD9gP7yhJphEBfYI+zeoj9Z+B7QJb9C3jg/vYAepvnbUBPzwwi61ONUpbAKOA40D9Q8BFwADifqhjoA7wJLARGBt/JAPNSZJUhIKusiwAX+MspynLGKBT1WCI3gJeK5KYSWOrCxsqThWSpKpu8uCAQmIsxhcBs4KtA6ADgbpXIjazNwBrz+1tgepauIgID3aQc4gQ8BAYDyut1tknAaaNgO7AqprCIgLKNwkftV2AO8FOdyI1sTe6Pze/3ImGcu5WYAXxtBMgqSpGtbLuBZU7hb8A44E8LIM8DZ4HX3OBtwOpWIne6XgR+BIa531uD+ZHpgbeAz91H14AJVexbGjTAEmCv+/ZfYDxwxcvK8oBCRyGkthLYGShPXSn9uLLjQ66ngCnupWRtyCOgsFH4qCnrjAC0V7EttqiFSqXEEggXwbzxYd+7wCfu5QVgbB6BLSbelYU0+8PWagJad7Qd901p/bZ+xELokNujqH8+cLCAwP/udOO8pbM8kDI+opKLwGjXsQLYlUXAZp+XgesJBGKhkkegaHyMgPX6DuCDLALKt1pts/r13gprBmiWnBiB5cCHrkNnB23+OoWQXKLdnxaL7kaC0paOgLaFim1fSgg14gGdHz5zio4Ab4QEZPXv3DnWA1I6jZ24mpnEKR6LeWAa8I3rUFqdGgsR6yb163D+S8EciCnTOwtUXvFWr5WAFMs9r7uN1KIMdAKkDPYkksmeWQh5rCqNXAVecGfaLAsXZQq7YqZ4oNMKGxFeOInDSZq6/OdN7qLJWiYLJafRFIvnkUsJoaKsFcOQvJClEiiztymbtUIMpbYSVRHImgNZ8vPmQKnNXCqBonHKUH7fkzKf7PhQtt1O2zTcFtXphg401gLvuNV5Y5HJa+hv+EgpLK+6s4C21GrRqkANoK3Ipg71EnQ0KOKK1KWaQXvxTZdVvKA/gH4GdFEtqQp+lRW2BEYljXBDNwaenpDqaJWWFj1Am4f9u/cBxWiVrZbirgeoG5kTAdpP3a71TJMsai+ve3zaoaq8ER5yVIj9AjgM/JNIpuUXHBbXWmBTBOgdQHUbFYJvAbqkuAl06ypXTBazavY6+OjplWj1rGEtveQLQehq1RPxdZtUPs/0mjUGcjIwFFDlTH/9/4+68kV3qrVrGdeKVbUW4F5o2xP4DzVSDEAyxtmHAAAAAElFTkSuQmCC",class:"w-[30px] h-[30px]"},null)])])]}}),x(C,{xs:24,md:12,style:{height:"350px"}},{default:function(){return[x("div",{class:O.previewImg},[x("span",null,[_("预览图片")]),x("div",{class:e.options.previewsCircle?O["avatar-upload-preview"]:O["avatar-upload-preview_range"],style:{width:e.options.autoCropWidth+"px",height:e.options.autoCropHeight+"px"}},[x(I,{src:e.previews.url,style:e.previews.img},null)])])]}})]}})]},footer:function(){return x("span",{class:"dialog-footer !text-center block"},[x(S,{onClick:e.cancelHandel,disabled:e.submitLoading},{default:function(){return[_("取消")]}}),x(S,{type:"primary",onClick:e.okHandel,loading:e.submitLoading},{default:function(){return[_("保 存")]}})])}})}});e("C",a({name:"col-cropper",props:{modelValue:{type:String,default:""},options:{type:Object,default:{autoCrop:!0,enlarge:1,autoCropWidth:200,autoCropHeight:200,fixedBox:!0,previewsCircle:!0,title:"上传图片"}},showSize:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},bucket:{type:String,default:"daya"},size:{type:Number,default:5},accept:{type:String,default:".png,.jpg,.jpeg"},tips:{type:String,default:"请上传图片"},extraTips:{type:String,default:"图片最大不能超过5MB"},cropUploadSuccess:{type:Function,default:function(e){}}},data:function(){return{isStopRun:!1,loading:!1}},methods:{onDelete:function(){this.$emit("update:modelValue","")},handleChange:function(e){var o=this;return t(regeneratorRuntime.mark((function t(){var i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!o.isStopRun){t.next=2;break}return t.abrupt("return");case 2:o.loading=!0,i=o.options,o.getBase64(e.file,(function(t){var r=Object.assign({},i,{img:t,name:e.file.name});o.$refs.CropperModal.edit(r)}));case 5:case"end":return t.stop()}}),t)})))()},beforeUpload:function(e){if(this.isStopRun=!1,e.type.indexOf("image")<0)return w.warning("请上传图片"),this.isStopRun=!0,!1;var t=this.size||0,o=e.size<1024*t*1024;return o||(w.error("图片大小不能超过"+this.size+"MB!"),this.isStopRun=!0),o},error:function(){this.remove(),this.loading=!1},remove:function(){this.onDelete()},handleCropperSuccess:function(e){this.loading=!1,this.$emit("update:modelValue",e),this.cropUploadSuccess(e)},handleCropperClose:function(){this.loading=!1,this.remove()},getBase64:function(e,t){var o=new FileReader;o.addEventListener("load",(function(){return t(o.result)})),o.readAsDataURL(e)}},render:function(){var e=this;return x("div",{class:[O.colUpload,"w-full"]},[x(r,{disabled:this.disabled,showFileList:!1,accept:this.accept,beforeUpload:this.beforeUpload,httpRequest:this.handleChange,ref:"uploadRef"},{default:function(){return[x("div",{ref:"uploadDom",class:[O.uploadClass,"w-full"],style:{height:"85px"}},[e.modelValue?x(I,{src:e.modelValue,fit:"cover",class:O.uploadSection},null):x("div",{class:[O.uploadSection,"flex items-center flex-col justify-center"]},[x("img",{src:n,class:"w-8 h-7 mb-3"},null),x("p",null,[e.tips])])])]}}),x("p",{class:"text-3 text-[#999999] leading-6 pt-1"},[this.extraTips]),x(K,{ref:"CropperModal",bucket:this.bucket,cropperNo:this.handleCropperClose,cropperOk:this.handleCropperSuccess},null)])}})),e("i","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAAXNSR0IArs4c6QAAAMxQTFRFAAAA/wAA/4AA/1VV/4BA/3hL/3lR/3lJ/3tM/3lK/3ZJ/3VL/3dK/3hM/3dL/3ZL/3lL/3dK/3hL/3dK/3hM/3hM/3ZN/3lK/3dM/3ZL/3dK/3hL/3dL/3hK/3ZM/3dK/3ZL/3ZK/3dL/3dL/3ZL/3dM/3dL/3dM/3dL/3dL/72U/7yT/7yU/3dM/3dL/3ZK/3dM/3hL/3dM/3dL/3dL/3dL/3dK/3dL/3dL/3dK/3dL/3dL/3dL/3hL/3ZK/3dL/3dL/3dL/3dL/7yT8tV7KQAAAEJ0Uk5TAAECAwQRExUbNzg9PkZHTk5PZmdobG5udnd4e36GipSZqKmwsba8vb6/wcLDx8/R1NfY3N3e3+Pk5ujt7vH6+/z+WujnJgAAAL5JREFUOMtjYBicQMTUCRNYSDAhqxFywg6kkRWZ4FBkzYKkCCJkY2RkZIuqih1dkRQjkMUsh1eRPoTJZI5PkRKUrYFPkSKUrU6xIk0o2wCfIntuMFPQEW8Q2KkoKCioOuAPJ2wAqEhbhwhFzs6kKlKTlEABMpZYFLGhpzExLIpkuThRAI8uuW6iniJ5Pl4UwK+HRREruu9EsShSFhFGAeJm1Ha4lhYRiuDAGJciLiKyuZMhB6ECAwSsBKhdNgEAhZGjV9WWahoAAAAASUVORK5CYII="),e("a","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAAXNSR0IArs4c6QAAAYlQTFRFAAAA/wAA//8A/4AA/4CA/1VV/6pV/4BA/3FV/4BN/3RG/2pA/4BA/3dE/3hL/3FH/3lR/3pO/3VK/3tM/3ZJ/3tP/3dM/3NK/3hQ/3RN/3xN/3hL/3VJ/3lK/3NN/3dN/3VN/3hI/3hN/3ZM/3lK/3lM/3lJ/3dK/3pL/3pM/3pK/3hJ/3hK/3dJ/3dL/3dM/3ZJ/3hK/3hN/3hL/3pN/3hJ/3hM/3hK/3lK/3ZL/3hK/3ZK/3hM/3dL/3dK/3dL/3hL/3dL/3hL/3ZL/3dK/3dL/3dM/3hL/3hK/3hM/3ZK/3hL/3ZL/3hL/3dL/3dK/3ZL/3hL/3dK/3hM/3dL/3hL/3dK/3dL/3dL/3hL/3dL/3hM/3dL/3dL/3hL/3hM/3dL/3hL/3dL/3dL/3dL/3dL/3dL/3ZK/3dL/3dL/3dK/3dL/3hL/3dL/3dL/3dL/3dL/3ZL/3dL/3dL/3dL/3dL/3hL/3dL/3dL/3dL/3dL/3ZL/3dL/3dL/3dK/3dL/3ZL/3dL/3dLUpnnKgAAAIJ0Uk5TAAEBAgIDAwQJCgsMDA8REhMXGBscHR4fICEhIiMmKCsyNTU2Nzk7PkFDRUZISUtNUFNTVVZXV1ldX2BhbG14en1+hIyNjpCVl5ebnaamp6+xsbKztLW2uLq7vMDByMjKy9PV1tna29zc3d/f4OTl5urr6+zu7/H09fb3+Pj5+vv8/C49xn0AAAFgSURBVDjLY2CgLjAKTk5BAgqCtowYajyaUIGaSFOEMJoakyZMRU0l5qiKwtEVqQuDSD8+ZEUZ6IqsWYtBVK42kqIcdEXRDHqlIDqfGY+iJgcGLgVlZWUBfCY1NYXqy0oAARNeRVDAO6CKGhx1dZCAQRg2RT5oUcVZhUWRG3qkl2BRlC2EqsYYq8Nr0lKRQKavhZK8hj0HPt+FiArbBcZGOivjUeTK7lQLYQUL4VLkzx4AZ2eJISkqVmVjgQEGJ1DAeaaDVcWzIhS5I/lMGGRXKoMjxCxLhCIvJEV2TciKohGKyk2lJKCAMQhFUTUrNodzx0EUKdrY2LgCWXzYFMlEgcg8cPqWbGpqhJiUhKrI0AVMlRUBQWVTUyLETd6oivxUULiOEEVyFSii9fIhSLxCWCRrFaCoipPOhrPrNOEhw2Nm74AE1MQTYOZo4imLWK1iapoaEx15CZRZrPzsJJVxAFTmTJ0otZgdAAAAAElFTkSuQmCC")}}}))}();
|