(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pagesDemand/demand/add"],{"0676":function(t,e,n){"use strict";n.r(e);var i=n("1e98"),o=n.n(i);for(var a in i)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(a);e["default"]=o.a},"1e98":function(t,e,n){"use strict";(function(t){var i=n("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=i(n("af34")),a=i(n("7ca3")),s=n("8f59");function c(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}var r={components:{selectPicker:function(){n.e("pages/component/picker/select").then(function(){return resolve(n("519f"))}.bind(null,n)).catch(n.oe)}},data:function(){return{pageShow:!1,typeList:[],formData:{category_id:null,title:"",content:"",address:"",lng:"",lat:"",images:""},selectImages:[],timeout:null}},computed:function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?c(Object(n),!0).forEach((function(e){(0,a.default)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},(0,s.mapState)({themeColor:function(t){return t.app.themeColor}})),onLoad:function(){this.getDemandType()},onUnload:function(){this.timeout&&clearTimeout(this.timeout)},methods:{pageChange:function(t){this.pageShow=t},splitImages:function(t){try{return t?t.split(","):[]}catch(e){return[]}},getDemandType:function(){var e=this;this.$util.request("demand.businessCat",{}).then((function(n){1==n.code?e.typeList=n.data:t.showToast({title:n.msg,icon:"none"})})).catch((function(t){console.error("获取发布类型",t)}))},openSelectType:function(){this.$refs.selectPicker.open(this.typeList,this.formData.category_id)},changeSelectType:function(t){this.formData.category_id=t.id},getTypeName:function(){for(var t in this.typeList)if(this.typeList[t].id==this.formData.category_id)return this.typeList[t].name;return""},chooseLocation:function(){var e=this;t.chooseLocation({success:function(t){e.formData.lat=t.latitude,e.formData.lng=t.longitude,e.formData.address=t.address||""}})},chooseImage:function(){var e=this;t.chooseMedia({count:9-this.selectImages.length,mediaType:["image"],sourceType:["album","camera"],sizeType:["compressed"],success:function(t){e.selectImages=[].concat((0,o.default)(e.selectImages),(0,o.default)(t.tempFiles.map((function(t){return t.tempFilePath}))))}})},deleteImage:function(t){this.$delete(this.selectImages,t)},previewImage:function(e){t.previewImage({urls:this.selectImages,current:e})},handleSubmit:function(){var e=this;if(this.formData.category_id)if(this.formData.title)if(this.formData.content)if(this.selectImages.length>0){t.showLoading({title:"提交中",mask:!0});var n=this.splitImages(this.formData.images);this.$util.uploadFileMultiple(this.selectImages,n).then((function(t){e.formData.images=t,e.submitEvent()})).catch((function(e){t.hideLoading(),console.error("上传图片 ",e)}))}else t.showLoading({title:"提交中",mask:!0}),this.submitEvent();else t.showToast({title:"请输入内容",icon:"none"});else t.showToast({title:"请输入标题",icon:"none"});else t.showToast({title:"请选择发布类型",icon:"none"})},submitEvent:function(){var e=this;this.$util.request("demand.businessAdd",this.formData).then((function(n){1==n.code?(t.showToast({title:"提交成功",icon:"success",duration:1500,mask:!0}),e.timeout=setTimeout((function(){t.navigateBack()}),1500)):t.showToast({title:n.msg,icon:"none"})})).catch((function(t){console.error("提交审核",t)}))}}};e.default=r}).call(this,n("df3c")["default"])},"41d5":function(t,e,n){},"59a9":function(t,e,n){"use strict";n.r(e);var i=n("9f4f"),o=n("0676");for(var a in o)["default"].indexOf(a)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(a);n("c6f0");var s=n("828b"),c=Object(s["a"])(o["default"],i["b"],i["c"],!1,null,null,null,!1,i["a"],void 0);e["default"]=c.exports},"9f4f":function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){}));var i=function(){var t=this.$createElement,e=(this._self._c,this.formData.category_id?this.getTypeName():null),n=this.selectImages.length;this.$mp.data=Object.assign({},{$root:{m0:e,g0:n}})},o=[]},c6f0:function(t,e,n){"use strict";var i=n("41d5"),o=n.n(i);o.a},e47a:function(t,e,n){"use strict";(function(t,e){var i=n("47a9");n("aa6c");i(n("3240"));var o=i(n("59a9"));t.__webpack_require_UNI_MP_PLUGIN__=n,e(o.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])}},[["e47a","common/runtime","common/vendor"]]]);