(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-01623864"],{1930:function(t,e,i){},"87a0":function(t,e,i){"use strict";i.r(e);var o=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"cl-upload"},[i("el-input",{attrs:{type:"hidden"},model:{value:t.value,callback:function(e){t.value=e},expression:"value"}}),t._l(t.list,(function(e,o){return i("el-upload",t._b({key:o,attrs:{accept:"image/*",headers:{token:t.token},name:"content","on-change":t.getFile,"auto-upload":!1,action:t.action,"show-file-list":!1,"on-error":t.onError,"before-upload":function(i){t.beforeUpload(i,e,o)}}},"el-upload",t.props,!1),[t._t("content",[i("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"item.loading"}],staticClass:"upload-wrap"},[e.url?i("img",{attrs:{src:e.url,alt:""}}):i("i",{staticClass:"el-icon-plus avatar-uploader-icon"}),e.url?i("i",{staticClass:"el-icon-close",on:{click:function(e){return e.stopPropagation(),t.removeFile(o)}}}):t._e()])])],2)}))],2)},n=[],s=(i("86dd"),i("e90c"),i("1a8c"),i("c1b0"),i("3a20"),i("b3f9"),i("7267"),i("3e5e"),i("b54b")),r=i("5880"),l={props:{props:{type:Object,default:function(){return{}}},value:[Array,String]},data:function(){var t=this.$service.common.upload();return{action:t.url,list:[],index:0}},computed:Object(s["a"])({},Object(r["mapGetters"])(["token"])),watch:{value:function(){this.render()}},mounted:function(){this.render()},methods:{render:function(){var t=this.props.multiple,e=this.value;if(t){var i=[];i=e instanceof Array?e:(e||"").split(","),this.list=i.filter(Boolean).map((function(t){return{url:t,loading:!1}})),this.ajSize()}else this.list=[{url:e,loading:!1}]},callback:function(){this.ajSize(),this.$emit("input",this.list.filter((function(t){return t.url})).map((function(t){return t.url})).join(","))},ajSize:function(){var t=this.props["multiple-limit"],e=void 0===t?1:t;this.list.length<e&&this.list.unshift({})},beforeUpload:function(t,e,i){this.index=i,this.props&&this.props["before-upload"]&&this.props["before-upload"](t),e.loading=!0},onSuccess:function(t,e){var i=this.list[this.index],o=(t.url,t.smallUrl),n=(t.shortUrl,this.props.multiple);i.loading=!1,n?(i.url?i.url=o:this.list.push({url:o}),console.log("sadfas",this.list)):this.list=[{url:o}],this.callback(),console.log("this.props",this.props),this.props&&this.props["on-success"]&&this.props["on-success"](t,e)},onError:function(t,e,i){console.error("upload error",t),this.$message.error(t.toString()),this.loading=!1,this.props&&this.props["on-error"]&&this.props["on-error"](t,e,i)},removeFile:function(t){this.list.splice(t,1),this.callback()},getFile:function(t,e){var i=this;this.getBase64(t.raw).then((function(t){i.$service.common.uploadImg({content:t}).then((function(t){console.log("subRes",t),i.onSuccess(t)}))}))},getBase64:function(t){return new Promise((function(e,i){var o=new FileReader,n="";o.readAsDataURL(t),o.onload=function(){n=o.result},o.onerror=function(t){i(t)},o.onloadend=function(){e(n)}}))}}},a=l,c=(i("97ec"),i("623f")),u=Object(c["a"])(a,o,n,!1,null,"432608ec",null);e["default"]=u.exports},"97ec":function(t,e,i){"use strict";var o=i("1930"),n=i.n(o);n.a}}]);