1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-23f81ebc"],{2790:function(t,e,o){"use strict";o.r(e);var i=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("article-detail",{attrs:{"is-edit":!0}})},s=[],n=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:"advice",label:"建议"}},[o("el-input",{staticStyle:{width:"600px"},attrs:{placeholder:"",type:"textarea",rows:2},model:{value:t.postForm.advice,callback:function(e){t.$set(t.postForm,"advice",e)},expression:"postForm.advice"}})],1),o("el-form-item",{attrs:{prop:"mobile",label:"手机号"}},[o("el-input",{staticStyle:{width:"300px"},attrs:{placeholder:""},model:{value:t.postForm.mobile,callback:function(e){t.$set(t.postForm,"mobile",e)},expression:"postForm.mobile"}})],1),o("el-form-item",{attrs:{prop:"user_id",label:"用户id"}},[o("el-input",{staticStyle:{width:"100px"},attrs:{placeholder:""},model:{value:t.postForm.user_id,callback:function(e){t.$set(t.postForm,"user_id",e)},expression:"postForm.user_id"}})],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)},r=[],a=(o("d81d"),o("b0c0"),o("8039")),c=o("828d"),l={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},u={name:"ArticleDetail",components:{},props:{isEdit:{type:Boolean,default:!1}},data:function(){return{postForm:Object.assign({},l),loading:!1,userListOptions:[],rules:{},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;Object(a["b"])(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.$router.push("/advice/list")}))},updateArticle:function(){console.log(this.postForm),this.$router.push("/advice/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"})},getRemoteUserList:function(t){var e=this;Object(c["a"])(t).then((function(t){t.data.items&&(e.userListOptions=t.data.items.map((function(t){return t.name})))}))}}},d=u,m=(o("bc3c"),o("2877")),p=Object(m["a"])(d,n,r,!1,null,"70be0fd0",null),f=p.exports,h={name:"EditForm",components:{ArticleDetail:f}},b=h,v=Object(m["a"])(b,i,s,!1,null,null,null);e["default"]=v.exports},"3aff":function(t,e,o){},8039:function(t,e,o){"use strict";o.d(e,"c",(function(){return s})),o.d(e,"b",(function(){return n})),o.d(e,"a",(function(){return r}));var i=o("b775");function s(t){return Object(i["a"])({url:"/advice/index",method:"get",params:t})}function n(t){return Object(i["a"])({url:"/advice/read",method:"get",params:{id:t}})}function r(t){return Object(i["a"])({url:"/advice/delete?id="+t,method:"get"})}},"828d":function(t,e,o){"use strict";o.d(e,"a",(function(){return s}));var i=o("b775");function s(t){return Object(i["a"])({url:"/vue-element-admin/search/user",method:"get",params:{name:t}})}},bc3c:function(t,e,o){"use strict";var i=o("3aff"),s=o.n(i);s.a}}]);
|