d96d62c.js 2.6 KB

12
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([[63],{705:function(t,e,l){t.exports={}},832:function(t,e,l){"use strict";l(705)},878:function(t,e,l){"use strict";l.r(e);l(64),l(46),l(12),l(33),l(42),l(326),l(327),l(220);var o={name:"EditorSlideUpload",props:{color:{type:String,default:"#1890ff"}},data:function(){return{dialogVisible:!1,listObj:{},fileList:[]}},methods:{checkAllSuccess:function(){var t=this;return Object.keys(this.listObj).every((function(e){return t.listObj[e].hasSuccess}))},handleSubmit:function(){var t=this,e=Object.keys(this.listObj).map((function(e){return t.listObj[e]}));this.checkAllSuccess()?(this.$emit("successCBK",e),this.listObj={},this.fileList=[],this.dialogVisible=!1):this.$message("Please wait for all images to be uploaded successfully. If there is a network problem, please refresh the page and upload again!")},handleSuccess:function(t,e){for(var l=e.uid,o=Object.keys(this.listObj),i=0,n=o.length;i<n;i++)if(this.listObj[o[i]].uid===l)return this.listObj[o[i]].url=t.files.file,void(this.listObj[o[i]].hasSuccess=!0)},handleRemove:function(t){for(var e=t.uid,l=Object.keys(this.listObj),i=0,o=l.length;i<o;i++)if(this.listObj[l[i]].uid===e)return void delete this.listObj[l[i]]},beforeUpload:function(t){var e=this,l=window.URL||window.webkitURL,o=t.uid;return this.listObj[o]={},new Promise((function(n,c){var img=new Image;img.src=l.createObjectURL(t),img.onload=function(){e.listObj[o]={hasSuccess:!1,uid:t.uid,width:this.width,height:this.height}},n(!0)}))}}},n=(l(832),l(22)),component=Object(n.a)(o,(function(){var t=this,e=t._self._c;return e("div",{staticClass:"upload-container"},[e("el-button",{style:{background:t.color,borderColor:t.color},attrs:{icon:"el-icon-upload",size:"mini",type:"primary"},on:{click:function(e){t.dialogVisible=!0}}},[t._v("\n upload\n ")]),t._v(" "),e("el-dialog",{attrs:{"lock-scroll":!1,visible:t.dialogVisible},on:{"update:visible":function(e){t.dialogVisible=e}}},[e("el-upload",{staticClass:"editor-slide-upload",attrs:{multiple:!0,"file-list":t.fileList,"show-file-list":!0,"on-remove":t.handleRemove,"on-success":t.handleSuccess,"before-upload":t.beforeUpload,action:"https://httpbin.org/post","list-type":"picture-card"}},[e("el-button",{attrs:{size:"small",type:"primary"}},[t._v("\n Click upload\n ")])],1),t._v(" "),e("el-button",{on:{click:function(e){t.dialogVisible=!1}}},[t._v("\n Cancel\n ")]),t._v(" "),e("el-button",{attrs:{type:"primary"},on:{click:t.handleSubmit}},[t._v("\n Confirm\n ")])],1)],1)}),[],!1,null,"481a2804",null);e.default=component.exports}}]);
  2. //# sourceMappingURL=d96d62c.js.map