(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-a4ce3264"],{"03f2":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=[],r=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:{"label-position":t.labelPosition,model:t.postForm,rules:t.rules}},[o("div",{staticClass:"createPost-main-container"},[o("el-form-item",{attrs:{prop:"brand",label:"品牌介绍"}},[o("el-input",{staticStyle:{width:"800px"},attrs:{placeholder:"",type:"textarea",rows:3},model:{value:t.postForm.brand,callback:function(e){t.$set(t.postForm,"brand",e)},expression:"postForm.brand"}})],1),o("el-form-item",{attrs:{prop:"brand_desc",label:"品牌介绍详细"}},[o("el-input",{staticStyle:{width:"800px"},attrs:{type:"textarea",rows:3},model:{value:t.postForm.brand_desc,callback:function(e){t.$set(t.postForm,"brand_desc",e)},expression:"postForm.brand_desc"}})],1),o("el-form-item",{attrs:{prop:"brand_product",label:"品牌产品"}},[o("el-input",{staticStyle:{width:"600px"},attrs:{type:"textarea",rows:10},model:{value:t.postForm.brand_product,callback:function(e){t.$set(t.postForm,"brand_product",e)},expression:"postForm.brand_product"}})],1),o("el-form-item",{attrs:{prop:"brand_lc",label:"品牌历程"}},[o("el-input",{staticStyle:{width:"600px"},attrs:{placeholder:"",type:"textarea",rows:10},model:{value:t.postForm.brand_lc,callback:function(e){t.$set(t.postForm,"brand_lc",e)},expression:"postForm.brand_lc"}})],1),o("el-form-item",{attrs:{prop:"brand_dw",label:"品牌定位"}},[o("el-input",{staticStyle:{width:"600px"},attrs:{placeholder:"",type:"textarea",rows:3},model:{value:t.postForm.brand_dw,callback:function(e){t.$set(t.postForm,"brand_dw",e)},expression:"postForm.brand_dw"}})],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)},n=[],i=(o("d81d"),o("b0c0"),o("b775"));function l(t){return Object(i["a"])({url:"/brand/read",method:"get",params:{id:t}})}function c(t){return Object(i["a"])({url:"/brand/update?id="+t.id,method:"post",data:t})}function d(t){return Object(i["a"])({url:"/vue-element-admin/search/user",method:"get",params:{name:t}})}var p={status:"draft",title:"",content:"",content_short:"",video_url:"",cover_img:"",display_time:void 0,id:void 0,platforms:["a-platform"],comment_disabled:!1,importance:0},m={name:"ArticleDetail",components:{},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({},p),loading:!1,userListOptions:[],rules:{sort:[{message:"排序不为空",validator:e}],question:[{message:"问题不为空",validator:e}],answer:[{message:"回答不为空",validator:e}]},tempRoute:{},labelPosition:"top"}},computed:{contentShortLength:function(){return this.postForm.content_short.length},displayTime:{get:function(){return+new Date(this.postForm.display_time)},set:function(t){this.postForm.display_time=new Date(t)}}},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;l(t).then((function(t){e.postForm=t.data.info})).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)}))},updateArticle:function(){var t=this;console.log(this.postForm),c(this.postForm).then((function(e){t.$notify({title:"修改",message:"修改成功",type:"success",duration:2e3}),t.postForm.status="published",t.loading=!1,t.listLoading=!1}))},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"})},getRemoteUserList:function(t){var e=this;d(t).then((function(t){t.data.items&&(e.userListOptions=t.data.items.map((function(t){return t.name})))}))}}},u=m,f=(o("07fe"),o("2877")),h=Object(f["a"])(u,r,n,!1,null,"0e8db28a",null),b=h.exports,g={name:"EditForm",components:{ArticleDetail:b}},v=g,F=Object(f["a"])(v,s,a,!1,null,null,null);e["default"]=F.exports},"07fe":function(t,e,o){"use strict";var s=o("caea"),a=o.n(s);a.a},caea:function(t,e,o){}}]);