chunk-f924aed8.030f878e.js 5.1 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-f924aed8"],{"0687":function(e,t,r){"use strict";r.d(t,"c",function(){return s}),r.d(t,"e",function(){return u}),r.d(t,"a",function(){return l}),r.d(t,"d",function(){return c}),r.d(t,"b",function(){return d});var n=r("b775"),a=r("4328"),o=r.n(a),i="/api-cms";function s(e){return Object(n["a"])({url:i+"/news/list",method:"get",params:e})}function u(e){return Object(n["a"])({url:i+"/news/update",method:"post",data:o.a.stringify(e)})}function l(e){return Object(n["a"])({url:i+"/news/add",method:"post",data:o.a.stringify(e)})}function c(e){return Object(n["a"])({url:i+"/news/query",method:"get",params:e})}function d(e){return Object(n["a"])({url:i+"/news/del/"+e.id,method:"post",data:o.a.stringify(e)})}},"92ab":function(e,t,r){"use strict";var n=r("9a17"),a=r.n(n);a.a},"95c6":function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"m-container"},[r("h2",[r("el-page-header",{attrs:{content:("create"==e.pageType?"添加":"修改")+e.typeChange(e.type)},on:{back:e.onCancel}})],1),e._v(" "),r("div",{staticClass:"m-core"},[r("el-form",{ref:"form",staticStyle:{width:"100%"},attrs:{model:e.form,rules:e.rules,"label-width":"120px"}},[r("el-form-item",{attrs:{label:"标题",prop:"title"}},[r("el-input",{model:{value:e.form.title,callback:function(t){e.$set(e.form,"title",t)},expression:"form.title"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"链接地址",prop:"linkUrl"}},[r("el-input",{model:{value:e.form.linkUrl,callback:function(t){e.$set(e.form,"linkUrl",t)},expression:"form.linkUrl"}})],1),e._v(" "),r("el-form-item",{attrs:{label:"封面图",prop:"coverImage"}},[r("el-upload",{staticClass:"avatar-uploader",attrs:{action:"/api-web/uploadFile",headers:e.headers,"show-file-list":!1,"on-success":e.handleAvatarSuccess,"before-upload":e.beforeAvatarUpload}},[e.form.coverImage?r("img",{staticClass:"avatar",attrs:{src:e.form.coverImage}}):r("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),e._v(" "),r("el-form-item",{attrs:{label:"内容",prop:"content"}},[r("quill-editor",{ref:"myQuillEditor",attrs:{options:e.editorOption},on:{change:function(t){return e.onEditorChange(t)}},model:{value:e.form.content,callback:function(t){e.$set(e.form,"content",t)},expression:"form.content"}})],1),e._v(" "),r("el-form-item",[r("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.onSubmit("form")}}},[e._v("立即"+e._s("create"==e.pageType?"创建":"修改"))]),e._v(" "),r("el-button",{on:{click:function(t){return e.onReSet("form")}}},[e._v("重置")])],1)],1)],1)])},a=[],o=r("0687"),i=r("4360"),s=r("5f87"),u=(r("a753"),r("8096"),r("14e1"),r("953d")),l={components:{quillEditor:u["quillEditor"]},data:function(){return{categoryList:[],type:this.$route.query.type,pageType:this.$route.query.pageType,organId:i["a"].getters.organ,headers:{Authorization:Object(s["a"])()},content:null,editorOption:{},form:{title:null,order:0,coverImage:null,linkUrl:"http://mstudev.dayaedu.com/#/specialdetail",type:this.$route.query.type,status:1,content:null},rules:{title:[{required:!0,message:"请输入标题",trigger:"blur"},{min:2,max:30,message:"长度在 2 到 30 个字符",trigger:"blur"}],linkUrl:[{required:!0,message:"请输入连接地址",trigger:"blur"}],coverImage:[{required:!0,message:"请选择封面图",trigger:"blur"}],content:[{required:!0,message:"请编辑内容",trigger:"blur"}]}}},mounted:function(){this.getList()},methods:{onSubmit:function(e){var t=this;this.$refs[e].validate(function(e){if(!e)return!1;"create"==t.pageType?(t.form.id&&delete t.form.id,Object(o["a"])(t.form).then(function(e){t.messageTips("添加",e)})):"update"==t.pageType&&Object(o["e"])(t.form).then(function(e){t.messageTips("修改",e)})})},messageTips:function(e,t){200==t.code?(this.$message({message:e+"成功",type:"success"}),this.$router.push({path:"/contentManager/contentManager",query:{type:this.typeIndex(this.type)}})):this.$message.error(t.msg)},onCancel:function(){this.$router.push({path:"/contentManager/contentManager",query:{type:this.typeIndex(this.type)}})},onReSet:function(e){this.$refs[e].resetFields()},getList:function(){var e=this;if("create"==this.pageType)return!1;Object(o["d"])({id:this.$route.query.id}).then(function(t){if(200==t.code){var r=t.data;e.form;e.form={id:r.id,title:r.title,order:r.order,coverImage:r.coverImage,linkUrl:r.linkUrl,type:r.type,status:r.status,content:r.content}}})},handleAvatarSuccess:function(e,t){this.form.coverImage=e.data.url},beforeAvatarUpload:function(e){var t={"image/png":!0,"image/jpeg":!0},r=t[e.type],n=e.size/1024/1024<2;return r||this.$message.error("只能上传图片格式!"),n||this.$message.error("上传头像图片大小不能超过 2MB!"),r&&n},typeChange:function(e){var t={1:"精彩活动",2:"热门资讯",3:"活动列表",4:"专项训练"};return t[e]},typeIndex:function(e){var t={3:0,1:1,2:2,4:3};return t[e]},onEditorChange:function(e){e.quill;var t=e.html;e.text;this.form.content=t}},computed:{editor:function(){return this.$refs.myQuillEditor.quill}}},c=l,d=(r("92ab"),r("2877")),m=Object(d["a"])(c,n,a,!1,null,"2e9a5f08",null);t["default"]=m.exports},"9a17":function(e,t,r){}}]);