(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-d9a7b4ae"],{"061a":function(t,e,o){"use strict";var s=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"createPost-container"},[o("el-form",{ref:"postForm",staticClass:"form-container",attrs:{model:t.postForm,rules:t.rules,"label-position":t.labelPosition,"label-width":"100px"}},[o("div",{staticClass:"createPost-main-container"},[o("el-row",[o("el-col",{attrs:{span:24}},[o("div",{staticClass:"postInfo-container"},[o("el-form-item",{staticStyle:{"margin-bottom":"30px"},attrs:{prop:"url",label:"轮播图片"}},[o("Upload",{model:{value:t.postForm.url,callback:function(e){t.$set(t.postForm,"url",e)},expression:"postForm.url"}})],1)],1)])],1),o("el-form-item",{staticStyle:{"margin-bottom":"30px"},attrs:{prop:"sort",label:"排序"}},[o("el-input",{staticStyle:{width:"100px"},attrs:{placeholder:"排序(倒序)"},model:{value:t.postForm.sort,callback:function(e){t.$set(t.postForm,"sort",e)},expression:"postForm.sort"}})],1),o("el-form-item",{staticStyle:{"margin-bottom":"30px"},attrs:{prop:"position",label:"所属位置"}},[[o("el-radio-group",{model:{value:t.postForm.position,callback:function(e){t.$set(t.postForm,"position",e)},expression:"postForm.position"}},[o("el-radio",{attrs:{label:1}},[t._v("门店")]),o("el-radio",{attrs:{label:2}},[t._v("产品")])],1)]],2),2===t.postForm.position?o("el-form-item",{staticStyle:{"margin-bottom":"30px"},attrs:{prop:"product_name",label:"产品名称"}},[o("el-input",{staticStyle:{width:"300px"},attrs:{placeholder:""},model:{value:t.postForm.product_name,callback:function(e){t.$set(t.postForm,"product_name",e)},expression:"postForm.product_name"}})],1):t._e(),2===t.postForm.position?o("el-form-item",{staticStyle:{"margin-bottom":"30px"},attrs:{prop:"product_desc",label:"产品描述"}},[o("el-input",{staticStyle:{width:"600px"},attrs:{placeholder:"",type:"textarea"},model:{value:t.postForm.product_desc,callback:function(e){t.$set(t.postForm,"product_desc",e)},expression:"postForm.product_desc"}})],1):t._e(),2===t.postForm.position?o("el-form-item",{staticStyle:{"margin-bottom":"30px"},attrs:{prop:"product_series",label:"产品系列"}},[o("el-input",{staticStyle:{width:"300px"},attrs:{placeholder:""},model:{value:t.postForm.product_series,callback:function(e){t.$set(t.postForm,"product_series",e)},expression:"postForm.product_series"}})],1):t._e(),o("el-form-item",{staticStyle:{"margin-bottom":"30px"},attrs:{prop:"status",label:"状态"}},[o("el-switch",{attrs:{"active-text":"激活","inactive-text":"隐藏"},model:{value:t.postForm.status,callback:function(e){t.$set(t.postForm,"status",e)},expression:"postForm.status"}})],1),o("el-row",[t.isEdit?t._e():o("el-button",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],attrs:{type:"success"},on:{click:t.submitForm}},[t._v(" 提交 ")]),t.isEdit?o("el-button",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],attrs:{type:"success"},on:{click:t.updateArticle}},[t._v(" 修改 ")]):t._e()],1)],1)])],1)},a=[],i=o("70a2"),r=o("709b"),n={redirect:"",status:!0,position:1,url:"",cover_img:"",display_time:void 0,id:void 0,platforms:["a-platform"],comment_disabled:!1,importance:0},l={name:"ArticleDetail",components:{Upload:i["a"]},props:{isEdit:{type:Boolean,default:!1}},data:function(){var t=this,e=function(e,o,s){""===o?(t.$message({message:e.field+"为必传项",type:"error"}),s(new Error(e.field+"为必传项"))):s()};return{postForm:Object.assign({},n),loading:!1,userListOptions:[],rules:{url:[{message:"banner图不为空",validator:e}]},tempRoute:{},labelPosition:"left"}},computed:{},created:function(){if(this.isEdit){var t=this.$route.params&&this.$route.params.id;this.fetchData(t)}this.tempRoute=Object.assign({},this.$route)},methods:{fetchData:function(t){var e=this;Object(r["c"])(t).then((function(t){e.postForm=t.data.info,e.postForm.status=1===e.postForm.status,console.log(e.postForm.position),e.postForm.position=e.editPosition(e.postForm.position)})).catch((function(t){console.log(t)}))},setPageTitle:function(){var t="Edit Article";document.title="".concat(t," - ").concat(this.postForm.id)},submitForm:function(){var t=this;this.$refs.postForm.validate((function(e){if(!e)return console.log("error submit!!"),!1;t.loading=!0,console.log(t.postForm),(t.postForm.status||""===t.postForm.status)&&(t.postForm.status=1),t.postForm.createPosition=t.formatCreatePosition(t.postForm.position),Object(r["a"])(t.postForm).then((function(e){t.$notify({title:"成功",message:"创建成功",type:"success",duration:2e3}),t.loading=!1,t.listLoading=!1,t.$router.push("/banner/list")}))}))},updateArticle:function(){var t=this;console.log(this.postForm),this.postForm.position=this.formatCreatePosition(this.postForm.position),Object(r["e"])(this.postForm).then((function(e){t.$notify({title:"修改",message:"修改成功",type:"success",duration:2e3}),t.postForm.status="published",t.loading=!1,t.listLoading=!1,t.$router.push("/banner/list")}))},draftForm:function(){0!==this.postForm.content.length&&0!==this.postForm.title.length?(this.$message({message:"保存成功",type:"success",showClose:!0,duration:1e3}),this.postForm.status="draft"):this.$message({message:"请填写必要的标题和内容",type:"warning"})},formatCreatePosition:function(t){switch(t){case 1:return"SHOP";case 2:return"PRODUCT";case 3:return"VIDEO";case 4:return"GUIDE"}},editPosition:function(t){switch(t){case"SHOP":return 1;case"PRODUCT":return 2;case"VIDEO":return 3;case"GUIDE":return 4}}}},c=l,u=(o("118e"),o("2877")),p=Object(u["a"])(c,s,a,!1,null,"24fc3c62",null);e["a"]=p.exports},"118e":function(t,e,o){"use strict";var s=o("c641"),a=o.n(s);a.a},47267:function(t,e,o){},"709b":function(t,e,o){"use strict";o.d(e,"d",(function(){return a})),o.d(e,"c",(function(){return i})),o.d(e,"a",(function(){return r})),o.d(e,"e",(function(){return n})),o.d(e,"b",(function(){return l}));var s=o("b775");function a(t){return Object(s["a"])({url:"/Carousel/index",method:"get",params:t})}function i(t){return Object(s["a"])({url:"/Carousel/read",method:"get",params:{id:t}})}function r(t){return Object(s["a"])({url:"/Carousel/save",method:"post",data:t})}function n(t){return Object(s["a"])({url:"/Carousel/update?id="+t.id,method:"post",data:t})}function l(t){return Object(s["a"])({url:"/Carousel/delete?id="+t,method:"get"})}},"70a2":function(t,e,o){"use strict";var s=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"upload-container"},[o("el-upload",{staticClass:"image-uploader",attrs:{data:t.dataObj,multiple:!1,"show-file-list":!1,"on-success":t.handleImageSuccess,drag:"",action:"#","http-request":t.uploadImage}},[o("i",{staticClass:"el-icon-upload"}),o("div",{staticClass:"el-upload__text"},[t._v(" 将文件拖到此处,或"),o("em",[t._v("点击上传")])])]),o("div",{staticClass:"image-preview"},[o("div",{directives:[{name:"show",rawName:"v-show",value:t.coverImg.length>1,expression:"coverImg.length>1"}],staticClass:"image-preview-wrapper"},[o("img",{attrs:{src:t.coverImg}}),o("div",{staticClass:"image-preview-action"},[o("i",{staticClass:"el-icon-delete",on:{click:t.rmImage}})])])])],1)},a=[],i=o("b775");function r(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Object(i["a"])({url:"/upload/upload?uploadWx=".concat(e),method:"post",data:t})}var n={name:"SingleImageUpload3",props:{value:{type:String,default:""},wxUpload:{type:String,default:""}},data:function(){return{tempUrl:"",dataObj:{token:"",key:""},imgUrl:this.value}},computed:{coverImg:function(){return this.value}},methods:{rmImage:function(){this.emitInput("")},emitInput:function(t){this.$emit("input",t)},handleImageSuccess:function(t){this.emitInput(this.imgUrl)},beforeUpload:function(t){var e="image/jpeg"===t.type||"image/jpg",o=t.size/1024/1024<5;return e||this.$message.error("上传文件只能是图片格式!"),o||this.$message.error("上传文件大小不能超过 5MB!"),e&&o},uploadImage:function(t){var e=this;console.log(this.wxUpload),console.log(this.wxUpload.length);var o=new FormData;o.append("image",t.file),r(o,this.wxUpload.length>1).then((function(o){console.log("上传图片成功"),e.imgUrl=o.data.url,e.wxUpload.length>1&&e.$emit("wxMedia",e.wxUpload+"%llz%"+o.data.mediaId),t.onSuccess()})).catch((function(e){console.log("图片上传失败"),t.onError()}))}}},l=n,c=(o("f158"),o("2877")),u=Object(c["a"])(l,s,a,!1,null,"0c37ee6a",null);e["a"]=u.exports},"97af":function(t,e,o){"use strict";o.r(e);var s=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("article-detail",{attrs:{"is-edit":!0}})},a=[],i=o("061a"),r={name:"EditForm",components:{ArticleDetail:i["a"]}},n=r,l=o("2877"),c=Object(l["a"])(n,s,a,!1,null,null,null);e["default"]=c.exports},c641:function(t,e,o){},f158:function(t,e,o){"use strict";var s=o("47267"),a=o.n(s);a.a}}]);