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 n};var n={},r=Object.prototype,o=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(j){c=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var o=t&&t.prototype instanceof p?t:p,i=Object.create(o.prototype),a=new S(r||[]);return i._invoke=function(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return O()}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var l=_(a,n);if(l){if(l===f)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(e,n,a),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(j){return{type:"throw",arg:j}}}n.wrap=s;var f={};function p(){}function h(){}function v(){}var g={};c(g,a,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(E([])));y&&y!==r&&o.call(y,a)&&(g=y);var b=v.prototype=p.prototype=Object.create(g);function x(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function w(t,n){function r(i,a,l,u){var c=d(t[i],t,a);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==e(f)&&o.call(f,"__await")?n.resolve(f.__await).then((function(e){r("next",e,l,u)}),(function(e){r("throw",e,l,u)})):n.resolve(f).then((function(e){s.value=e,l(s)}),(function(e){return r("throw",e,l,u)}))}u(c.arg)}var i;this._invoke=function(e,t){function o(){return new n((function(n,o){r(e,t,n,o)}))}return i=i?i.then(o,o):o()}}function _(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=d(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,f;var o=r.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function k(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 L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(k,this),this.reset(!0)}function E(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(o.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:O}}function O(){return{value:void 0,done:!0}}return h.prototype=v,c(b,"constructor",v),c(v,"constructor",h),h.displayName=c(v,u,"GeneratorFunction"),n.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===h||"GeneratorFunction"===(t.displayName||t.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,c(e,u,"GeneratorFunction")),e.prototype=Object.create(b),e},n.awrap=function(e){return{__await:e}},x(w.prototype),c(w.prototype,l,(function(){return this})),n.AsyncIterator=w,n.async=function(e,t,r,o,i){void 0===i&&(i=Promise);var a=new w(s(e,t,r,o),i);return n.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(b),c(b,u,"Generator"),c(b,a,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),n.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},n.values=E,S.prototype={constructor:S,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(L),!e)for(var t in this)"t"===t.charAt(0)&&o.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 n(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(l&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},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),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;L(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:E(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},n}function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,o,i=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(u){l=!0,o=u}finally{try{a||null==n.return||n.return()}finally{if(l)throw o}}return i}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(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 r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t,n,r,o,i,a){try{var l=e[i](a),u=l.value}catch(c){return void n(c)}l.done?t(u):Promise.resolve(u).then(r,o)}function i(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function l(e){o(a,r,i,l,u,"next",e)}function u(e){o(a,r,i,l,u,"throw",e)}l(void 0)}))}}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=document.createElement("style");c.innerHTML="._uploadSection_dmnai_1{width:156px;height:106px;background:#f8faf9;border-radius:4px;border:1px solid rgba(45,199,170,.26);font-size:14px;color:#2dc7aa;line-height:20px}._uploadFile_dmnai_11{width:100%;min-width:300px;height:40px;border:1px solid rgba(142,142,142,.26);border-radius:4px;display:flex;align-items:center;padding:0 15px;color:var(--el-text-color-regular)}._uploadFile_dmnai_11 .el-icon{margin-right:5px}._fileUpload_dmnai_25 .el-upload--text{width:100%}._fileUpload_dmnai_25 .el-loading-spinner{display:flex;align-items:center;height:42px!important;justify-content:center;margin-top:-20px!important}._fileUpload_dmnai_25 .el-loading-spinner svg{width:20px;height:20px;margin-right:5px}._uploadClass_dmnai_40{height:106px;width:100%}._uploadClass_dmnai_40 .el-loading-spinner{margin-top:-43px;height:106px}\n",document.head.appendChild(c),System.register(["./index-legacy.fe7501fd.js","./icon_upload-legacy.bc3435a4.js"],(function(e){"use strict";var r,o,a,u,c,s,d,f,p,h,v,g,m,y,b,x,w,_,k,L,S,E,O,j,C,P,A,T,U,N;return{setters:[function(e){r=e.X,o=e.s,a=e.e,u=e.r,c=e.bo,s=e.bp,d=e.h,f=e.C,p=e.Y,h=e.Z,v=e.c,g=e.T,m=e.P,y=e.n,b=e.aP,x=e.bq,w=e.br,_=e.bs,k=e.aa,L=e.bt,S=e.aV,E=e.d,O=e.a$,j=e.b,C=e.bu,P=e.E,A=e.bv,T=e.a},function(e){U=e.E,N=e.i}],execute:function(){function V(e){var t,n=o("loading"),i=a(!1),m=u(l(l({},e),{},{originalPosition:"",originalOverflow:"",visible:!1}));function y(){var e=m.parent;if(!e.vLoadingAddClassList){var t=e.getAttribute("loading-number");(t=Number.parseInt(t)-1)?e.setAttribute("loading-number",t.toString()):(s(e,n.bm("parent","relative")),e.removeAttribute("loading-number")),s(e,n.bm("parent","hidden"))}b(),w.unmount()}function b(){var e,t;null==(t=null==(e=_.$el)?void 0:e.parentNode)||t.removeChild(_.$el)}function x(){i.value&&(i.value=!1,y())}var w=c({name:"ElLoading",setup:function(){return function(){var e=m.spinner||m.svg,t=d("svg",l({class:"circular",viewBox:m.svgViewBox?m.svgViewBox:"25 25 50 50"},e?{innerHTML:e}:{}),[d("circle",{class:"path",cx:"50",cy:"50",r:"20",fill:"none"})]),r=m.text?d("p",{class:n.b("text")},[m.text]):void 0;return d(g,{name:n.b("fade"),onAfterLeave:x},{default:f((function(){return[p(v("div",{style:{backgroundColor:m.background||""},class:[n.b("mask"),m.customClass,m.fullscreen?"is-fullscreen":""]},[d("div",{class:n.b("spinner")},[t,r])]),[[h,m.visible]])]}))})}}}),_=w.mount(document.createElement("div"));return l(l({},r(m)),{},{setText:function(e){m.text=e},removeElLoadingChild:b,close:function(){var n;e.beforeClose&&!e.beforeClose()||(m.parent.vLoadingAddClassList=void 0,i.value=!0,clearTimeout(t),t=window.setTimeout((function(){i.value&&(i.value=!1,y())}),400),m.visible=!1,null==(n=e.closed)||n.call(e))},handleAfterLeave:x,vm:_,get $el(){return _.$el}})}var F=void 0,I=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(m){var t=B(e);if(t.fullscreen&&F)return F;var n=V(l(l({},t),{},{closed:function(){var e;null==(e=t.closed)||e.call(t),t.fullscreen&&(F=void 0)}}));$(t,t.parent,n),D(t,t.parent,n),t.parent.vLoadingAddClassList=function(){return D(t,t.parent,n)};var r=t.parent.getAttribute("loading-number");return r=r?"".concat(Number.parseInt(r)+1):"1",t.parent.setAttribute("loading-number",r),t.parent.appendChild(n.$el),y((function(){return n.visible.value=t.visible})),t.fullscreen&&(F=n),n}},B=function(e){var t,n,r,o,i;return{parent:(i=b(e.target)?null!=(t=document.querySelector(e.target))?t:document.body:e.target||document.body)===document.body||e.body?document.body:i,background:e.background||"",svg:e.svg||"",svgViewBox:e.svgViewBox||"",spinner:e.spinner||!1,text:e.text||"",fullscreen:i===document.body&&(null==(n=e.fullscreen)||n),lock:null!=(r=e.lock)&&r,customClass:e.customClass||"",visible:null==(o=e.visible)||o,target:i}},$=function(){var e=i(t().mark((function e(r,o,i){var a,l,u,c,s,d,f,p,h,v,g,m,b,_,k;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=x(),l=a.nextZIndex,u={},!r.fullscreen){e.next=8;break}i.originalPosition.value=w(document.body,"position"),i.originalOverflow.value=w(document.body,"overflow"),u.zIndex=l(),e.next=17;break;case 8:if(r.parent!==document.body){e.next=16;break}return i.originalPosition.value=w(document.body,"position"),e.next=12,y();case 12:for(c=0,s=["top","left"];c<s.length;c++)f="top"===(d=s[c])?"scrollTop":"scrollLeft",u[d]="".concat(r.target.getBoundingClientRect()[d]+document.body[f]+document.documentElement[f]-Number.parseInt(w(document.body,"margin-".concat(d)),10),"px");for(p=0,h=["height","width"];p<h.length;p++)u[v=h[p]]="".concat(r.target.getBoundingClientRect()[v],"px");e.next=17;break;case 16:i.originalPosition.value=w(o,"position");case 17:for(g=0,m=Object.entries(u);g<m.length;g++)b=n(m[g],2),_=b[0],k=b[1],i.$el.style[_]=k;case 18:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),D=function(e,t,n){var r=o("loading");"absolute"!==n.originalPosition.value&&"fixed"!==n.originalPosition.value?_(t,r.bm("parent","relative")):s(t,r.bm("parent","relative")),e.fullscreen&&e.lock?_(t,r.bm("parent","hidden")):s(t,r.bm("parent","hidden"))},G=Symbol("ElLoading"),z=function(e,t){var n,r,o,i,l=t.instance,u=function(e){return k(t.value)?t.value[e]:void 0},c=function(t){return n=u(t)||e.getAttribute("element-loading-".concat(L(t))),(r=b(n)&&(null==l?void 0:l[n])||n)?a(r):r;var n,r},s=null!=(n=u("fullscreen"))?n:t.modifiers.fullscreen,d={text:c("text"),svg:c("svg"),svgViewBox:c("svgViewBox"),spinner:c("spinner"),background:c("background"),customClass:c("customClass"),fullscreen:s,target:null!=(r=u("target"))?r:s?void 0:e,body:null!=(o=u("body"))?o:t.modifiers.body,lock:null!=(i=u("lock"))?i:t.modifiers.lock};e[G]={options:d,instance:I(d)}},R={mounted:function(e,t){t.value&&z(e,t)},updated:function(e,t){var n=e[G];t.oldValue!==t.value&&(t.value&&!t.oldValue?z(e,t):t.value&&t.oldValue?k(t.value)&&function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];S(t[o])&&(t[o].value=e[o])}}(t.value,n.options):null==n||n.instance.close())},unmounted:function(e){var t;null==(t=e[G])||t.instance.close()}},K=e("E",{install:function(e){e.directive("loading",R),e.config.globalProperties.$loading=I},directive:R,service:I}),M={uploadSection:"_uploadSection_dmnai_1",uploadFile:"_uploadFile_dmnai_11",fileUpload:"_fileUpload_dmnai_25",uploadClass:"_uploadClass_dmnai_40"};e("C",E({name:"col-upload",props:{modelValue:{type:String,default:""},uploadType:{type:String,default:"image"},disabled:{type:Boolean,default:!1},bucket:{type:String,default:"daya"},size:{type:Number,default:5},accept:{type:String,default:"images/*"},tips:{type:String,default:"请上传图片"},extraTips:{type:String,default:"图片最大不能超过5MB"},onChange:{type:Function,default:function(){}}},data:function(){return{ossUploadUrl:"https://ks3-cn-beijing.ksyuncs.com/"+this.bucket,dataObj:{policy:"",signature:"",key:"",KSSAccessKeyId:"",acl:"public-read",name:""},fileList:[],loading:null}},methods:{handleSuccess:function(){var e;null===(e=this.loading)||void 0===e||e.close();var t=this.ossUploadUrl+"/"+this.dataObj.key;console.log(t),this.$emit("update:modelValue",t),this.onChange(t)},handleRemove:function(){console.log("remove")},handleChange:function(){console.log("handleChange")},handleProgress:function(){console.log("handleProgress")},handleError:function(){var e;null===(e=this.loading)||void 0===e||e.close()},beforeUpload:function(e){var n=this;return i(t().mark((function r(){var o,i,a,l,u;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(console.log(e),!0,!n.size){t.next=7;break}if(e.size/1024/1024<n.size){t.next=7;break}return O.error("文件大小不能超过".concat(n.size,"M!")),t.abrupt("return",!1);case 7:return n.loading=K.service({target:n.$refs.uploadDom,lock:!0,fullscreen:!1,text:"上传中...",background:"rgba(0, 0, 0, 0.7)"}),console.log(n.loading),t.prev=9,o=e.name.replaceAll(" ","_"),i=(new Date).getTime()+o,a={filename:o,bucketName:n.bucket,postData:{filename:o,acl:"public-read",key:i,unknowValueField:[]}},t.next=15,j.post("/api-website/getUploadSign",{data:a});case 15:l=t.sent,u=l.data,n.dataObj={policy:u.policy,signature:u.signature,key:i,KSSAccessKeyId:u.kssAccessKeyId,acl:"public-read",name:o},t.next=23;break;case 20:t.prev=20,t.t0=t.catch(9),n.loading.close();case 23:case"end":return t.stop()}}),r,null,[[9,20]])})))()},fileName:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.split("/").pop()},handleExceed:function(){}},render:function(){var e=this;return v("div",{class:[M.colUpload,"w-full"]},[v(U,{disabled:this.disabled,action:this.ossUploadUrl,data:this.dataObj,onSuccess:this.handleSuccess,onRemove:this.handleRemove,onChange:this.handleChange,onProgress:this.handleProgress,onError:this.handleError,fileList:this.fileList,showFileList:!1,accept:this.accept,beforeUpload:this.beforeUpload,onExceed:this.handleExceed,ref:"uploadRef",class:"file"===this.uploadType?M.fileUpload:""},{default:function(){return[v("div",{ref:"uploadDom",class:[M.uploadClass,"w-full"],style:{height:"image"===e.uploadType?"106px":"38px"}},[e.modelValue?"image"===e.uploadType?v(C,{src:e.modelValue,fit:"cover",class:M.uploadSection},null):v("div",{class:M.uploadFile},[v(P,null,{default:function(){return[v(A,null,null)]}}),v("span",{class:"whitespace-nowrap overflow-hidden text-ellipsis"},[e.fileName(e.modelValue)])]):"image"===e.uploadType?v("div",{class:[M.uploadSection,"flex items-center flex-col justify-center"]},[v("img",{src:N,class:"w-8 h-7 mb-3"},null),v("p",null,[e.tips])]):v("div",{class:M.uploadFile},[v(P,null,{default:function(){return[v(A,null,null)]}}),T("上传文件")])])]}}),v("p",{class:"text-3 text-[#999999] leading-6 pt-1"},[this.extraTips])])}}))}}}))}();
|