require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["plugin/form/index"],{"077e":function(t,e,n){},"132c":function(t,e,n){"use strict";n.r(e);var o=n("4197"),r=n("6d92");for(var i in r)["default"].indexOf(i)<0&&function(t){n.d(e,t,(function(){return r[t]}))}(i);n("5e54");var a=n("828b"),c=Object(a["a"])(r["default"],o["b"],o["c"],!1,null,"3c52862f",null,!1,o["a"],void 0);e["default"]=c.exports},4197:function(t,e,n){"use strict";n.d(e,"b",(function(){return o})),n.d(e,"c",(function(){return r})),n.d(e,"a",(function(){}));var o=function(){var t=this.$createElement;this._self._c},r=[]},"5e54":function(t,e,n){"use strict";var o=n("077e"),r=n.n(o);r.a},"6b51":function(t,e,n){"use strict";(function(t){var o=n("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=o(n("7ca3")),i=n("8f59");function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function c(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?a(Object(n),!0).forEach((function(e){(0,r.default)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var u={components:{FormItem:function(){n.e("components/form/FormItem").then(function(){return resolve(n("cf96"))}.bind(null,n)).catch(n.oe)},FormCheckboxItem:function(){n.e("components/form/FormCheckboxItem").then(function(){return resolve(n("3917"))}.bind(null,n)).catch(n.oe)},FormSelectItem:function(){n.e("components/form/FormSelectItem").then(function(){return resolve(n("08ae"))}.bind(null,n)).catch(n.oe)},UploadImage:function(){n.e("components/form/UploadImage").then(function(){return resolve(n("27ec"))}.bind(null,n)).catch(n.oe)},MutiUploadImages:function(){n.e("components/form/MutiUploadImages").then(function(){return resolve(n("6b74"))}.bind(null,n)).catch(n.oe)},FormLayout:function(){n.e("components/form/FormLayout").then(function(){return resolve(n("ca06"))}.bind(null,n)).catch(n.oe)},RedButton:function(){n.e("components/form/RedButton").then(function(){return resolve(n("740a"))}.bind(null,n)).catch(n.oe)}},data:function(){return{originFormData:{},formData:{},formId:""}},onLoad:function(t){t.id?(this.formId=t.id,this.getFormData()):this.$util.backPage()},computed:c(c({},(0,i.mapGetters)(["base"])),{},{submitText:function(){return this.base&&this.base.texts&&this.base.texts.form_submit_btn?this.base.texts.form_submit_btn:"提交表单"}}),methods:{getFormData:function(){var e=this;this.$util.get("form/form/info",{id:this.formId}).then((function(n){if(1==n.code){e.originFormData=n.data.info;var o=n.data.info;o.content=o.content.map((function(t){return"select"!=t.type&&"radio"!=t.type||(t.options=t.options.trim().split(",").map((function(t){return{name:t.trim(),value:t.trim()}}))),"select"!=t.type&&"images"!=t.type||(t.value=[]),t})),e.formData=o,t.setNavigationBarTitle({title:e.formData.title})}else e.$util.toast(n.message||"获取表单数据失败")}))},validate:function(){var e=this;return new Promise((function(n,o){e.formData.content.forEach((function(e){e.required&&!e.value&&o({field:e.name,message:e.label+"不能为空"}),"mobile"==e.type&&(t.$u.test.mobile(e.value)||o({field:e.name,message:"手机号格式不正确"})),"idcard"==e.type&&(t.$u.test.idCard(e.value)||o({field:e.name,message:"身份证格式不正确"}))})),n(!0)}))},submitForm:function(){var t=this;this.validate().then((function(e){e&&t.$util.post("form/form/submit",{id:t.formId,content:t.formData.content}).then((function(e){1==e.code?t.$util.toast(e.message,1500,(function(){t.$util.backPage()})):t.$util.toast(e.message||"提交失败")}))})).catch((function(e){t.$util.toast(e.message||"提交失败")}))}}};e.default=u}).call(this,n("df3c")["default"])},"6d92":function(t,e,n){"use strict";n.r(e);var o=n("6b51"),r=n.n(o);for(var i in o)["default"].indexOf(i)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(i);e["default"]=r.a},e4dd:function(t,e,n){"use strict";(function(t,e){var o=n("47a9");n("4c1a");o(n("3240"));var r=o(n("132c"));t.__webpack_require_UNI_MP_PLUGIN__=n,e(r.default)}).call(this,n("3223")["default"],n("df3c")["createPage"])}},[["e4dd","common/runtime","common/vendor"]]]);