text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-722d2c7c"],{"5a73":function(t,e,n){"use strict";n.r(e);var a=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"answer-edit"},[n("CreateHeader",{attrs:{title:"编辑回答","btn-text":"发布回答"},on:{save:t.save}}),n("div",{staticClass:"edit-body container-fluid bg-content of-hidden"},[n("div",{staticClass:"content h-100"},[t.answer.question?n("div",{staticClass:"input-title"},[n("el-input",{attrs:{placeholder:"请输入标题",disabled:""},model:{value:t.answer.question.title,callback:function(e){t.$set(t.answer.question,"title",e)},expression:"answer.question.title"}})],1):t._e(),n("markdown",{attrs:{url:"/upload/images/answer"},on:{change:t.change}})],1)])],1)},r=[],s=n("1da1"),c=(n("96cf"),n("0f06")),i=n("e6e0"),o=n("a7d3"),u={name:"AnswerEdit",components:{CreateHeader:c["a"],Markdown:i["a"]},props:{id:{type:String,default:""}},data:function(){return{answer:{content_md:"",content_html:""}}},watch:{$route:function(){this.getItemAnswer()}},mounted:function(){this.getItemAnswer()},methods:{getItemAnswer:function(){var t=this;return Object(s["a"])(regeneratorRuntime.mark((function e(){var n,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return n=t.id,e.next=3,o["a"].itemAnswer({id:n});case 3:a=e.sent,0===a.code&&(t.answer=a.data.answer,t.EventBus.$emit("set_content",t.answer.content_md));case 5:case"end":return e.stop()}}),e)})))()},save:function(){var t=this;return Object(s["a"])(regeneratorRuntime.mark((function e(){var n,a,r,s,c,i;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(n=t.answer,a=n.content_md,r=n.content_html,a&&r){e.next=3;break}return e.abrupt("return",t.$message.error("回答内容不能为空"));case 3:return s=t.id,c={content_md:a,content_html:r},e.next=7,o["a"].updateAnswer({id:s,data:c});case 7:i=e.sent,0===i.code&&(t.$message.success("更新回答成功"),t.$router.push("/question/".concat(t.answer.question._id)));case 9:case"end":return e.stop()}}),e)})))()},change:function(t){this.answer.content_md=t.content_md,this.answer.content_html=t.content_html}}},d=u,w=(n("a7bf"),n("2877")),l=Object(w["a"])(d,a,r,!1,null,"36c12f19",null);e["default"]=l.exports},"5dc1":function(t,e,n){},a7bf:function(t,e,n){"use strict";n("5dc1")},a7d3:function(t,e,n){"use strict";var a=n("b775");e["a"]={addAnswer:function(t){var e=t.questionId,n=t.data;return Object(a["a"])({url:"/".concat(e,"/answer"),method:"post",data:n})},updateAnswer:function(t){var e=t.id,n=t.data;return Object(a["a"])({url:"/answer/".concat(e),method:"put",data:n})},answerList:function(t){var e=t.questionId,n=t.params;return Object(a["a"])({url:"/".concat(e,"/answer"),method:"get",params:n})},itemAnswer:function(t){var e=t.id;return Object(a["a"])({url:"/answer/".concat(e),method:"get"})},delAnswer:function(t){var e=t.id;return Object(a["a"])({url:"/answer/".concat(e),method:"delete"})}}}}]);