You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
20 KiB
1 line
20 KiB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-59ff9a60"],{"20f9":function(t,e,o){"use strict";o("f7ba")},"2f80":function(t,e,o){"use strict";o.r(e);var n=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"container"},[o("el-form",{ref:"form",staticClass:"form",attrs:{model:t.form,"label-width":"100px",size:"small"}},[o("el-form-item",{attrs:{label:"标题",prop:"newsTitle"}},[o("el-input",{model:{value:t.form.newsTitle,callback:function(e){t.$set(t.form,"newsTitle",e)},expression:"form.newsTitle"}})],1),o("el-form-item",{attrs:{label:"简介",prop:"newsDec"}},[o("el-input",{model:{value:t.form.newsDec,callback:function(e){t.$set(t.form,"newsDec",e)},expression:"form.newsDec"}})],1),o("el-form-item",{attrs:{label:"板块",prop:"sectionName"}},[o("div",{staticStyle:{display:"flex","align-items":"center"}},[o("el-input",{attrs:{placeholder:"请点击右侧按钮选择分类",readonly:""},model:{value:t.form.sectionName,callback:function(e){t.$set(t.form,"sectionName",e)},expression:"form.sectionName"}}),o("el-button",{staticStyle:{"margin-left":"20px"},on:{click:function(e){t.dialogFormVisible=!0}}},[t._v("选择分类")])],1)]),o("el-form-item",{attrs:{label:"封面图片"}},[o("el-upload",{staticClass:"avatar-uploader",attrs:{data:t.upToken,action:t.action,"show-file-list":!1,"on-success":t.handleAvatarSuccess,"before-upload":t.beforeAvatarUpload}},[t.form.newsLogo?o("img",{staticClass:"avatar",attrs:{src:t.form.newsLogo}}):o("i",{staticClass:"el-icon-plus avatar-uploader-icon"})])],1),o("el-form-item",{attrs:{label:"内容",prop:"newsContent"}},[o("edittwo",{ref:"edithtmltwo"})],1),o("el-form-item",{attrs:{label:"样式",prop:"newsType"}},[o("el-radio",{attrs:{label:1},model:{value:t.form.newsType,callback:function(e){t.$set(t.form,"newsType",e)},expression:"form.newsType"}},[t._v("样式一")]),o("el-radio",{attrs:{label:2},model:{value:t.form.newsType,callback:function(e){t.$set(t.form,"newsType",e)},expression:"form.newsType"}},[t._v("样式二")])],1),2==t.form.newsType?o("el-form-item",{attrs:{label:"配图"}},[o("el-upload",{staticClass:"ava",attrs:{data:t.upToken,action:t.action,"show-file-list":!1,"on-success":t.handleAvatarSuccess2,"before-upload":t.beforeAvatarUpload}},[o("div",{staticStyle:{"text-align":"left"}},[t.formData.length<7?o("el-button",[t._v("点击上传")]):t._e()],1),o("div",{staticClass:"imgbox"},t._l(t.formData,(function(e,n){return o("div",{key:n,staticClass:"picbox"},[o("span",{on:{click:function(o){return o.stopPropagation(),t.yichuimg(e,n)}}},[t._v("移除")]),o("img",{directives:[{name:"show",rawName:"v-show",value:t.formData.length>0,expression:"formData.length>0"}],staticClass:"avatar",attrs:{src:e.picUrl}})])})),0)])],1):t._e(),o("el-form-item",[o("el-button",{attrs:{type:"primary",loading:t.submitSta},on:{click:function(e){return t.submitForm()}}},[t._v("保存")])],1)],1),o("el-dialog",{attrs:{title:"选择分类",visible:t.dialogFormVisible,width:"400px"},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[o("typeList",{attrs:{list:t.courseTypeList,status:!1},on:{change:t.typeMessage}}),o("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{attrs:{size:"small"},on:{click:function(e){t.dialogFormVisible=!1}}},[t._v("取 消")]),o("el-button",{attrs:{size:"small",type:"primary"},on:{click:function(e){t.dialogFormVisible=!1}}},[t._v("确 定")])],1)],1)],1)},i=[],s=(o("a434"),o("b0c0"),o("aa2a")),a=o("39bd"),l=o("c651"),r={name:"addnews",components:{typeList:a["a"],edittwo:l["a"]},data:function(){return{type:1,formData:[],domain:"",action:"http://upload-z2.qiniup.com",fileList:[],submitSta:!1,upToken:{},dialogFormVisible:!1,typeName:"",courseTypeList:[],form:{newsTitle:"",newsLogo:"",newsContent:"",newsDec:"",newsType:1,sectionName:"",isValid:0,sectionId:"",sectionLogo:""}}},methods:{change:function(t){console.log(t)},yichuimg:function(t,e){var o=this;1==this.type?(this.formData.splice(e,1),console.log(this.formData)):2==this.type&&(this.formData.splice(e,1),t.picId&&Object(s["d"])(t.picId).then((function(t){200==t&&console.log("移除成功",o.formData)})))},typeMessage:function(t){if(-1===t.id)return!1;this.form.sectionName=t.sectionName,this.form.sectionId=t.sectionId,this.form.sectionLogo=t.sectionLogo},beforeAvatarUpload:function(t){},handlePictureCardPreview:function(t){this.dialogImageUrl=t.url,this.dialogVisible=!0},uploadSuccess3:function(t,e){console,log(t)},handleAvatarSuccess2:function(t){console.log(t),this.formData.push({picUrl:this.domain+t.key}),console.log(this.formData)},handleAvatarSuccess:function(t){console.log(t),this.form.newsLogo=this.domain+t.key,console.log("上传成功")},imgPreview:function(t,e){var o=t.name,n=/(.jpg|.jpeg|.gif|.png|.bmp)$/;n.test(o.toLowerCase())?this.form.silder_image=t.url:this.$message.error("请选择图片文件"),console.log("图片上传事件"),this.form.silderimgList=[];for(var i=0;i<e.length;i++){var s={};s=e[i].raw,this.form.silderimgList.push(s)}this.form.name=e[0].raw,console.log(t,e),console.log(this.form.silderimgList),console.log("图片上传事件")},getTimes:function(t){var e=new Date(t),o=e.getFullYear(),n=e.getMonth()+1;n=n<10?"0"+n:n;var i=e.getDate(),s=e.getHours();s=s<10?"0"+s:s;var a=e.getMinutes();a=a<10?"0"+a:a;var l=e.getSeconds();return l=l<10?"0"+l:l,o+"年"+n+"月"+i+"日"},submitForm:function(){var t=this;console.log(this.formData),this.form.newsContent=this.$refs.edithtmltwo.content,this.form.newsTitle?this.form.newsContent?1==this.type?(console.log(this.form),Object(s["i"])(this.form).then((function(e){200==e.code?(t.commitpic(e.data.newsId),t.$message.success("保存成功!"),t.$router.go(-1)):t.$message.error("保存失败!")}))):2==this.type&&(console.log(this.form),Object(s["k"])(this.form).then((function(e){if(200==e.code){if(2==t.form.newsType){console.log(t.formData);for(var o=0;o<t.formData.length;o++)if(console.log(t.formData[o]),!t.formData[o].picId){var n={newsId:e.data.newsId,picUrl:t.formData[o].picUrl};Object(s["j"])(n).then((function(t){console.log("图片上传成功",t)}))}}t.$message.success("编辑成功!"),t.$router.go(-1)}else t.$message.error("保辑失败!")}))):this.$message.warning("富文本内容不能为空!"):this.$message.warning("标题不能为空!")},commitpic:function(t){for(var e=0;e<this.formData.length;e++){var o={newsId:t,picUrl:this.formData[e].picUrl};console.log(o),Object(s["j"])(o).then((function(t){console.log("图片上传成功",t)}))}}},created:function(){var t=this;Object(s["h"])().then((function(e){console.log(t.courseTypeList),t.courseTypeList=e.data,console.log("数组",t.typeList)})),Object(s["g"])().then((function(e){t.domain=e.data.domain+"/",t.upToken.token=e.data.upToken}));var e=this.$route.query.id;console.log(e),e&&(this.type=2,Object(s["e"])(e).then((function(e){console.log("新闻详情",e),t.form=e.data,t.formData=e.data.picList,t.$refs.edithtmltwo.content=t.form.newsContent,console.log("新闻类型",t.form.newsType)})))}},c=r,u=(o("3593"),o("2877")),d=Object(u["a"])(c,n,i,!1,null,"6a25bf9b",null);e["default"]=d.exports},3593:function(t,e,o){"use strict";o("9868")},"39bd":function(t,e,o){"use strict";var n=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"tree-container"},[o("div",{ref:"typeList",staticClass:"type-list"},[o("el-tree",{ref:"tree",attrs:{data:t.typeList,props:t.defaultProps,accordion:"","filter-node-method":t.filterNode,"node-key":"id","default-expanded-keys":[-1]},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.node,i=e.data;return o("span",{ref:"nodeId",staticClass:"custom-tree-node",on:{mousedown:function(e){return e.stopPropagation(),t.mouseFun(e,i,n)}}},[o("span",[t._v(t._s(n.label))])])}}])}),o("ul",{directives:[{name:"show",rawName:"v-show",value:t.show,expression:"show"}],staticClass:"context-menu",style:t.styleObj,on:{mousedown:function(e){return e.stopPropagation(),t.operation(e)}}},[o("li",[t._v("新建")]),o("li",[t._v("删除")])])],1),o("el-dialog",{attrs:{title:"新增分类",visible:t.dialogFormVisible,width:"500px","append-to-body":""},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[o("el-form",{ref:"form",attrs:{model:t.form}},[o("el-form-item",{attrs:{prop:"courseType",label:"名称","label-width":t.formLabelWidth,rules:{required:!0,message:"名称不能为空",trigger:"blur"}}},[o("el-input",{staticStyle:{width:"280px"},attrs:{size:"small"},model:{value:t.form.courseType,callback:function(e){t.$set(t.form,"courseType",e)},expression:"form.courseType"}})],1)],1),o("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{attrs:{size:"small"},on:{click:function(e){t.dialogFormVisible=!1}}},[t._v("取 消")]),o("el-button",{attrs:{size:"small",type:"primary"},on:{click:function(e){return t.onSubmit("form")}}},[t._v("确 定")])],1)],1)],1)},i=[],s=o("aa2a"),a=(o("4de4"),{props:{list:Array,status:""},data:function(){return{filterText:"",selectData:"",node:"",styleObj:{left:"",top:""},formLabelWidth:"100px",dialogFormVisible:!1,show:!1}},watch:{filterText:function(t){this.$refs.tree.filter(t)}},mounted:function(){this.$refs.typeList.oncontextmenu=function(t){t.preventDefault()}},activated:function(){var t=this;document.onmousedown=function(e){t.show&&(t.show=!1)}},deactivated:function(){document.onmousedown=null},methods:{mouseFun:function(t,e,o){console.log(o.id),this.selectData=e,this.node=o,2===t.button?!1!==this.status&&(this.show=!0,this.styleObj={left:t.clientX+10+"px",top:t.clientY+"px"}):0===t.button&&(this.show=!1,this.$emit("change",e))}}}),l={mixins:[a],data:function(){return{typeList:[{id:-1,levelId:0,sectionName:"全部分类",childSection:[]}],form:{courseType:""},defaultProps:{label:"sectionName",children:"childSection"},lastSectionId:0}},created:function(){this.getData()},methods:{filterNode:function(t,e){return!t||-1!==e.courseType.indexOf(t)},operation:function(t){var e=this;0===t.button&&("新建"===t.srcElement.textContent?this.dialogFormVisible=!0:this.$confirm("此操作将删除该分类, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning",center:!0}).then((function(){if(-1===e.selectData.id)return e.$message.error("无法删除一级分类!"),!1;e.selectData.childSection&&0!==e.selectData.childSection.length?e.$message.warning("请先删除子类"):Object(s["b"])(e.selectData.sectionId).then((function(t){console.log(t),200===t.code?(e.getData(),e.$message.success("删除成功!")):console.log(t)}))})).catch((function(){})),this.show=!1)},onSubmit:function(t){var e=this;this.$refs[t].validate((function(t){if(!t)return!1;var o={parentId:e.selectData.sectionId,sectionName:e.form.courseType,createTime:(new Date).getTime(),sectionBeforeLogo:"",sectionDec:"",sectionId:++e.lastSectionId,sectionLevel:++e.selectData.sectionLevel,sectionLogo:""};console.log(o),Object(s["a"])(o).then((function(t){console.log(t),200===t.code?e.getData():console.log(t)})),e.dialogFormVisible=!1,e.form={}}))},getLastData:function(t){t.length&&(t[t.length-1].childSection.length?this.getLastData(t[t.length-1].childSection):(this.lastSectionId=t[t.length-1].sectionId,console.log(this.lastSectionId)))},getData:function(){var t=this;Object(s["h"])().then((function(e){console.log(e),200===e.code?(t.typeList[0].childSection=e.data,t.getLastData(e.data)):console.log(e)}))}}},r=l,c=(o("20f9"),o("2877")),u=Object(c["a"])(r,n,i,!1,null,"193b9266",null);e["a"]=u.exports},"953d":function(t,e,o){!function(e,n){t.exports=n(o("9339"))}(0,(function(t){return function(t){function e(n){if(o[n])return o[n].exports;var i=o[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var o={};return e.m=t,e.c=o,e.i=function(t){return t},e.d=function(t,o,n){e.o(t,o)||Object.defineProperty(t,o,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var o=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(o,"a",o),o},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=2)}([function(e,o){e.exports=t},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=o(4),i=o.n(n),s=o(6),a=o(5),l=a(i.a,s.a,!1,null,null,null);e.default=l.exports},function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.install=e.quillEditor=e.Quill=void 0;var i=o(0),s=n(i),a=o(1),l=n(a),r=window.Quill||s.default,c=function(t,e){e&&(l.default.props.globalOptions.default=function(){return e}),t.component(l.default.name,l.default)},u={Quill:r,quillEditor:l.default,install:c};e.default=u,e.Quill=r,e.quillEditor=l.default,e.install=c},function(t,e,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={theme:"snow",boundary:document.body,modules:{toolbar:[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["clean"],["link","image","video"]]},placeholder:"Insert text here ...",readOnly:!1}},function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=o(0),s=n(i),a=o(3),l=n(a),r=window.Quill||s.default;"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var o=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(o[s]=i[s])}return o},writable:!0,configurable:!0}),e.default={name:"quill-editor",data:function(){return{_options:{},_content:"",defaultOptions:l.default}},props:{content:String,value:String,disabled:{type:Boolean,default:!1},options:{type:Object,required:!1,default:function(){return{}}},globalOptions:{type:Object,required:!1,default:function(){return{}}}},mounted:function(){this.initialize()},beforeDestroy:function(){this.quill=null,delete this.quill},methods:{initialize:function(){var t=this;this.$el&&(this._options=Object.assign({},this.defaultOptions,this.globalOptions,this.options),this.quill=new r(this.$refs.editor,this._options),this.quill.enable(!1),(this.value||this.content)&&this.quill.pasteHTML(this.value||this.content),this.disabled||this.quill.enable(!0),this.quill.on("selection-change",(function(e){e?t.$emit("focus",t.quill):t.$emit("blur",t.quill)})),this.quill.on("text-change",(function(e,o,n){var i=t.$refs.editor.children[0].innerHTML,s=t.quill,a=t.quill.getText();"<p><br></p>"===i&&(i=""),t._content=i,t.$emit("input",t._content),t.$emit("change",{html:i,text:a,quill:s})})),this.$emit("ready",this.quill))}},watch:{content:function(t,e){this.quill&&(t&&t!==this._content?(this._content=t,this.quill.pasteHTML(t)):t||this.quill.setText(""))},value:function(t,e){this.quill&&(t&&t!==this._content?(this._content=t,this.quill.pasteHTML(t)):t||this.quill.setText(""))},disabled:function(t,e){this.quill&&this.quill.enable(!t)}}}},function(t,e){t.exports=function(t,e,o,n,i,s){var a,l=t=t||{},r=typeof t.default;"object"!==r&&"function"!==r||(a=t,l=t.default);var c,u="function"==typeof l?l.options:l;if(e&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0),o&&(u.functional=!0),i&&(u._scopeId=i),s?(c=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),n&&n.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=c):n&&(c=n),c){var d=u.functional,f=d?u.render:u.beforeCreate;d?(u._injectStyles=c,u.render=function(t,e){return c.call(e),f(t,e)}):u.beforeCreate=f?[].concat(f,c):[c]}return{esModule:a,exports:l,options:u}}},function(t,e,o){"use strict";var n=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"quill-editor"},[t._t("toolbar"),t._v(" "),o("div",{ref:"editor"})],2)},i=[],s={render:n,staticRenderFns:i};e.a=s}])}))},9868:function(t,e,o){},a434:function(t,e,o){"use strict";var n=o("23e7"),i=o("23cb"),s=o("a691"),a=o("50c4"),l=o("7b0b"),r=o("65f0"),c=o("8418"),u=o("1dde"),d=o("ae40"),f=u("splice"),m=d("splice",{ACCESSORS:!0,0:0,1:2}),p=Math.max,h=Math.min,g=9007199254740991,b="Maximum allowed length exceeded";n({target:"Array",proto:!0,forced:!f||!m},{splice:function(t,e){var o,n,u,d,f,m,v=l(this),w=a(v.length),y=i(t,w),_=arguments.length;if(0===_?o=n=0:1===_?(o=0,n=w-y):(o=_-2,n=h(p(s(e),0),w-y)),w+o-n>g)throw TypeError(b);for(u=r(v,n),d=0;d<n;d++)f=y+d,f in v&&c(u,d,v[f]);if(u.length=n,o<n){for(d=y;d<w-n;d++)f=d+n,m=d+o,f in v?v[m]=v[f]:delete v[m];for(d=w;d>w-n+o;d--)delete v[d-1]}else if(o>n)for(d=w-n;d>y;d--)f=d+n-1,m=d+o-1,f in v?v[m]=v[f]:delete v[m];for(d=0;d<o;d++)v[d+y]=arguments[d+2];return v.length=w-n+o,u}})},aa2a:function(t,e,o){"use strict";o.d(e,"h",(function(){return i})),o.d(e,"a",(function(){return s})),o.d(e,"b",(function(){return a})),o.d(e,"f",(function(){return l})),o.d(e,"g",(function(){return r})),o.d(e,"e",(function(){return c})),o.d(e,"i",(function(){return u})),o.d(e,"j",(function(){return d})),o.d(e,"c",(function(){return f})),o.d(e,"k",(function(){return m})),o.d(e,"d",(function(){return p}));var n=o("b775");function i(){return Object(n["a"])({url:"/api/back/section/list/all",method:"get"})}function s(t){return Object(n["a"])({url:"/api/back/section/insert",method:"post",data:t})}function a(t){return Object(n["a"])({url:"/api/back/section/delete/"+t,method:"delete"})}function l(t,e,o){return Object(n["a"])({url:"/api/back/news/list/section?sectionId="+t+"&page="+e+"&size="+o,method:"get"})}function r(){return Object(n["a"])({url:"/api/back/common/upToken",method:"get"})}function c(t){return Object(n["a"])({url:"/api/back/news/"+t,method:"get"})}function u(t){return Object(n["a"])({url:"/api/back/news/insert",method:"post",data:t})}function d(t){return Object(n["a"])({url:"/api/back/newsPictures/insert",method:"post",data:t})}function f(t){return Object(n["a"])({url:"/api/back/news/delete/"+t,method:"delete",Id:t})}function m(t){return Object(n["a"])({url:"/api/back/news/update",method:"put",data:t})}function p(t){return Object(n["a"])({url:"/api/back/newsPictures/delete/"+t,method:"delete",Id:t})}},c651:function(t,e,o){"use strict";var n=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",[o("el-upload",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],staticClass:"avatar-uploader quill-img",attrs:{action:"http://upload-z2.qiniup.com",data:t.upToken,"show-file-list":!1,"on-success":t.uploadSuccess}}),o("quill-editor",{ref:"myQuillEditor",staticClass:"editor",attrs:{options:t.editorOption},on:{change:function(e){return t.onEditorChange(e)}},model:{value:t.content,callback:function(e){t.content=e},expression:"content"}})],1)},i=[],s=o("aa2a"),a=o("953d"),l=(o("a753"),o("8096"),o("14e1"),{name:"edittwo",components:{quillEditor:a["quillEditor"]},data:function(){return{upToken:{},domain:"",content:null,editorOption:{placeholder:"请输入",theme:"snow",modules:{toolbar:{container:[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["clean"],["link","image"]],handlers:{image:function(t){t?document.querySelector(".quill-img input").click():this.quill.format("image",!1)}}}}}}},created:function(){var t=this;Object(s["g"])().then((function(e){t.domain=e.data.domain+"/",t.upToken.token=e.data.upToken}))},methods:{onEditorChange:function(t){var e=t.html;console.log(e),this.content=e},uploadSuccess:function(t){console.log(t);var e=this.$refs.myQuillEditor.quill;e.focus(),e.insertEmbed(e.getSelection().index,"image",this.domain+t.key)}}}),r=l,c=o("2877"),u=Object(c["a"])(r,n,i,!1,null,"4fb5e431",null);e["a"]=u.exports},f7ba:function(t,e,o){}}]); |