(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-641b9508"],{"41bf":function(t,e,i){"use strict";i("be8b")},b1ca:function(t,e,i){"use strict";i.r(e);var a=function(){var t=this,e=t._self._c;return e("div",{staticClass:"d2p-cropper-uploader",class:{"is-disabled":t.disabled}},[e("div",{staticClass:"image-list"},[t._l(t.list,(function(a,s){return e("div",{key:s,staticClass:"image-item"},[e("el-image",{staticClass:"image",attrs:{src:a.dataUrl?a.dataUrl:a.url,"data-src":a.url,"preview-src-list":t._urlList,fit:"contain"}},[e("div",{staticClass:"image-slot",attrs:{slot:"placeholder"},slot:"placeholder"},[e("img",{attrs:{src:i("3849")}})])]),t.disabled?t._e():e("div",{staticClass:"delete"},[e("i",{staticClass:"el-icon-delete",on:{click:function(e){return t.removeImage(s,a)}}})]),"uploading"===a.status?e("div",{staticClass:"status-uploading"},[e("el-progress",{attrs:{type:"circle",percentage:a.progress,width:70}})],1):"done"===a.status?e("div",{staticClass:"status-done"},[e("i",{staticClass:"el-icon-upload-success el-icon-check"})]):t._e()],1)})),t.limit<=0||t.limit>t.list.length?e("div",{staticClass:"image-item image-plus",on:{click:t.addNewImage}},[e("i",{staticClass:"el-icon-plus cropper-uploader-icon"})]):t._e()],2),e("d2p-cropper",{ref:"cropper",attrs:{title:t.title,cropperHeight:t.cropperHeight,dialogWidth:t.dialogWidth,accept:t.accept,uploadTip:t.uploadTip,maxSize:t.maxSize,cropper:t.cropper,output:"all"},on:{done:t.cropComplete}})],1)},s=[],r=i("c7eb"),l=i("1da1"),n=i("b85c"),u=i("53ca"),o=(i("14d9"),i("a434"),i("b0c0"),i("a9e3"),i("c80b")),c=i("0e05"),p=i("0e00"),d=i("1d2a"),f={name:"d2p-cropper-uploader",mixins:[p["a"].inputBase],components:{D2pCropper:o["default"]},props:{value:{type:[String,Array]},type:{type:String},uploadTip:{type:String},title:String,cropperHeight:{type:[String,Number]},dialogWidth:{type:[String,Number],default:"50%"},maxSize:{type:Number,default:5},limit:{type:Number,default:1},accept:{type:String,default:".jpg, .jpeg, .png, .gif, .webp"},cropper:{type:Object},uploader:{type:Object},buildUrl:{type:Function,default:function(t,e){return"object"===Object(u["a"])(t)?e.url:t}}},data:function(){return{index:void 0,list:[]}},watch:{value:function(t){this.$emit("change",t),t!==this.emitValue&&this.initValue(t)}},created:function(){this.emitValue=this.value,this.initValue(this.value)},computed:{_urlList:function(){var t=[];if(this.list){var e,i=Object(n["a"])(this.list);try{for(i.s();!(e=i.n()).done;){var a=e.value;t.push(a.url)}}catch(s){i.e(s)}finally{i.f()}}return t}},methods:{initValue:function(t){var e=[];if(null!=t&&""!==t){if("string"===typeof t)e.push({url:this.buildUrl(t),value:t,status:"done"});else{var i,a=Object(n["a"])(t);try{for(a.s();!(i=a.n()).done;){var s=i.value;e.push({url:this.buildUrl(s),value:s,status:"done"})}}catch(r){a.e(r)}finally{a.f()}}this.$set(this,"list",e)}else this.$set(this,"list",e)},addNewImage:function(){this.disabled||(this.index=void 0,this.$refs.cropper.clear(),this.$refs.cropper.open())},removeImage:function(t,e){this.list.splice(t,1),this.emit()},isHasUploadingItem:function(){var t=this.list;if(t&&t.length>0){var e,i=Object(n["a"])(t);try{for(i.s();!(e=i.n()).done;){var a=e.value;if("uploading"===a.status)return!0}}catch(s){i.e(s)}finally{i.f()}}return!1},cropComplete:function(t){var e=this;return Object(l["a"])(Object(r["a"])().mark((function i(){var a,s,l,n,u,o,c,p;return Object(r["a"])().wrap((function(i){while(1)switch(i.prev=i.next){case 0:return a=t.blob,s=t.dataUrl,l=t.file,n={url:void 0,dataUrl:s,status:"uploading",progress:0},u=function(t){n.progress=t.percent},o=function(t){n.status="error",n.message="文件上传出错:"+t.message,d["a"].debug(t)},d["a"].debug("blob:",a),c={file:a,fileName:l.name,onProgress:u,onError:o},e.list.push(n),i.next=11,e.doUpload(c);case 11:p=i.sent,n.url=e.buildUrl(p.url),n.value=p.url,n.status="done",e.emit();case 16:case"end":return i.stop()}}),i)})))()},doUpload:function(t){var e=this;return t.config=this.uploader,this.getUploader().then((function(i){return i.upload(t).then((function(t){return null!=e.suffix&&(t.url+=e.suffix),t}))}))},getUploader:function(){var t=this.type;return null!=this.uploader&&null!=this.uploader.type&&(t=this.uploader.type),c["a"].getUploader(t)},emit:function(){var t,e=[],i=Object(n["a"])(this.list);try{for(i.s();!(t=i.n()).done;){var a=t.value;if(null!=a.status&&"done"!==a.status)return;"string"===typeof a?e.push(a):e.push(a.value)}}catch(r){i.e(r)}finally{i.f()}var s=e;1===this.limit&&(s=e&&e.length>0?e[0]:void 0),this.emitValue=s,this.$emit("input",s)}}},h=f,g=(i("41bf"),i("2877")),m=Object(g["a"])(h,a,s,!1,null,null,null);e["default"]=m.exports},be8b:function(t,e,i){}}]);