webpackJsonp([45],{"+M99":function(e,t){},"0WHX":function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=a("mvHQ"),l=a.n(r),o=(a("ftAF"),{created:function(){var e=this;this.$route.query.id&&this.$http.get({url:"/newsInfo/getOne",data:{id:this.$route.query.id}}).then(function(t){t.success&&(t.data.newsType=String(t.data.newsType),e.formData=t.data)})},data:function(){return{saving:!1,formData:{newsType:"0",recommend:"N"},rules:{title:[{required:!0,message:"请输入标题",trigger:"blur"}],image:[{required:!0,message:"请上传图片",trigger:"blur"}],newsUrl:[{required:!0,message:"请输入地址",trigger:"blur"}]}}},methods:{onSave:function(){var e=this;this.$refs.form.validate(function(t){if(!t)return!1;e.submit()})},submit:function(){var e=this,t=JSON.parse(l()(this.formData));delete t.createTime,delete t.updateTime,this.$http.post({url:this.formData.id?"/newsInfo/update":"/newsInfo/save",data:t}).then(function(t){t.success?(e.$message.success("成功"),e.$router.go(-1)):e.$message.warning("失败")})},onDelete:function(){var e=this;this.$alert("删除将无法恢复，确认要删除么？","警告",{type:"error"}).then(function(){return e.$http.post({url:"/newsInfo/del",data:{id:e.formData.id}})}).then(function(){e.$message.success("删除成功"),e.$router.go(-1)}).catch(function(t){"cancel"===t?e.$message.info("删除取消"):e.$message.error("删除失败")})}}}),s={render:function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("el-form",{ref:"form",staticStyle:{"max-width":"500px"},attrs:{model:e.formData,rules:e.rules,"label-width":"80px","label-position":"right",size:"small"}},[a("el-form-item",{attrs:{prop:"newsType",label:"类型"}},[a("el-select",{staticClass:"filter-item",attrs:{placeholder:"类型",size:"small"},model:{value:e.formData.newsType,callback:function(t){e.$set(e.formData,"newsType",t)},expression:"formData.newsType"}},[a("el-option",{attrs:{label:"攻略指南",value:"0"}}),e._v(" "),a("el-option",{attrs:{label:"新鲜资讯",value:"1"}})],1)],1),e._v(" "),a("el-form-item",{attrs:{prop:"title",label:"标题"}},[a("el-input",{model:{value:e.formData.title,callback:function(t){e.$set(e.formData,"title",t)},expression:"formData.title"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"subtitle",label:"副标题"}},[a("el-input",{model:{value:e.formData.subtitle,callback:function(t){e.$set(e.formData,"subtitle",t)},expression:"formData.subtitle"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"image",label:"图片"}},[a("single-upload",{model:{value:e.formData.image,callback:function(t){e.$set(e.formData,"image",t)},expression:"formData.image"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"newsUrl",label:"地址"}},[a("el-input",{model:{value:e.formData.newsUrl,callback:function(t){e.$set(e.formData,"newsUrl",t)},expression:"formData.newsUrl"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"rank",label:"排序"}},[a("el-input",{model:{value:e.formData.rank,callback:function(t){e.$set(e.formData,"rank",t)},expression:"formData.rank"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"hot",label:"热度"}},[a("el-input",{model:{value:e.formData.hot,callback:function(t){e.$set(e.formData,"hot",t)},expression:"formData.hot"}})],1),e._v(" "),a("el-form-item",{attrs:{prop:"recommend",label:"推荐"}},[a("el-select",{staticClass:"filter-item",attrs:{placeholder:"是否推荐",size:"small"},model:{value:e.formData.recommend,callback:function(t){e.$set(e.formData,"recommend",t)},expression:"formData.recommend"}},[a("el-option",{attrs:{label:"推荐",value:"Y"}}),e._v(" "),a("el-option",{attrs:{label:"不推荐",value:"N"}})],1)],1),e._v(" "),a("el-form-item",[a("el-button",{attrs:{loading:e.$store.state.fetchingData,type:"primary"},on:{click:e.onSave}},[e._v("保存")]),e._v(" "),e.formData.id?a("el-button",{attrs:{type:"danger"},on:{click:e.onDelete}},[e._v("删除")]):e._e(),e._v(" "),a("el-button",{on:{click:function(t){e.$router.go(-1)}}},[e._v("取消")])],1)],1)],1)},staticRenderFns:[]};var n=a("VU/8")(o,s,!1,function(e){a("+M99")},"data-v-4626f4b9",null);t.default=n.exports}});
//# sourceMappingURL=45.0e0ebe8cc053ea1ed426.js.map