1 |
- !function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t=function(){return o};var o={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,o){e[t]=o.value},i="function"==typeof Symbol?Symbol:{},l=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(e,t,o){return Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(P){c=function(e,t,o){return e[t]=o}}function d(e,t,o,n){var r=t&&t.prototype instanceof v?t:v,i=Object.create(r.prototype),l=new I(n||[]);return a(i,"_invoke",{value:A(e,o,l)}),i}function f(e,t,o){try{return{type:"normal",arg:e.call(t,o)}}catch(P){return{type:"throw",arg:P}}}o.wrap=d;var p={};function v(){}function m(){}function h(){}var g={};c(g,l,(function(){return this}));var y=Object.getPrototypeOf,b=y&&y(y(z([])));b&&b!==n&&r.call(b,l)&&(g=b);var w=h.prototype=v.prototype=Object.create(g);function x(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function _(t,o){function n(a,i,l,u){var s=f(t[a],t,i);if("throw"!==s.type){var c=s.arg,d=c.value;return d&&"object"==e(d)&&r.call(d,"__await")?o.resolve(d.__await).then((function(e){n("next",e,l,u)}),(function(e){n("throw",e,l,u)})):o.resolve(d).then((function(e){c.value=e,l(c)}),(function(e){return n("throw",e,l,u)}))}u(s.arg)}var i;a(this,"_invoke",{value:function(e,t){function r(){return new o((function(o,r){n(e,t,o,r)}))}return i=i?i.then(r,r):r()}})}function A(e,t,o){var n="suspendedStart";return function(r,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===r)throw a;return F()}for(o.method=r,o.arg=a;;){var i=o.delegate;if(i){var l=C(i,o);if(l){if(l===p)continue;return l}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===n)throw n="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);n="executing";var u=f(e,t,o);if("normal"===u.type){if(n=o.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:o.done}}"throw"===u.type&&(n="completed",o.method="throw",o.arg=u.arg)}}}function C(e,t){var o=t.method,n=e.iterator[o];if(void 0===n)return t.delegate=null,"throw"===o&&e.iterator.return&&(t.method="return",t.arg=void 0,C(e,t),"throw"===t.method)||"return"!==o&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+o+"' method")),p;var r=f(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,p;var a=r.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function z(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,n=function t(){for(;++o<e.length;)if(r.call(e,o))return t.value=e[o],t.done=!1,t;return t.value=void 0,t.done=!0,t};return n.next=n}}return{next:F}}function F(){return{value:void 0,done:!0}}return m.prototype=h,a(w,"constructor",{value:h,configurable:!0}),a(h,"constructor",{value:m,configurable:!0}),m.displayName=c(h,s,"GeneratorFunction"),o.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},o.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,c(e,s,"GeneratorFunction")),e.prototype=Object.create(w),e},o.awrap=function(e){return{__await:e}},x(_.prototype),c(_.prototype,u,(function(){return this})),o.AsyncIterator=_,o.async=function(e,t,n,r,a){void 0===a&&(a=Promise);var i=new _(d(e,t,n,r),a);return o.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(w),c(w,s,"Generator"),c(w,l,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),o.keys=function(e){var t=Object(e),o=[];for(var n in t)o.push(n);return o.reverse(),function e(){for(;o.length;){var n=o.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},o.values=z,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function o(o,n){return i.type="throw",i.arg=e,t.next=o,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n],i=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(l&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var o=this.tryEntries.length-1;o>=0;--o){var n=this.tryEntries[o];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var o=this.tryEntries[t];if(o.finallyLoc===e)return this.complete(o.completion,o.afterLoc),k(o),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var o=this.tryEntries[t];if(o.tryLoc===e){var n=o.completion;if("throw"===n.type){var r=n.arg;k(o)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,o){return this.delegate={iterator:z(e),resultName:t,nextLoc:o},"next"===this.method&&(this.arg=void 0),p}},o}function o(e,t,o,n,r,a,i){try{var l=e[a](i),u=l.value}catch(s){return void o(s)}l.done?t(u):Promise.resolve(u).then(n,r)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var i=e.apply(t,n);function l(e){o(i,r,a,l,u,"next",e)}function u(e){o(i,r,a,l,u,"throw",e)}l(void 0)}))}}function r(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||i(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 a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var n,r,a,i,l=[],u=!0,s=!1;try{if(a=(o=o.call(e)).next,0===t){if(Object(o)!==o)return;u=!1}else for(;!(u=(n=a.call(o)).done)&&(l.push(n.value),l.length!==t);u=!0);}catch(c){s=!0,r=c}finally{try{if(!u&&null!=o.return&&(i=o.return(),Object(i)!==i))return}finally{if(s)throw r}}return l}}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){if(e){if("string"==typeof e)return l(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}System.register(["./index-legacy-49fe136a.js","./index-legacy-649765eb.js","./index-legacy-65fcef15.js"],(function(e,o){"use strict";var i,l,u,s,c,d,f,p,v,m,h,g,y,b,w,x,_,A,C,S,k,I,z,F,P,E,L,V,j,O,q,M,T,Y,U,N,R,H,D,B,X,Z,W,G,J,K,Q,$,ee,te,oe,ne,re,ae,ie,le,ue,se=document.createElement("style");return se.textContent="._uploader-section_qlgeb_1{display:flex;align-items:center;flex-wrap:wrap;box-sizing:border-box;position:relative;--upload-file-size: 1.97333rem}._uploader-section_qlgeb_1 ._img-close_qlgeb_9{position:absolute;top:.13333rem;right:.32rem;z-index:99;font-size:.26667rem;background-color:rgba(0,0,0,.4);color:#fff;font-weight:700;width:.42667rem;height:.42667rem;display:flex;justify-content:center;align-items:center;border-radius:50%}._uploader-section_qlgeb_1 ._singleImgClose_qlgeb_25{right:.13333rem}._uploader-section_qlgeb_1 ._uploader_qlgeb_1{position:relative}._uploader-section_qlgeb_1 ._uploader_qlgeb_1._default_qlgeb_31 .van-uploader__upload{width:var(--upload-file-size);height:var(--upload-file-size);background-color:#fff}._uploader-section_qlgeb_1 ._uploader_qlgeb_1._default_qlgeb_31 ._previewImg_qlgeb_36,._uploader-section_qlgeb_1 ._uploader_qlgeb_1._default_qlgeb_31 ._uploadImg_qlgeb_42{width:var(--upload-file-size);height:var(--upload-file-size);border-radius:.10667rem;overflow:hidden}._uploader-section_qlgeb_1 ._uploader_qlgeb_1 .van-uploader__upload-icon,._uploader-section_qlgeb_1 ._uploader_qlgeb_1 .van-icon__image{width:100%;height:100%}\n",document.head.appendChild(se),{setters:[function(e){i=e.j,l=e.d,u=e.ac,s=e.t,c=e.N,d=e.ad,f=e.i,p=e.E,v=e.w,m=e.ae,h=e.g,g=e.af,y=e.ag,b=e.Z,w=e.ah,x=e.v,_=e.q,A=e.ai,C=e.x,S=e.n,k=e.aj,I=e.o,z=e.ak,F=e.al,P=e.y,E=e.m,L=e.p,V=e.P,j=e.W,O=e.am,q=e.I,M=e.an,T=e.z,Y=e.A,U=e.ao,N=e.ap,R=e.D,H=e.aq,D=e.ar,B=e.as,X=e.at,Z=e.l,W=e.a7,G=e.au,J=e.av,K=e.aw,Q=e.L,$=e.f,ee=e.a9,te=e.a,oe=e._,ne=e.aa,re=e.ab,ae=e.F},function(e){ie=e.c,le=e.b},function(e){ue=e.I}],execute:function(){var o,se=function(e){return Math.sqrt(Math.pow(e[0].clientX-e[1].clientX,2)+Math.pow(e[0].clientY-e[1].clientY,2))},ce=i("image-preview")[1],de=l({props:{src:String,show:Boolean,active:Number,minZoom:u(s),maxZoom:u(s),rootWidth:u(Number),rootHeight:u(Number),disableZoom:Boolean},emits:["scale","close","longPress"],setup:function(e,t){var o,n,r,a,i,l,u,s=t.emit,x=t.slots,_=c({scale:1,moveX:0,moveY:0,moving:!1,zooming:!1,imageRatio:0,displayWidth:0,displayHeight:0}),A=d(),C=f(),S=p((function(){var t=e.rootWidth,o=e.rootHeight/t;return _.imageRatio>o})),k=p((function(){var e=_.scale,t=_.moveX,o=_.moveY,n=_.moving,r={transitionDuration:_.zooming||n?"0s":".3s"};if(1!==e){var a=t/e,i=o/e;r.transform="scale(".concat(e,", ").concat(e,") translate(").concat(a,"px, ").concat(i,"px)")}return r})),I=p((function(){if(_.imageRatio){var t=e.rootWidth,o=e.rootHeight,n=S.value?o/_.imageRatio:t;return Math.max(0,(_.scale*n-t)/2)}return 0})),z=p((function(){if(_.imageRatio){var t=e.rootWidth,o=e.rootHeight,n=S.value?o:t*_.imageRatio;return Math.max(0,(_.scale*n-o)/2)}return 0})),F=function(t){(t=y(t,+e.minZoom,+e.maxZoom+1))!==_.scale&&(_.scale=t,s("scale",{scale:t,index:e.active}))},P=function(){F(1),_.moveX=0,_.moveY=0},E=!1,L=function(t){var l=t.touches;if(2!==(o=l.length)||!e.disableZoom){var s=A.offsetX;A.start(t),n=_.moveX,r=_.moveY,u=Date.now(),E=!1,_.moving=1===o&&1!==_.scale,_.zooming=2===o&&!s.value,_.zooming&&(a=_.scale,i=se(t.touches))}},V=function(){if(!(o>1)){var e,t=A.offsetX,n=A.offsetY,r=Date.now()-u;t.value<5&&n.value<5&&(r<250?l?(clearTimeout(l),l=null,e=_.scale>1?1:2,F(e),_.moveX=0,_.moveY=0):l=setTimeout((function(){s("close"),l=null}),250):r>w&&s("longPress"))}},j=function(t){var o=!1;if((_.moving||_.zooming)&&(o=!0,_.moving&&n===_.moveX&&r===_.moveY&&(o=!1),!t.touches.length)){_.zooming&&(_.moveX=y(_.moveX,-I.value,I.value),_.moveY=y(_.moveY,-z.value,z.value),_.zooming=!1),_.moving=!1,n=0,r=0,a=1,_.scale<1&&P();var i=+e.maxZoom;_.scale>i&&(_.scale=i)}g(t,o),V(),A.reset()},O=function(e){var t=e.target,o=t.naturalWidth,n=t.naturalHeight;_.imageRatio=n/o};return v((function(){return e.active}),P),v((function(){return e.show}),(function(e){e||P()})),m("touchmove",(function(e){var t=e.touches;if(A.move(e),_.moving){var o=A.deltaX,l=A.deltaY,u=o.value+n,s=l.value+r;if((u>I.value||u<-I.value)&&!E&&A.isHorizontal())return void(_.moving=!1);E=!0,g(e,!0),_.moveX=y(u,-I.value,I.value),_.moveY=y(s,-z.value,z.value)}if(_.zooming&&(g(e,!0),2===t.length)){var c=se(t);F(a*c/i)}}),{target:p((function(){var e;return null==(e=C.value)?void 0:e.$el}))}),function(){var t={loading:function(){return h(b,{type:"spinner"},null)}};return h(ie,{ref:C,class:ce("swipe-item"),onTouchstartPassive:L,onTouchend:j,onTouchcancel:j},{default:function(){return[x.image?h("div",{class:ce("image-wrap")},[x.image({src:e.src})]):h(ue,{src:e.src,fit:"contain",class:ce("image",{vertical:S.value}),style:k.value,onLoad:O},t)]}})}}}),fe=a(i("image-preview"),2),pe=fe[0],ve=fe[1],me=["show","teleport","transition","overlayStyle","closeOnPopstate"],he={show:Boolean,loop:x,images:_(),minZoom:A(1/3),maxZoom:A(3),overlay:x,closeable:Boolean,showIndex:x,className:C,closeIcon:S("clear"),transition:String,beforeClose:Function,overlayClass:C,overlayStyle:Object,swipeDuration:A(300),startPosition:A(0),showIndicators:Boolean,closeOnPopstate:x,closeIconPosition:S("top-right"),teleport:[String,Object]},ge=l({name:pe,props:he,emits:["scale","close","closed","change","longPress","update:show"],setup:function(e,t){var o=t.emit,n=t.slots,r=f(),a=c({active:0,rootWidth:0,rootHeight:0,disableZoom:!1}),i=function(){if(r.value){var e=j(r.value.$el);a.rootWidth=e.width,a.rootHeight=e.height,r.value.resize()}},l=function(e){return o("scale",e)},u=function(e){return o("update:show",e)},s=function(){M(e.beforeClose,{args:[a.active],done:function(){return u(!1)}})},d=function(e){e!==a.active&&(a.active=e,o("change",e))},p=function(){if(e.showIndex)return h("div",{class:ve("index")},[n.index?n.index({index:a.active}):"".concat(a.active+1," / ").concat(e.images.length)])},m=function(){if(n.cover)return h("div",{class:ve("cover")},[n.cover()])},g=function(){a.disableZoom=!0},y=function(){a.disableZoom=!1},b=function(){if(e.closeable)return h(q,{role:"button",name:e.closeIcon,class:[ve("close-icon",e.closeIconPosition),O],onClick:s},null)},w=function(){return o("closed")},x=function(e,t){var o;return null==(o=r.value)?void 0:o.swipeTo(e,t)};return k({swipeTo:x}),I(i),v([z,F],i),v((function(){return e.startPosition}),(function(e){return d(+e)})),v((function(){return e.show}),(function(t){var n=e.images,r=e.startPosition;t?(d(+r),P((function(){i(),x(+r,{immediate:!0})}))):o("close",{index:a.active,url:n[a.active]})})),function(){return h(V,E({class:[ve(),e.className],overlayClass:[ve("overlay"),e.overlayClass],onClosed:w,"onUpdate:show":u},L(e,me)),{default:function(){return[b(),h(le,{ref:r,lazyRender:!0,loop:e.loop,class:ve("swipe"),duration:e.swipeDuration,initialSwipe:e.startPosition,showIndicators:e.showIndicators,indicatorColor:"white",onChange:d,onDragEnd:y,onDragStart:g},{default:function(){return[e.images.map((function(t,r){return h(de,{src:t,show:e.show,active:a.active,maxZoom:e.maxZoom,minZoom:e.minZoom,rootWidth:a.rootWidth,rootHeight:a.rootHeight,disableZoom:a.disableZoom,onScale:l,onClose:s,onLongPress:function(){return o("longPress",{index:r})}},{image:n.image})}))]}}),p(),m()]}})}}}),ye={loop:!0,images:[],maxZoom:3,minZoom:1/3,onScale:void 0,onClose:void 0,onChange:void 0,teleport:"body",className:"",showIndex:!0,closeable:!1,closeIcon:"clear",transition:void 0,beforeClose:void 0,overlayStyle:void 0,overlayClass:void 0,startPosition:0,swipeDuration:300,showIndicators:!1,closeOnPopstate:!0,closeIconPosition:"top-right"};var be=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(T)return o||(t=U({setup:function(){var e=N(),t=e.state,o=e.toggle,n=function(){t.images=[]};return function(){return h(ge,E(t,{onClosed:n,"onUpdate:show":o}),null)}}}),o=t.instance),e=Array.isArray(e)?{images:e,startPosition:n}:e,o.open(Y({},ye,e)),o};R(ge);var we=a(i("uploader"),3),xe=we[0],_e=we[1],Ae=we[2];function Ce(e,t){return new Promise((function(o){if("file"!==t){var n=new FileReader;n.onload=function(e){o(e.target.result)},"dataUrl"===t?n.readAsDataURL(e):"text"===t&&n.readAsText(e)}else o()}))}function Se(e,t){return H(e).some((function(e){return!!e.file&&(D(t)?t(e.file):e.file.size>+t)}))}var ke=/\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg|avif)/i;function Ie(e){return!!e.isImage||(e.file&&e.file.type?0===e.file.type.indexOf("image"):e.url?(t=e.url,ke.test(t)):"string"==typeof e.content&&0===e.content.indexOf("data:image"));var t}var ze=l({props:{name:s,item:u(Object),index:Number,imageFit:String,lazyLoad:Boolean,deletable:Boolean,previewSize:[Number,String,Array],beforeDelete:Function},emits:["delete","preview"],setup:function(e,t){var o=t.emit,n=t.slots,r=function(){var t=e.item,o=t.status,n=t.message;if("uploading"===o||"failed"===o){var r="failed"===o?h(q,{name:"close",class:_e("mask-icon")},null):h(b,{class:_e("loading")},null),a=X(n)&&""!==n;return h("div",{class:_e("mask")},[r,a&&h("div",{class:_e("mask-message")},[n])])}},a=function(t){var n=e.name,r=e.item,a=e.index,i=e.beforeDelete;t.stopPropagation(),M(i,{args:[r,{name:n,index:a}],done:function(){return o("delete")}})},i=function(){return o("preview")},l=function(){if(e.deletable&&"uploading"!==e.item.status){var t=n["preview-delete"];return h("div",{role:"button",class:_e("preview-delete",{shadow:!t}),tabindex:0,"aria-label":Ae("delete"),onClick:a},[t?t():h(q,{name:"cross",class:_e("preview-delete-icon")},null)])}},u=function(){if(n["preview-cover"]){var t=e.index,o=e.item;return h("div",{class:_e("preview-cover")},[n["preview-cover"](Y({index:t},o))])}};return function(){return h("div",{class:_e("preview")},[(t=e.item,o=e.lazyLoad,n=e.imageFit,a=e.previewSize,Ie(t)?h(ue,{fit:n,src:t.content||t.url,class:_e("preview-image"),width:Array.isArray(a)?a[0]:a,height:Array.isArray(a)?a[1]:a,lazyLoad:o,onClick:i},{default:u}):h("div",{class:_e("file"),style:B(e.previewSize)},[h(q,{class:_e("file-icon"),name:"description"},null),h("div",{class:[_e("file-name"),"van-ellipsis"]},[t.file?t.file.name:t.url]),u()])),r(),l()]);var t,o,n,a}}}),Fe={name:A(""),accept:S("image/*"),capture:String,multiple:Boolean,disabled:Boolean,readonly:Boolean,lazyLoad:Boolean,maxCount:A(1/0),imageFit:S("cover"),resultType:S("dataUrl"),uploadIcon:S("photograph"),uploadText:String,deletable:x,afterRead:Function,showUpload:x,modelValue:_(),beforeRead:Function,beforeDelete:Function,previewSize:[Number,String,Array],previewImage:x,previewOptions:Object,previewFullImage:x,maxSize:{type:[Number,String,Function],default:1/0}},Pe=l({name:xe,props:Fe,emits:["delete","oversize","clickUpload","closePreview","clickPreview","update:modelValue"],setup:function(e,t){var o,n=t.emit,a=t.slots,i=f(),l=[],u=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.modelValue.length;return{name:e.name,index:t}},s=function(){i.value&&(i.value.value="")},d=function(t){if(s(),Se(t,e.maxSize)){if(!Array.isArray(t))return void n("oversize",t,u());var o=function(e,t){var o=[],n=[];return e.forEach((function(e){Se(e,t)?n.push(e):o.push(e)})),{valid:o,invalid:n}}(t,e.maxSize);if(t=o.valid,n("oversize",o.invalid,u()),!t.length)return}t=c(t),n("update:modelValue",[].concat(r(e.modelValue),r(H(t)))),e.afterRead&&e.afterRead(t,u())},p=function(t){var o=e.maxCount,n=e.modelValue,r=e.resultType;if(Array.isArray(t)){var a=+o-n.length;t.length>a&&(t=t.slice(0,a)),Promise.all(t.map((function(e){return Ce(e,r)}))).then((function(e){var o=t.map((function(t,o){var n={file:t,status:"",message:""};return e[o]&&(n.content=e[o]),n}));d(o)}))}else Ce(t,r).then((function(e){var o={file:t,status:"",message:""};e&&(o.content=e),d(o)}))},v=function(t){var o=t.target.files;if(!e.disabled&&o&&o.length){var n=1===o.length?o[0]:[].slice.call(o);if(e.beforeRead){var r=e.beforeRead(n,u());if(!r)return void s();if(K(r))return void r.then((function(e){p(e||n)})).catch(s)}p(n)}},m=function(){return n("closePreview")},g=function(t,r){var i=["imageFit","deletable","previewSize","beforeDelete"],s=Y(L(e,i),L(t,i,!0));return h(ze,E({item:t,index:r,onClick:function(){return n("clickPreview",t,u(r))},onDelete:function(){return function(t,o){var r=e.modelValue.slice(0);r.splice(o,1),n("update:modelValue",r),n("delete",t,u(o))}(t,r)},onPreview:function(){return function(t){if(e.previewFullImage){var n=e.modelValue.filter(Ie),r=n.map((function(e){return e.file&&!e.url&&"failed"!==e.status&&(e.url=URL.createObjectURL(e.file),l.push(e.url)),e.url})).filter(Boolean);o=be(Y({images:r,startPosition:n.indexOf(t),onClose:m},e.previewOptions))}}(t)}},L(e,["name","lazyLoad"]),s),L(a,["preview-cover","preview-delete"]))},y=function(){if(e.previewImage)return e.modelValue.map(g)},b=function(e){return n("clickUpload",e)},w=function(){if(!(e.modelValue.length>=+e.maxCount)){var t=e.readonly?null:h("input",{ref:i,type:"file",class:_e("input"),accept:e.accept,capture:e.capture,multiple:e.multiple,disabled:e.disabled,onChange:v},null);return a.default?h("div",{class:_e("input-wrapper"),onClick:b},[a.default(),t]):G(h("div",{class:_e("upload",{readonly:e.readonly}),style:B(e.previewSize),onClick:b},[h(q,{name:e.uploadIcon,class:_e("upload-icon")},null),e.uploadText&&h("span",{class:_e("upload-text")},[e.uploadText]),t]),[[J,e.showUpload]])}};return Z((function(){l.forEach((function(e){return URL.revokeObjectURL(e)}))})),k({chooseFile:function(){i.value&&!e.disabled&&i.value.click()},closeImagePreview:function(){o&&o.close()}}),W((function(){return e.modelValue})),function(){return h("div",{class:_e()},[h("div",{class:_e("wrapper",{disabled:e.disabled})},[y(),w()])])}}}),Ee=e("U",R(Pe)),Le=e("s",{"uploader-section":"_uploader-section_qlgeb_1","img-close":"_img-close_qlgeb_9",singleImgClose:"_singleImgClose_qlgeb_25",uploader:"_uploader_qlgeb_1",default:"_default_qlgeb_31",previewImg:"_previewImg_qlgeb_36",uploadImg:"_uploadImg_qlgeb_42"}),Ve=e("i","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJgAAACYCAMAAAAvHNATAAABOFBMVEUAAADa2tr39/f////a2tr39/fa2trZ2dnV1dX5+fn5+fnp6en29vbZ2dn4+Pjo6OjZ2dk9PT2ZmZmXl5f29vbx8fHk5OTh4eHq6ur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Ro88zPt7EPR2FdfjJsQtO+FHe0kqi4uYR03peL6ZIPl7mNyoDM88Ks8GfC5HZH+ZqcABWxX/Em98smeg2YNBQoxbTGeWH4HsOqjGhtNYw6TBHje6I33tGX9AuuydSPwzveMjGg6JwwGX4/zKET/HYYE+8LmiZQlhSqWxbHe+kAvN0Vc7WG+egIO2sRz/onRHVYQ/KlJsCMao2P1Orjk1S/gW84bzidnx12oe0GLaaJkkgMFRqVSXFcxgoTzAvREm7N7rBEy+djf/0fvF1uYX+ctmGvY03DdH7Or21Y4EFLuj61jnQN0/g5fyihIW1vsLewW9gX/p8wnddKbcNi7YYVlrRdxF/HmobpvIhDS9rex25h/1LYwxga4iGiT0bQkPfywbOelmvSUx7tm0A3arTvg1eP8K0hxwswoyb4YH7ukOMQzG5O0T77/KtTLA7DkC0ehsweP33x3Do5FtoEi+ojUVa2x0J7p8dCz3FyLHR9Crs+MMqw+iADM1vjoz8BuFyFexahL+UAAAAASUVORK5CYII=");e("M",l({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/*"},bucket:{type:String,default:"gyt"},path:{type:String,default:""},uploadIcon:{type:String,default:Ve},size:{type:String,default:"default"},disabled:{type:Boolean,default:!1},position:{type:String,default:"outside"}},emits:["uploadChange","update:modelValue"],methods:{nativeUpload:function(){var e=this;if(!this.disabled){var t="VIDEO"===this.uploadType?"video":"img";Q({api:"chooseFile",content:{type:t,max:this.maxCount,bucket:this.bucket,path:this.path}},(function(t){console.log(t,"fileUrl"),e.maxCount>1?(e.$emit("update:modelValue",[].concat(r(e.modelValue),[t.fileUrl])),e.$emit("uploadChange",[].concat(r(e.modelValue),[t.fileUrl]))):(e.$emit("update:modelValue",[t.fileUrl]),e.$emit("uploadChange",[t.fileUrl]))}))}},beforeRead:function(e){return console.log(e,"beforeRead"),!!(e.size/1024/1024<this.uploadSize)||($("上传文件大小不能超过 ".concat(this.uploadSize,"MB")),!1)},beforeDelete:function(){return!0},afterRead:function(e){var o=this;return n(t().mark((function n(){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e.status="uploading",e.message="上传中...",t.next=5,o.uploadFile(e.file);case 5:t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),ee();case 10:case"end":return t.stop()}}),n,null,[[0,7]])})))()},onClose:function(e,t){var o=this.modelValue,n=o.findIndex((function(e){return e==t}));n>-1&&(o.splice(n,1),this.$emit("update:modelValue",o),this.$emit("uploadChange")),e.stopPropagation()},getFile:function(e){var o=this;return n(t().mark((function n(){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,o.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()}}),n,null,[[0,5]])})))()},uploadFile:function(e){var o=this;return n(t().mark((function n(){var a,i,l,u,s,c,d,f;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,"/api-web/getUploadSign",a=e.name||"",i=o.path+"/"+(a&&a.replace(/ /gi,"_")),l=(new Date).getTime()+i,console.log(e),t.next=8,te.post("/api-web/getUploadSign",{data:{filename:i,bucketName:o.bucket,postData:{filename:i,acl:"public-read",key:l,unknowValueField:[]}}});case 8:for(d in u=t.sent,oe({message:"加载中...",forbidClick:!0,loadingType:"spinner",duration:0}),s={policy:u.data.policy,signature:u.data.signature,key:l,KSSAccessKeyId:u.data.kssAccessKeyId,acl:"public-read",name:i},c=new FormData,s)c.append(d,s[d]);return c.append("file",e,i),t.next=16,ne(re(o.bucket),{method:"POST",data:c});case 16:console.log(re(o.bucket)+l),f=re(o.bucket)+l,ee(),o.maxCount>1?(o.$emit("update:modelValue",[].concat(r(o.modelValue),[f])),o.$emit("uploadChange",[].concat(r(o.modelValue),[f]))):(o.$emit("update:modelValue",[f]),o.$emit("uploadChange",[f])),t.next=25;break;case 22:t.prev=22,t.t0=t.catch(0),console.log(t.t0,"uploadFile");case 25:case"end":return t.stop()}}),n,null,[[0,22]])})))()}},render:function(){var e=this;return W((function(){return e.modelValue})),h("div",{class:Le["uploader-section"]},[this.modelValue.length>0&&this.maxCount>1&&this.modelValue.map((function(t){return h("div",{class:["van-uploader",Le.uploader,Le[e.size]]},[e.deletable&&!e.disabled&&h(q,{name:"cross",onClick:function(o){return e.onClose(o,t)},class:Le["img-close"]},null),h("div",{class:["van-uploader__upload"]},["IMAGE"===e.uploadType?h(ue,{src:t,class:Le.previewImg,fit:"cover"},null):h("video",{ref:"videoUpload",style:{backgroundColor:"#F8F8F8"},class:Le.previewImg,src:t+"#t=1,4"},null)])])})),this.native?this.maxCount>1?this.modelValue.length<this.maxCount&&h("div",{class:["van-uploader",Le.uploader,Le[this.size]],onClick:this.nativeUpload},[h(q,{name:this.uploadIcon,class:["van-uploader__upload"],size:"32"},null)]):h("div",{class:["van-uploader",Le.uploader,Le[this.size]],onClick:this.nativeUpload},[this.modelValue.length>0?h("div",{class:["van-uploader__upload"]},[this.modelValue.map((function(t){return h(ae,null,[e.deletable&&!e.disabled&&h(q,{name:"cross",onClick:function(o){return e.onClose(o,t)},class:[Le["img-close"],Le.singleImgClose]},null),"IMAGE"===e.uploadType?h(ue,{fit:"cover",position:"center",class:Le.uploadImg,src:t},null):h("video",{ref:"videoUpload",class:Le.uploadImg,style:{backgroundColor:"#F8F8F8"},src:t+"#t=1,4"},null)])}))]):h(q,{name:this.uploadIcon,class:["van-uploader__upload"],size:"32"},null)]):this.maxCount>1?this.modelValue.length<this.maxCount&&h(Ee,{class:["van-uploader",Le.uploader,Le[this.size]],afterRead:this.afterRead,beforeRead:this.beforeRead,beforeDelete:this.beforeDelete,uploadIcon:this.uploadIcon,maxCount:this.maxCount,disabled:this.disabled,accept:this.accept},null):h(Ee,{class:["van-uploader",Le.uploader,Le[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?h("div",{class:["van-uploader__upload"]},[e.modelValue.map((function(t){return h(ae,null,[e.deletable&&!e.disabled&&h(q,{name:"cross",onClick:function(o){return e.onClose(o,t)},class:[Le["img-close"],Le.singleImgClose]},null),"IMAGE"===e.uploadType?h(ue,{fit:"cover",position:"center",class:Le.uploadImg,src:t},null):h("video",{ref:"videoUpload",class:Le.uploadImg,style:{backgroundColor:"#F8F8F8"},src:t+"#t=1,4"},null)])}))]):h(q,{name:e.uploadIcon,class:["van-uploader__upload"],size:"32"},null)]}}),this.$slots.default&&this.$slots.default()])}}))}}}))}();
|