text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-cd1f1b72","chunk-2d2165e6","chunk-2d0c7cd1"],{"1e75":function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"container"},[r("div",{staticClass:"title"},[r("span",[e._v("更新宫格")]),r("span",{staticClass:"back",on:{click:function(t){return e.back(!1)}}},[r("i",{staticClass:"iconfont icon-fanhui"}),e._v(" 返回 ")])]),r("div",{staticClass:"wrap"},[r("el-row",[r("el-col",{attrs:{lg:16,md:20,sm:24,xs:24}},[r("el-form",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"form",attrs:{model:e.form,"status-icon":"",rules:e.rules,"label-width":"120px"},nativeOn:{submit:function(e){e.preventDefault()}}},[r("el-form-item",{attrs:{label:"宫格标题",prop:"title"}},[r("el-input",{attrs:{size:"medium",placeholder:"请填写宫格标题"},model:{value:e.form.title,callback:function(t){e.$set(e.form,"title",t)},expression:"form.title"}})],1),r("el-form-item",{attrs:{label:"宫格名",prop:"name"}},[r("el-input",{attrs:{size:"medium",placeholder:"请填写宫格名"},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),r("el-form-item",{attrs:{label:"分类",prop:"category_id"}},[r("el-select",{attrs:{size:"medium",filterable:"",placeholder:"请选择分类"},model:{value:e.form.parent_id,callback:function(t){e.$set(e.form,"parent_id",t)},expression:"form.parent_id"}},[e._l(e.cateData,function(t){return[r("el-option",{attrs:{value:t.id,label:t.name}},[r("span",{staticStyle:{color:"#b4b4b4","margin-right":"15px","font-size":"12px"}},[e._v(e._s(t.id))]),r("span",[e._v(e._s(t.name))])]),e._l(t.sub,function(n){return t.sub?[r("el-option",{attrs:{value:n.id,label:n.name}},[r("span",{staticStyle:{color:"#b4b4b4","margin-right":"15px","font-size":"12px"}},[e._v("┞----"+e._s(n.id))]),r("span",[e._v(e._s(n.name))])]),e._l(n.sub,function(t){return n.sub?[r("el-option",{attrs:{value:t.id,label:t.name}},[r("span",{staticStyle:{color:"#b4b4b4","margin-right":"15px","font-size":"12px"}},[e._v("┞----"+e._s(t.id))]),r("span",[e._v(e._s(t.name))])])]:e._e()})]:e._e()})]})],2)],1),r("el-form-item",{attrs:{label:"排序",prop:"order"}},[r("el-input",{attrs:{size:"medium",placeholder:"请填写宫格排序"},model:{value:e.form.order,callback:function(t){e.$set(e.form,"order",t)},expression:"form.order"}})],1),r("el-form-item",{attrs:{label:"显示上线",prop:"show"}},[r("el-switch",{attrs:{"active-color":"#3963bc"},model:{value:e.form.show,callback:function(t){e.$set(e.form,"show",t)},expression:"form.show"}})],1),r("el-form-item",{attrs:{label:"图片",prop:"img"}},[r("upload-imgs",{ref:"uploadEle",attrs:{rules:e.imgRules,value:e.solveShowImg(e.form.img),maxNum:1}})],1),r("el-form-item",{attrs:{label:"宫格描述",prop:"description"}},[r("el-input",{attrs:{size:"medium",placeholder:"请填写宫格描述"},model:{value:e.form.description,callback:function(t){e.$set(e.form,"description",t)},expression:"form.description"}})],1),r("el-form-item",{staticClass:"submit"},[r("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.submitForm("form")}}},[e._v("保 存")]),r("el-button",{on:{click:function(t){return e.resetForm("form")}}},[e._v("重 置")])],1)],1)],1)],1)],1)])},a=[],o=r("a34a"),i=r.n(o),u=r("51ba"),c=r("c1bd"),s=r("306b"),l=r("e0ba");function p(e){return p="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},p(e)}function f(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(s){return void r(s)}u.done?t(c):Promise.resolve(c).then(n,a)}function d(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function i(e){f(o,n,a,i,u,"next",e)}function u(e){f(o,n,a,i,u,"throw",e)}i(void 0)})}}var v={props:{pid:Number,editID:Number},components:{UploadImgs:l["default"]},data:function(){return{loading:!1,form:{name:"",order:50,show:1,description:""},imgRules:{minWidth:0,minHeight:0,maxSize:5},cateData:{},rules:{title:[{required:!0,message:"请输入宫格标题",trigger:"blur"}]}}},created:function(){this.getGrid(),this.getTreeCate()},methods:{getGrid:function(){var e=d(i.a.mark(function e(){var t;return i.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return this.loading=!0,t=this.editID,t||this.back(!1),e.prev=3,e.next=6,u["default"].getGrid(t);case 6:this.form=e.sent,this.form.show=!!this.form.show,e.next=13;break;case 10:e.prev=10,e.t0=e["catch"](3),this.back(!1);case 13:this.loading=!1;case 14:case"end":return e.stop()}},e,this,[[3,10]])}));function t(){return e.apply(this,arguments)}return t}(),submitForm:function(e){var t=this;this.$refs[e].validate(function(){var r=d(i.a.mark(function r(n){var a,o,c,l;return i.a.wrap(function(r){while(1)switch(r.prev=r.next){case 0:if(!n){r.next=28;break}return r.prev=1,r.next=4,t.$refs.uploadEle.getValue();case 4:return a=r.sent,t.form.img=s["default"].solveUploadImg(a),t.loading=!0,r.next=9,u["default"].updateGrid(t.editID,t.form);case 9:o=r.sent,t.loading=!1,0===o.error_code&&(t.$message.success("".concat(o.msg)),t.resetForm(e),t.back()),r.next=26;break;case 14:if(r.prev=14,r.t0=r["catch"](1),c=r.t0.data.msg,!c||"object"!==p(c)){r.next=26;break}r.t1=i.a.keys(c);case 19:if((r.t2=r.t1()).done){r.next=26;break}return l=r.t2.value,t.$message.error(c[l]),r.next=24,setTimeout(function(){},1e3);case 24:r.next=19;break;case 26:r.next=30;break;case 28:return t.$message.error("请填写正确的信息"),r.abrupt("return",!1);case 30:case"end":return r.stop()}},r,null,[[1,14]])}));return function(e){return r.apply(this,arguments)}}())},getTreeCate:function(){var e=d(i.a.mark(function e(){var t,r,n=arguments;return i.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:0,r=n.length>1&&void 0!==n[1]?n[1]:2,e.prev=2,e.next=5,c["default"].getTreeCate(t,r);case 5:this.cateData=e.sent,console.log(this.cateData),e.next=12;break;case 9:e.prev=9,e.t0=e["catch"](2),this.cateData={};case 12:case"end":return e.stop()}},e,this,[[2,9]])}));function t(){return e.apply(this,arguments)}return t}(),solveShowImg:function(e){return s["default"].solveShowImg(e)},resetForm:function(e){this.$refs[e].resetFields()},back:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.$emit("close",e)}}},m=v,h=(r("b2c8"),r("2877")),b=Object(h["a"])(m,n,a,!1,null,"8bd74d58",null);t["default"]=b.exports},"51ba":function(e,t,r){"use strict";r.r(t);var n=r("a34a"),a=r.n(n),o=r("dfd8");function i(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(s){return void r(s)}u.done?t(c):Promise.resolve(c).then(n,a)}function u(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function u(e){i(o,n,a,u,c,"next",e)}function c(e){i(o,n,a,u,c,"throw",e)}u(void 0)})}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),e}var p=function(){function e(){c(this,e)}return l(e,[{key:"getGrids",value:function(){var e=u(a.a.mark(function e(){var t;return a.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["get"])("v1/gridCategory");case 2:return t=e.sent,e.abrupt("return",t);case 4:case"end":return e.stop()}},e)}));function t(){return e.apply(this,arguments)}return t}()},{key:"getGrid",value:function(){var e=u(a.a.mark(function e(t){var r;return a.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["get"])("v1/gridCategory/".concat(t));case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e)}));function t(t){return e.apply(this,arguments)}return t}()},{key:"addGrid",value:function(){var e=u(a.a.mark(function e(t){var r;return a.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["post"])("v1/gridCategory",t);case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e)}));function t(t){return e.apply(this,arguments)}return t}()},{key:"updateGrid",value:function(){var e=u(a.a.mark(function e(t,r){var n;return a.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["put"])("v1/gridCategory/".concat(t),r);case 2:return n=e.sent,e.abrupt("return",n);case 4:case"end":return e.stop()}},e)}));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"updateSingle",value:function(){var e=u(a.a.mark(function e(t){var r;return a.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["patch"])("v1/gridCategory/single",t);case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e)}));function t(t){return e.apply(this,arguments)}return t}()},{key:"delCate",value:function(){var e=u(a.a.mark(function e(t){var r;return a.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["_delete"])("v1/gridCategory",{ids:t});case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e)}));function t(t){return e.apply(this,arguments)}return t}()}]),e}();t["default"]=new p},9878:function(e,t,r){},b2c8:function(e,t,r){"use strict";r("9878")},c1bd:function(e,t,r){"use strict";r.r(t);var n=r("a34a"),a=r.n(n),o=r("dfd8");function i(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(s){return void r(s)}u.done?t(c):Promise.resolve(c).then(n,a)}function u(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function u(e){i(o,n,a,u,c,"next",e)}function c(e){i(o,n,a,u,c,"throw",e)}u(void 0)})}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,r){return t&&s(e.prototype,t),r&&s(e,r),e}var p=function(){function e(){c(this,e)}return l(e,[{key:"getCate",value:function(){var e=u(a.a.mark(function e(t){var r;return a.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["get"])("v1/category/".concat(t));case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e)}));function t(t){return e.apply(this,arguments)}return t}()},{key:"getSonCate",value:function(){var e=u(a.a.mark(function e(){var t,r,n,i=arguments;return a.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:-1,console.log(t),r="",t>=0&&(r+="?parent_id=".concat(t)),e.next=6,Object(o["get"])("v1/category".concat(r),{handleError:!0});case 6:return n=e.sent,e.abrupt("return",n);case 8:case"end":return e.stop()}},e)}));function t(){return e.apply(this,arguments)}return t}()},{key:"getTreeCate",value:function(){var e=u(a.a.mark(function e(){var t,r,n,i=arguments;return a.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:0,r=i.length>1&&void 0!==i[1]?i[1]:0,e.next=4,Object(o["get"])("v1/category/".concat(t,"/deep?deep=").concat(r),{handleError:!0});case 4:return n=e.sent,e.abrupt("return",n);case 6:case"end":return e.stop()}},e)}));function t(){return e.apply(this,arguments)}return t}()},{key:"addCate",value:function(){var e=u(a.a.mark(function e(t){var r;return a.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["post"])("v1/category",t);case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e)}));function t(t){return e.apply(this,arguments)}return t}()},{key:"updateCate",value:function(){var e=u(a.a.mark(function e(t,r){var n;return a.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["put"])("v1/category/".concat(t),r);case 2:return n=e.sent,e.abrupt("return",n);case 4:case"end":return e.stop()}},e)}));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"updateSingle",value:function(){var e=u(a.a.mark(function e(t){var r;return a.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["patch"])("v1/category/single",t);case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e)}));function t(t){return e.apply(this,arguments)}return t}()},{key:"delCate",value:function(){var e=u(a.a.mark(function e(t){var r;return a.a.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,Object(o["_delete"])("v1/category",{ids:t});case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e)}));function t(t){return e.apply(this,arguments)}return t}()}]),e}();t["default"]=new p}}]);