index-legacy.2d97be40.js 11 KB

1
  1. !function(){function e(e,t,a,n,o,l,r){try{var i=e[l](r),u=i.value}catch(s){return void a(s)}i.done?t(u):Promise.resolve(u).then(n,o)}function t(t){return function(){var a=this,n=arguments;return new Promise((function(o,l){var r=t.apply(a,n);function i(t){e(r,o,l,i,u,"next",t)}function u(t){e(r,o,l,i,u,"throw",t)}i(void 0)}))}}function a(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return n(e,t);var a=Object.prototype.toString.call(e).slice(8,-1);"Object"===a&&e.constructor&&(a=e.constructor.name);if("Map"===a||"Set"===a)return Array.from(e);if("Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return n(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,n=new Array(t);a<t;a++)n[a]=e[a];return n}var o=document.createElement("style");o.innerHTML="._uploader-section_tym2a_1{display:flex;align-items:center;flex-wrap:wrap;box-sizing:border-box;position:relative}._uploader-section_tym2a_1 ._img-close_tym2a_8{position:absolute;top:.13333rem;right:.32rem;z-index:99;font-size:.34667rem;background-color:rgba(0,0,0,.2);color:#fff;font-weight:700;width:.48rem;height:.48rem;display:flex;justify-content:center;align-items:center;border-radius:50%}._uploader-section_tym2a_1 ._singleImgClose_tym2a_24{right:.13333rem}._uploader-section_tym2a_1 ._uploader_tym2a_1{position:relative}._uploader-section_tym2a_1 ._uploader_tym2a_1._default_tym2a_30 .van-uploader__upload{width:2.61333rem;height:2.50667rem;background-color:#fff}._uploader-section_tym2a_1 ._uploader_tym2a_1._default_tym2a_30 ._previewImg_tym2a_35,._uploader-section_tym2a_1 ._uploader_tym2a_1._default_tym2a_30 ._uploadImg_tym2a_41{width:2.61333rem;height:2.50667rem;border-radius:.26667rem;overflow:hidden}._uploader-section_tym2a_1 ._uploader_tym2a_1 .van-uploader__upload-icon,._uploader-section_tym2a_1 ._uploader_tym2a_1 .van-icon__image{width:100%;height:100%}\n",document.head.appendChild(o),System.register(["./index-legacy.90c82f08.js","./oss-file-upload-legacy.be0f8098.js","./index-legacy.eb4bc59e.js"],(function(e){"use strict";var n,o,l,r,i,u,s,c,d,p,m,f,g,h;return{setters:[function(e){n=e.d,o=e.e,l=e.o,r=e.bf,i=e.bq,u=e.bA,s=e.b4,c=e.c,d=e.a5,p=e.F},function(e){m=e.g,f=e.o,g=e.U},function(e){h=e.I}],execute:function(){var b={"uploader-section":"_uploader-section_tym2a_1","img-close":"_img-close_tym2a_8",singleImgClose:"_singleImgClose_tym2a_24",uploader:"_uploader_tym2a_1",default:"_default_tym2a_30",previewImg:"_previewImg_tym2a_35",uploadImg:"_uploadImg_tym2a_41"};e("O",n({name:"col-upload",props:{modelValue:{type:Array,default:function(){return[]}},deletable:{type:Boolean,default:!0},maxCount:{type:Number,default:1},native:{type:Boolean,default:!1},uploadSize:{type:Number,default:5},uploadType:{type:String,default:"IMAGE"},accept:{type:String,default:"image/*"},onUploadChange:{type:Function,default:function(e){}},bucket:{type:String,default:"gyt"},path:{type:String,default:""},uploadIcon:{type:String,default:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMwAAAC8CAMAAAAD3rEBAAABWVBMVEUAAADZ2dna2tra2trZ2dna2trZ2dnb29va2trZ2dnc3Nz5+fn5+fn4+Pj4+Pj5+fnb29v////Z2dn29vbi4uLa2trj4+Pq6ur4+Pjg4OD4+PjZ2dk9PT13d3ff39/29vbj4+Px8fHc3Nzu7u6CgoLs7OzX19fq6url5eW8vLypqan09PTPz8+vr6/w8PDLy8u9vb2ZmZn/o3zHx8eJiYnAwMD/pn98fHz/kGiOjo7/qoJ5eXn/jWWLi4v/oHj/iWGjo6P/mXFGRkbz8/NRUVFBQUHY2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nMGKbKMW92jwTT4CZlnKEjJpO7Zj395hXVDudNlWOWwM5kI8QanR0xInKNucjw02PXIz8v6OOdVI6x3BVgwNcpt0OPyJSb/y08ORckWQbMZ2Mqf9LsmWcHhGZJL2Oktx2wapSnUijmLPotF+5x2jCBRqmt+Pl0TNX3mT0eGhQxOS0EFm2SEvRJWEUzMSeRIxfkkMkNXaS/LmZoP+TexZA14rApNTO4rBrIf8OGm515ppweVRdTqWDaowvdgZPFfAaUMkddMRvBiQR9LouHdMWeMlViKlHH1DGqqmNUVcf8ae/eVhsEoigML8+nNIe2aWEv0IwlKAg+je//LI2lND3Sy+wZ9nc5V/6owwwKo5V909TLYrSyGJ3s71mtLEYri9HKYrSyGK0sRivbaeplMVpZjE6h7TQjhnGgtnSMkHCSIExMcAzhQP2V4z0yBvLSnJmFc3D7yAIlewlCzxJIOUsAZqYAcgaxbj4xB1BFIcxnjlGFi5iLeO+lj7GqkwDujDzUeLOTAOzwbive2+JDI+LxctNN0uDq0HTtIJ4a2DYHfPZELl7OA24hY3yzT8hl9uxh6+YTmezxQx1HZD+enS9Bbhh7Mopr/KbKU16Mshp5NagcaUmmeYU/lUV2fN7c/kL/H9ncPWZFiS9eAXzYxwpg8+k+AAAAAElFTkSuQmCC"},size:{type:String,default:"default"},disabled:{type:Boolean,default:!1}},methods:{nativeUpload:function(){var e=this;if(!this.disabled){var t="VIDEO"===this.uploadType?"video":"img";o({api:"chooseFile",content:{type:t,max:1,bucket:this.bucket,path:this.path}},(function(t){console.log(t,"fileUrl"),e.maxCount>1?(e.$emit("update:modelValue",[].concat(a(e.modelValue),[t.fileUrl])),e.onUploadChange([].concat(a(e.modelValue),[t.fileUrl]))):(e.$emit("update:modelValue",[t.fileUrl]),e.onUploadChange([t.fileUrl]))}))}},beforeRead:function(e){return console.log(e,"beforeRead"),!!(e.size/1024/1024<this.uploadSize)||(l("上传文件大小不能超过 ".concat(this.uploadSize,"MB")),!1)},beforeDelete:function(e,t){return!0},afterRead:function(e,a){var n=this;return t(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e.status="uploading",e.message="上传中...",t.next=5,n.uploadFile(e.file);case 5:t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),r();case 10:case"end":return t.stop()}}),t,null,[[0,7]])})))()},onClose:function(e,t){var a=this.modelValue,n=a.findIndex((function(e){return e==t}));n>-1&&(a.splice(n,1),this.$emit("update:modelValue",a),this.onUploadChange()),e.stopPropagation()},getFile:function(e){var a=this;return t(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,a.uploadFile(e);case 3:t.next=7;break;case 5:t.prev=5,t.t0=t.catch(0);case 7:case"end":return t.stop()}}),t,null,[[0,5]])})))()},uploadFile:function(e){var n=this;return t(regeneratorRuntime.mark((function t(){var o,l,s,c,d,p,g;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,o=e.name||"",l=n.path?n.path+"/"+(o&&o.replace(/ /gi,"_")):o&&o.replace(/ /gi,"_"),s=(new Date).getTime()+l,t.next=6,m({filename:s,bucketName:n.bucket,postData:{filename:s,acl:"public-read",key:s,unknowValueField:[]}});case 6:return c=t.sent,d=c.data,i({message:"加载中...",forbidClick:!0,loadingType:"spinner",duration:0}),p={policy:d.policy,signature:d.signature,key:s,KSSAccessKeyId:d.kssAccessKeyId,acl:"public-read",name:s,file:e},t.next=12,f(u(n.bucket),p);case 12:g=t.sent,console.log(g,"uploadUrl"),r(),n.maxCount>1?(n.$emit("update:modelValue",[].concat(a(n.modelValue),[g])),n.onUploadChange([].concat(a(n.modelValue),[g]))):(n.$emit("update:modelValue",[g]),n.onUploadChange([g])),t.next=22;break;case 18:t.prev=18,t.t0=t.catch(0),console.log(t.t0,"uploadFile"),r();case 22:case"end":return t.stop()}}),t,null,[[0,18]])})))()}},render:function(){var e=this;return s((function(){return e.modelValue})),c("div",{class:b["uploader-section"]},[this.modelValue.length>0&&this.maxCount>1&&this.modelValue.map((function(t){return c("div",{class:[b.uploader,b[e.size]]},[e.deletable&&!e.disabled&&c(d,{name:"cross",onClick:function(a){return e.onClose(a,t)},class:b["img-close"]},null),c("div",{class:["van-uploader__upload"]},["IMAGE"===e.uploadType?c(h,{src:t,class:b.previewImg,fit:"cover"},null):c("video",{ref:"videoUpload",style:{backgroundColor:"#F8F8F8"},class:b.previewImg,src:t+"#t=1,4"},null)])])})),this.native?this.maxCount>1?c("div",{class:[b.uploader,b[this.size]],onClick:this.nativeUpload},[c(d,{name:this.uploadIcon,class:["van-uploader__upload"],size:"32"},null)]):c("div",{class:[b.uploader,b[this.size]],onClick:this.nativeUpload},[this.modelValue.length>0?c("div",{class:["van-uploader__upload"]},[this.modelValue.map((function(t){return c(p,null,[e.deletable&&!e.disabled&&c(d,{name:"cross",onClick:function(a){return e.onClose(a,t)},class:[b["img-close"],b.singleImgClose]},null),"IMAGE"===e.uploadType?c(h,{fit:"cover",position:"center",class:b.uploadImg,src:t},null):c("video",{ref:"videoUpload",class:b.uploadImg,style:{backgroundColor:"#F8F8F8"},src:t+"#t=1,4"},null)])}))]):c(d,{name:this.uploadIcon,class:["van-uploader__upload"],size:"32"},null)]):this.maxCount>1?c(g,{class:[b.uploader,b[this.size]],afterRead:this.afterRead,beforeRead:this.beforeRead,beforeDelete:this.beforeDelete,uploadIcon:this.uploadIcon,disabled:this.modelValue.length===this.maxCount||this.disabled,accept:this.accept},null):c(g,{class:[b.uploader,b[this.size]],afterRead:this.afterRead,beforeRead:this.beforeRead,beforeDelete:this.beforeDelete,uploadIcon:this.uploadIcon,accept:this.accept,disabled:this.disabled},{default:function(){return[e.modelValue.length>0?c("div",{class:["van-uploader__upload"]},[e.modelValue.map((function(t){return c(p,null,[e.deletable&&!e.disabled&&c(d,{name:"cross",onClick:function(a){return e.onClose(a,t)},class:[b["img-close"],b.singleImgClose]},null),"IMAGE"===e.uploadType?c(h,{fit:"cover",position:"center",class:b.uploadImg,src:t},null):c("video",{ref:"videoUpload",class:b.uploadImg,style:{backgroundColor:"#F8F8F8"},src:t+"#t=1,4"},null)])}))]):c(d,{name:e.uploadIcon,class:["van-uploader__upload"],size:"32"},null)]}})])}}))}}}))}();