text: (window.webpackJsonp=window.webpackJsonp||[]).push([[118],{1118:function(t,e,n){t.exports={}},2428:function(t,e,n){"use strict";n(1118)},2733:function(t,e,n){"use strict";n.r(e);var o=n(2426),r=n.n(o),c=n(251),l=n(646),m=(n(2427),n(643)),f={name:"PictureClipping",data:function(){return{n:"",file:null,preview:null,cropper:null,option:{outputType:"png"},mode:"crop"}},methods:{setDragMode:function(t){this.cropper.setDragMode(t),this.mode=t},handleChange:function(t){var e=this;this.file=null,this.mode="crop",this.preview=null,this.cropper&&(this.cropper.destroy(),this.cropper=null);var n=t.target.files;if(!n.length)return!1;var o=n[0];Object(m.a)(o).then((function(t){e.preview=t,e.file=o,e.$nextTick(e.init)}))},init:function(){this.cropper=new r.a(this.$refs.preview)},crop:function(){Object(c.a)(this.cropper.getCroppedCanvas().toDataURL(),"".concat(Object(l.a)(),".png")),this.$notify.success({title:"裁剪成功",message:"已保存到设备"})}}},d=(n(2428),n(2)),v=function(t){t.exports.head={meta:[{hid:"keywords",keywords:"图片裁剪,MikuTools,Ice-Hazymoon,在线工具"},{hid:"description",description:"在线图片裁剪"}],title:"图片裁剪 - MikuTools"},t.options.toolsMeta={name:"图片裁剪",path:"/picture_clipping",head:{meta:[{hid:"keywords",keywords:"图片裁剪,MikuTools,Ice-Hazymoon,在线工具"},{hid:"description",description:"在线图片裁剪"}],title:"图片裁剪 - MikuTools"},show:!0,key:"image"}},component=Object(d.a)(f,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"picture_clipping"},[n("nya-container",{attrs:{title:"图片裁剪"}},[n("div",{staticClass:"nya-subtitle mt-0"},[t._v("\n            请选择要裁剪的图片\n        ")]),n("el-input",{staticClass:"mb-15",attrs:{type:"file",accept:"image/*",placeholder:t.n?t.n.replace(/C:\\fakepath\\/,""):"点击这里上传文件"},nativeOn:{change:function(e){return t.handleChange(e)}},model:{value:t.n,callback:function(e){t.n=e},expression:"n"}}),t.preview?n("div",{staticClass:"box mb-15"},[n("img",{ref:"preview",attrs:{src:t.preview,alt:"preview"}})]):t._e(),t.cropper?n("div",{staticClass:"btn-list"},[n("el-button-group",[n("el-tooltip",{staticClass:"item",attrs:{transition:"el-fade-in",effect:"dark",content:"调整裁剪框",placement:"bottom"}},[n("el-button",{attrs:{size:"medium",type:"crop"===t.mode?"danger":"primary"},on:{click:function(e){return t.setDragMode("crop")}}},[n("i",{staticClass:"eva eva-crop-outline"})])],1),n("el-tooltip",{staticClass:"item",attrs:{transition:"el-fade-in",effect:"dark",content:"移动图片",placement:"bottom"}},[n("el-button",{attrs:{size:"medium",type:"move"===t.mode?"danger":"primary"},on:{click:function(e){return t.setDragMode("move")}}},[n("i",{staticClass:"eva eva-move-outline"})])],1)],1),n("el-button-group",[n("el-tooltip",{staticClass:"item",attrs:{transition:"el-fade-in",effect:"dark",content:"放大图片",placement:"bottom"}},[n("el-button",{attrs:{size:"medium",type:"primary"},on:{click:function(e){return t.cropper.zoom(.1)}}},[n("i",{staticClass:"eva eva-maximize-outline"})])],1),n("el-tooltip",{staticClass:"item",attrs:{transition:"el-fade-in",effect:"dark",content:"缩小图片",placement:"bottom"}},[n("el-button",{attrs:{size:"medium",type:"primary"},on:{click:function(e){return t.cropper.zoom(-.1)}}},[n("i",{staticClass:"eva eva-minimize-outline"})])],1)],1),n("el-button-group",[n("el-tooltip",{staticClass:"item",attrs:{transition:"el-fade-in",effect:"dark",content:"上下翻转",placement:"bottom"}},[n("el-button",{attrs:{size:"medium",type:"primary"},on:{click:function(e){t.cropper.scaleX(-t.cropper.getData().scaleX)}}},[n("i",{staticClass:"eva eva-flip-outline"})])],1),n("el-tooltip",{staticClass:"item",attrs:{transition:"el-fade-in",effect:"dark",content:"水平翻转",placement:"bottom"}},[n("el-button",{attrs:{size:"medium",type:"primary"},on:{click:function(e){t.cropper.scaleY(-t.cropper.getData().scaleY)}}},[n("i",{staticClass:"eva eva-flip-2-outline"})])],1)],1),n("el-button-group",[n("el-tooltip",{staticClass:"item",attrs:{transition:"el-fade-in",effect:"dark",content:"逆时针旋转90°",placement:"bottom"}},[n("el-button",{attrs:{size:"medium",type:"primary"},on:{click:function(e){return t.cropper.rotate(-90)}}},[n("i",{staticClass:"eva eva-corner-up-left-outline"})])],1),n("el-tooltip",{staticClass:"item",attrs:{transition:"el-fade-in",effect:"dark",content:"顺时针旋转90°",placement:"bottom"}},[n("el-button",{attrs:{size:"medium",type:"primary"},on:{click:function(e){return t.cropper.rotate(90)}}},[n("i",{staticClass:"eva eva-corner-up-right-outline"})])],1)],1),n("el-button-group",[n("el-tooltip",{staticClass:"item",attrs:{transition:"el-fade-in",effect:"dark",content:"清除选区",placement:"bottom"}},[n("el-button",{attrs:{size:"medium",type:"primary"},on:{click:function(e){return t.cropper.clear()}}},[n("i",{staticClass:"eva eva-close-outline"})])],1),n("el-tooltip",{staticClass:"item",attrs:{transition:"el-fade-in",effect:"dark",content:"重置",placement:"bottom"}},[n("el-button",{attrs:{size:"medium",type:"primary"},on:{click:function(e){return t.cropper.reset()}}},[n("i",{staticClass:"eva eva-sync-outline"})])],1),n("el-tooltip",{staticClass:"item",attrs:{transition:"el-fade-in",effect:"dark",content:"裁剪",placement:"bottom"}},[n("el-button",{attrs:{size:"medium",type:"primary"},on:{click:t.crop}},[n("i",{staticClass:"eva eva-checkmark-outline"})])],1)],1)],1):t._e()],1)],1)}),[],!1,null,null,null);"function"==typeof v&&v(component);e.default=component.exports},643:function(t,e,n){"use strict";n(8);e.a=function(t){return new Promise((function(e,n){var o=new FileReader;o.readAsDataURL(t),o.onload=function(){return e(o.result)},o.onerror=function(t){return n(t)}}))}},646:function(t,e,n){"use strict";n(8),n(66),n(67);var o=n(144).MD5;e.a=function(){return o(Math.random().toString()).toString()}}}]);