(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pagesM/comps/dt_upload"],{5722:function(t,e,n){"use strict";n.r(e);var r=n("c879"),s=n("74a9");for(var i in s)"default"!==i&&function(t){n.d(e,t,(function(){return s[t]}))}(i);n("7d34");var o,a=n("f0c5"),u=Object(a["a"])(s["default"],r["b"],r["c"],!1,null,null,null,!1,r["a"],o);e["default"]=u.exports},"74a9":function(t,e,n){"use strict";n.r(e);var r=n("ce9f"),s=n.n(r);for(var i in r)"default"!==i&&function(t){n.d(e,t,(function(){return r[t]}))}(i);e["default"]=s.a},"7d34":function(t,e,n){"use strict";var r=n("84e6"),s=n.n(r);s.a},"84e6":function(t,e,n){},c879:function(t,e,n){"use strict";var r;n.d(e,"b",(function(){return s})),n.d(e,"c",(function(){return i})),n.d(e,"a",(function(){return r}));var s=function(){var t=this,e=t.$createElement;t._self._c},i=[]},ce9f:function(t,e,n){"use strict";(function(t){function n(t,e){var n;if("undefined"===typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=r(t))||e&&t&&"number"===typeof t.length){n&&(t=n);var s=0,i=function(){};return{s:i,n:function(){return s>=t.length?{done:!0}:{done:!1,value:t[s++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function r(t,e){if(t){if("string"===typeof t)return s(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i={props:{title:{type:String,default:""},max:{type:Number,default:3},files:{type:Array,default:function(){return[]}}},data:function(){return{status:[],successList:[],failedList:[],imgList:[]}},methods:{previewImgs:function(e,n){var r=[e.path],s=Object.prototype.toString.call(n);"[object Array]"==s&&n.length>0&&n.forEach((function(t){r.push(t.path)})),t.previewImage({current:url,urls:r})},clear:function(){this.$set(this,"status",[]),this.$set(this,"successList",[]),this.$set(this,"failedList",[]),this.$set(this,"imgList",[]),this.$emit("update:files",[])},isHost:function(t){var e=this.$global.server.apiUrl;return t&&""!=t&&t.indexOf(e)>-1},remove:function(t,e){this.isHost(t.path),this.imgList.splice(e,1),this.$forceUpdate()},chooseImgs:function(){var e=this;t.chooseImage({count:this.max-this.imgList.length,sizeType:["original","compressed"],sourceType:["album","camera"],success:function(t){var r=t.tempFilePaths,s=e.imgList.slice(0);r.forEach((function(t){s.push({path:t})})),e.imgList=s,e.status=e.status||[];var i,o=n(r);try{for(o.s();!(i=o.n()).done;){i.value;e.status.push("")}}catch(a){o.e(a)}finally{o.f()}e.$forceUpdate()},fail:function(t){console.warn(t.errormsg||"取消选择")},complete:function(){e.isLoading=!1}})},upload:function(){var t=this,e=[],n=this.imgList||[];return n.forEach((function(n,r){if(t.isHost(n.path))t.$set(t.status,r,"success");else{t.$set(t.status,r,"loading");var s=t.$api.uploadImg({_isReject:!0,uri:n.path,name:"img_"+t.$global.server.miniappCode+"_"+Date.now()});e.push(s)}})),new Promise((function(r,s){Promise.all(e).then((function(e){console.log(144,e);var n=!1;if(e.forEach((function(e,r){e&&e[0]?(t.successList.push(e[0]),t.imgList[r]=e[0],t.$set(t.status,r,"success")):(t.$set(t.status,r,"failed"),n=!0)})),n)throw new Error("res is null");t.$emit("complete",t.successList),console.log(160,t.successList),r(t.successList)})).catch((function(e){console.error("error",e),t.$emit("error",e),n.forEach((function(e,n){t.$set(t.status,n,"failed"),t.failedList.push(e)})),s(e)}))}))}},onReady:function(){var t=this;this.$nextTick((function(){var e=t.files||[];t.imgList=[].concat(e),t.$forceUpdate(),console.log(t.imgList)}))}};e.default=i}).call(this,n("543d")["default"])}}]);
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
    'pagesM/comps/dt_upload-create-component',
    {
        'pagesM/comps/dt_upload-create-component':(function(module, exports, __webpack_require__){
            __webpack_require__('543d')['createComponent'](__webpack_require__("5722"))
        })
    },
    [['pagesM/comps/dt_upload-create-component']]
]);
