(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/activity/uploadFiel"],{182:function(t,e,n){"use strict";(function(t){n(5);r(n(4));var e=r(n(183));function r(t){return t&&t.__esModule?t:{default:t}}wx.__webpack_require_UNI_MP_PLUGIN__=n,t(e.default)}).call(this,n(1)["createPage"])},183:function(t,e,n){"use strict";n.r(e);var r=n(184),o=n(186);for(var i in o)"default"!==i&&function(t){n.d(e,t,(function(){return o[t]}))}(i);n(188);var u,a=n(11),c=Object(a["default"])(o["default"],r["render"],r["staticRenderFns"],!1,null,null,null,!1,r["components"],u);c.options.__file="pages/activity/uploadFiel.vue",e["default"]=c.exports},184:function(t,e,n){"use strict";n.r(e);var r=n(185);n.d(e,"render",(function(){return r["render"]})),n.d(e,"staticRenderFns",(function(){return r["staticRenderFns"]})),n.d(e,"recyclableRender",(function(){return r["recyclableRender"]})),n.d(e,"components",(function(){return r["components"]}))},185:function(t,e,n){"use strict";var r;n.r(e),n.d(e,"render",(function(){return o})),n.d(e,"staticRenderFns",(function(){return u})),n.d(e,"recyclableRender",(function(){return i})),n.d(e,"components",(function(){return r}));var o=function(){var t=this,e=t.$createElement;t._self._c},i=!1,u=[];o._withStripped=!0},186:function(t,e,n){"use strict";n.r(e);var r=n(187),o=n.n(r);for(var i in r)"default"!==i&&function(t){n.d(e,t,(function(){return r[t]}))}(i);e["default"]=o.a},187:function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=u(n(18)),o=u(n(171)),i=n(23);function u(t){return t&&t.__esModule?t:{default:t}}function a(t,e,n,r,o,i,u){try{var a=t[i](u),c=a.value}catch(s){return void n(s)}a.done?e(c):Promise.resolve(c).then(r,o)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function u(t){a(i,r,o,u,c,"next",t)}function c(t){a(i,r,o,u,c,"throw",t)}u(void 0)}))}}t.getStorageSync("token");var s={onLoad:function(t){this.activityId=t.activityId},data:function(){return{activityId:"",form:[]}},mounted:function(){var e=this;return c(r.default.mark((function n(){var i,u,a;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return n.next=2,o.default.getPhotos({activityId:e.activityId});case 2:if(u=n.sent,!u.errcode){n.next=7;break}return wx.showToast({title:u.details,icon:"error"}),setTimeout((function(){t.navigateBack()}),1e3),n.abrupt("return");case 7:a=null===(i=u.data.photos)||void 0===i?void 0:i.map((function(t){return t.photo})),a&&(e.form=a);case 9:case"end":return n.stop()}}),n)})))()},methods:{submit:function(){var e=this;return c(r.default.mark((function n(){var i;return r.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(!(e.form.length<=0)){n.next=3;break}return wx.showToast({title:"请选择图片",icon:"error"}),n.abrupt("return");case 3:return n.next=6,o.default.uploadImgs({activityId:e.activityId,photos:e.form});case 6:i=n.sent,200==i.code&&(wx.showToast({title:"提交成功"}),setTimeout((function(){t.navigateBack()}),1e3));case 8:case"end":return n.stop()}}),n)})))()},upload:function(){var e=this,n=t.getStorageSync("token");t.chooseImage({count:1,success:function(){var o=c(r.default.mark((function o(u){var a;return r.default.wrap((function(r){while(1)switch(r.prev=r.next){case 0:wx.showLoading({title:"上传中"}),a=u.tempFilePaths,t.uploadFile({url:i.BASE_URL.url+"/activity/photo",name:"file",header:{Authorization:"Bearer ".concat(n)},filePath:a[0],success:function(t){var n=JSON.parse(t.data);e.form.push(i.BASE_URL.fileUrl+n.imgUrl)},fail:function(t){console.log(t),wx.showToast({title:"上传失败"})},complete:function(){wx.hideLoading()}});case 3:case"end":return r.stop()}}),o)})));function u(t){return o.apply(this,arguments)}return u}()})},imgx:function(t){var e=t.url;this.form=this.form.filter((function(t){return t!==e}))}}};e.default=s}).call(this,n(1)["default"])},188:function(t,e,n){"use strict";n.r(e);var r=n(189),o=n.n(r);for(var i in r)"default"!==i&&function(t){n.d(e,t,(function(){return r[t]}))}(i);e["default"]=o.a},189:function(t,e,n){}},[[182,"common/runtime","common/vendor"]]]);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/activity/uploadFiel.js.map