| 1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-06bb52f1"],{2633:function(t,e,r){"use strict";var i=r("2af1"),o=r.n(i);o.a},"2af1":function(t,e,r){},"87a0":function(t,e,r){"use strict";r.r(e);var i=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"cl-upload"},[r("el-input",{attrs:{type:"hidden"},model:{value:t.value,callback:function(e){t.value=e},expression:"value"}}),t._l(t.list,(function(e,i){return r("el-upload",t._b({key:i,attrs:{accept:"image/*",headers:{Authorization:t.token},action:t.action,"show-file-list":!1,"on-success":function(r,i){t.onSuccess(r,i,e)},"on-error":t.onError,"before-upload":function(r){t.beforeUpload(r,e)}}},"el-upload",t.props,!1),[r("div",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"item.loading"}],staticClass:"upload-wrap"},[e.url?r("img",{attrs:{src:e.url,alt:""}}):r("i",{staticClass:"el-icon-plus avatar-uploader-icon"}),e.url?r("i",{staticClass:"el-icon-close",on:{click:function(e){return e.stopPropagation(),t.removeFile(i)}}}):t._e()])])}))],2)},o=[],n=(r("3546"),r("0e8d"),r("fdc1"),r("851c"),r("ea51"),r("f8d0"),r("a94a"),r("639b"),r("4f5b"),r("c887"),r("104d"),r("c866"),r("57dd"),r("b287"),r("9d37")),s=r("5880");function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){Object(n["a"])(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var c={props:{props:{type:Object,default:function(){return{}}},value:[Array,String]},data:function(){var t=this.$service.common.upload();return{action:t.url,list:[]}},computed:l({},Object(s["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 r=[];r=e instanceof Array?e:(e||"").split(","),this.list=r.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){this.props&&this.props["before-upload"]&&this.props["before-upload"](t),e.loading=!0},onSuccess:function(t,e,r){var i=t.code,o=t.data,n=t.message,s=this.props.multiple;1e3==i?(r.loading=!1,s?r.url?r.url=o:this.list.push({url:o}):this.list=[{url:o}],this.callback(),this.props&&this.props["on-success"]&&this.props["on-success"](t,e)):this.onError(n)},onError:function(t,e,r){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,r)},removeFile:function(t){this.list.splice(t,1),this.callback()}}},u=c,p=(r("2633"),r("5511")),f=Object(p["a"])(u,i,o,!1,null,"894cf7ce",null);e["default"]=f.exports}}]);
|