1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-04848c97"],{"89f3":function(e,t,o){},f946:function(e,t,o){"use strict";o("89f3")},fbc2:function(e,t,o){"use strict";o.r(t);var i=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",[o("div",{staticClass:"user-info-head",on:{click:function(t){return e.editCropper()}}},[o("img",{staticClass:"img-circle img-lg",attrs:{src:e.options.img,title:"点击上传头像"}})]),o("el-dialog",{attrs:{title:e.title,visible:e.open,width:"800px","append-to-body":""},on:{"update:visible":function(t){e.open=t},opened:e.modalOpened,close:e.closeDialog}},[o("el-row",[o("el-col",{style:{height:"350px"},attrs:{xs:24,md:12}},[e.visible?o("vue-cropper",{ref:"cropper",attrs:{img:e.options.img,info:!0,autoCrop:e.options.autoCrop,autoCropWidth:e.options.autoCropWidth,autoCropHeight:e.options.autoCropHeight,fixedBox:e.options.fixedBox,outputType:e.options.outputType},on:{realTime:e.realTime}}):e._e()],1),o("el-col",{style:{height:"350px"},attrs:{xs:24,md:12}},[o("div",{staticClass:"avatar-upload-preview"},[o("img",{style:e.previews.img,attrs:{src:e.previews.url}})])])],1),o("br"),o("el-row",[o("el-col",{attrs:{lg:2,sm:3,xs:3}},[o("el-upload",{attrs:{action:"#","http-request":e.requestUpload,"show-file-list":!1,"before-upload":e.beforeUpload}},[o("el-button",{attrs:{size:"small"}},[e._v(" 选择 "),o("i",{staticClass:"el-icon-upload el-icon--right"})])],1)],1),o("el-col",{attrs:{lg:{span:1,offset:2},sm:2,xs:2}},[o("el-button",{attrs:{icon:"el-icon-plus",size:"small"},on:{click:function(t){return e.changeScale(1)}}})],1),o("el-col",{attrs:{lg:{span:1,offset:1},sm:2,xs:2}},[o("el-button",{attrs:{icon:"el-icon-minus",size:"small"},on:{click:function(t){return e.changeScale(-1)}}})],1),o("el-col",{attrs:{lg:{span:1,offset:1},sm:2,xs:2}},[o("el-button",{attrs:{icon:"el-icon-refresh-left",size:"small"},on:{click:function(t){return e.rotateLeft()}}})],1),o("el-col",{attrs:{lg:{span:1,offset:1},sm:2,xs:2}},[o("el-button",{attrs:{icon:"el-icon-refresh-right",size:"small"},on:{click:function(t){return e.rotateRight()}}})],1),o("el-col",{attrs:{lg:{span:2,offset:6},sm:2,xs:2}},[o("el-button",{attrs:{type:"primary",size:"small"},on:{click:function(t){return e.uploadImg()}}},[e._v("提 交")])],1)],1)],1)],1)},s=[],r=o("4360");o("53ca"),o("d3b7"),o("4d63"),o("c607"),o("ac1f"),o("2c3e"),o("00b4"),o("25f0"),o("4d90"),o("5319"),o("159b");var n={components:{VueCropper:VueCropper},props:{user:{type:Object}},data:function(){return{open:!1,visible:!1,title:"修改头像",options:{img:r["a"].getters.avatar,autoCrop:!0,autoCropWidth:200,autoCropHeight:200,fixedBox:!0,outputType:"png"},previews:{},resizeHandler:null}},methods:{editCropper:function(){this.open=!0},modalOpened:function(){var e=this;this.visible=!0,this.resizeHandler||(this.resizeHandler=(void 0)((function(){e.refresh()}),100)),window.addEventListener("resize",this.resizeHandler)},refresh:function(){this.$refs.cropper.refresh()},requestUpload:function(){},rotateLeft:function(){this.$refs.cropper.rotateLeft()},rotateRight:function(){this.$refs.cropper.rotateRight()},changeScale:function(e){e=e||1,this.$refs.cropper.changeScale(e)},beforeUpload:function(e){var t=this;if(-1==e.type.indexOf("image/"))this.$modal.msgError("文件格式错误,请上传图片类型,如:JPG,PNG后缀的文件。");else{var o=new FileReader;o.readAsDataURL(e),o.onload=function(){t.options.img=o.result}}},uploadImg:function(){var e=this;this.$refs.cropper.getCropBlob((function(t){var o=new FormData;o.append("avatarfile",t),uploadAvatar(o).then((function(t){e.open=!1,e.options.img=Object({NODE_ENV:"production",BASE_URL:"/"}).VUE_APP_BASE_API+t.imgUrl,r["a"].commit("SET_AVATAR",e.options.img),e.$modal.msgSuccess("修改成功"),e.visible=!1}))}))},realTime:function(e){this.previews=e},closeDialog:function(){this.options.img=r["a"].getters.avatar,this.visible=!1,window.removeEventListener("resize",this.resizeHandler)}}},a=n,l=(o("f946"),o("2877")),c=Object(l["a"])(a,i,s,!1,null,"42043afc",null);t["default"]=c.exports}}]);
|