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
11 KiB
1 line
11 KiB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-8afbc068"],{"20f9":function(t,e,n){"use strict";n("f7ba")},"333d":function(t,e,n){"use strict";var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticStyle:{"margin-top":"20px",display:"flex","flex-direction":"row-reverse"}},[n("el-pagination",{attrs:{background:"","hide-on-single-page":"",layout:"total, prev, pager, next, jumper","current-page":t.currentPage,"page-size":t.size,total:t.total},on:{"current-change":t.handleCurrentChange}})],1)},a=[],i=(n("a9e3"),{props:{currentPage:{type:Number,default:1},size:{type:Number,default:10},total:{type:Number,default:0}},data:function(){return{}},methods:{handleCurrentChange:function(t){this.$emit("currentChange",t)}}}),r=i,s=n("2877"),c=Object(s["a"])(r,o,a,!1,null,null,null);e["a"]=c.exports},"39bd":function(t,e,n){"use strict";var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"tree-container"},[n("div",{ref:"typeList",staticClass:"type-list"},[n("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 o=e.node,a=e.data;return n("span",{ref:"nodeId",staticClass:"custom-tree-node",on:{mousedown:function(e){return e.stopPropagation(),t.mouseFun(e,a,o)}}},[n("span",[t._v(t._s(o.label))])])}}])}),n("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)}}},[n("li",[t._v("新建")]),n("li",[t._v("删除")])])],1),n("el-dialog",{attrs:{title:"新增分类",visible:t.dialogFormVisible,width:"500px","append-to-body":""},on:{"update:visible":function(e){t.dialogFormVisible=e}}},[n("el-form",{ref:"form",attrs:{model:t.form}},[n("el-form-item",{attrs:{prop:"courseType",label:"名称","label-width":t.formLabelWidth,rules:{required:!0,message:"名称不能为空",trigger:"blur"}}},[n("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),n("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{attrs:{size:"small"},on:{click:function(e){t.dialogFormVisible=!1}}},[t._v("取 消")]),n("el-button",{attrs:{size:"small",type:"primary"},on:{click:function(e){return t.onSubmit("form")}}},[t._v("确 定")])],1)],1)],1)},a=[],i=n("aa2a"),r=(n("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,n){console.log(n.id),this.selectData=e,this.node=n,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))}}}),s={mixins:[r],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(i["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 n={parentId:e.selectData.sectionId,sectionName:e.form.courseType,createTime:(new Date).getTime(),sectionBeforeLogo:"",sectionDec:"",sectionId:++e.lastSectionId,sectionLevel:++e.selectData.sectionLevel,sectionLogo:""};console.log(n),Object(i["a"])(n).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(i["h"])().then((function(e){console.log(e),200===e.code?(t.typeList[0].childSection=e.data,t.getLastData(e.data)):console.log(e)}))}}},c=s,l=(n("20f9"),n("2877")),u=Object(l["a"])(c,o,a,!1,null,"193b9266",null);e["a"]=u.exports},"67d5":function(t,e,n){"use strict";n("af79")},a9e3:function(t,e,n){"use strict";var o=n("83ab"),a=n("da84"),i=n("94ca"),r=n("6eeb"),s=n("5135"),c=n("c6b6"),l=n("7156"),u=n("c04e"),d=n("d039"),f=n("7c73"),p=n("241c").f,h=n("06cf").f,g=n("9bf2").f,m=n("58a8").trim,b="Number",w=a[b],v=w.prototype,y=c(f(v))==b,I=function(t){var e,n,o,a,i,r,s,c,l=u(t,!1);if("string"==typeof l&&l.length>2)if(l=m(l),e=l.charCodeAt(0),43===e||45===e){if(n=l.charCodeAt(2),88===n||120===n)return NaN}else if(48===e){switch(l.charCodeAt(1)){case 66:case 98:o=2,a=49;break;case 79:case 111:o=8,a=55;break;default:return+l}for(i=l.slice(2),r=i.length,s=0;s<r;s++)if(c=i.charCodeAt(s),c<48||c>a)return NaN;return parseInt(i,o)}return+l};if(i(b,!w(" 0o1")||!w("0b1")||w("+0x1"))){for(var k,_=function(t){var e=arguments.length<1?0:t,n=this;return n instanceof _&&(y?d((function(){v.valueOf.call(n)})):c(n)!=b)?l(new w(I(e)),n,_):I(e)},x=o?p(w):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),D=0;x.length>D;D++)s(w,k=x[D])&&!s(_,k)&&g(_,k,h(w,k));_.prototype=v,v.constructor=_,r(a,b,_)}},aa2a:function(t,e,n){"use strict";n.d(e,"h",(function(){return a})),n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return r})),n.d(e,"f",(function(){return s})),n.d(e,"g",(function(){return c})),n.d(e,"e",(function(){return l})),n.d(e,"i",(function(){return u})),n.d(e,"j",(function(){return d})),n.d(e,"c",(function(){return f})),n.d(e,"k",(function(){return p})),n.d(e,"d",(function(){return h}));var o=n("b775");function a(){return Object(o["a"])({url:"/api/back/section/list/all",method:"get"})}function i(t){return Object(o["a"])({url:"/api/back/section/insert",method:"post",data:t})}function r(t){return Object(o["a"])({url:"/api/back/section/delete/"+t,method:"delete"})}function s(t,e,n){return Object(o["a"])({url:"/api/back/news/list/section?sectionId="+t+"&page="+e+"&size="+n,method:"get"})}function c(){return Object(o["a"])({url:"/api/back/common/upToken",method:"get"})}function l(t){return Object(o["a"])({url:"/api/back/news/"+t,method:"get"})}function u(t){return Object(o["a"])({url:"/api/back/news/insert",method:"post",data:t})}function d(t){return Object(o["a"])({url:"/api/back/newsPictures/insert",method:"post",data:t})}function f(t){return Object(o["a"])({url:"/api/back/news/delete/"+t,method:"delete",Id:t})}function p(t){return Object(o["a"])({url:"/api/back/news/update",method:"put",data:t})}function h(t){return Object(o["a"])({url:"/api/back/newsPictures/delete/"+t,method:"delete",Id:t})}},af79:function(t,e,n){},f7ba:function(t,e,n){},fd2f:function(t,e,n){"use strict";n.r(e);var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"container"},[n("div",{staticClass:"left"},[t._m(0),n("keep-alive",[n("typeList",{ref:"typeList",on:{change:t.typeMessage}})],1)],1),n("div",{staticClass:"right"},[n("div",{staticClass:"title"},[n("span",[t._v("新闻详情")]),n("el-button",{attrs:{icon:"el-icon-plus",type:"primary",size:"small"},on:{click:t.newBook}},[t._v("新建")])],1),n("el-table",{attrs:{data:t.tableData,size:"medium","empty-text":"暂无数据",border:""}},[n("el-table-column",{attrs:{align:"center",prop:"createTime",label:"时间","min-width":"130"},scopedSlots:t._u([{key:"default",fn:function(e){return[n("div",[t._v(t._s(t.getTimes(e.row.createTime)))])]}}])}),n("el-table-column",{attrs:{align:"center",prop:"newsLogo",label:"封面图","min-width":"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[""!==e.row.newsLogo?n("img",{attrs:{src:e.row.newsLogo,width:"50px",height:"50px"}}):t._e()]}}])}),n("el-table-column",{attrs:{align:"center",prop:"newsTitle",label:"标题","min-width":"200","show-overflow-tooltip":""}}),n("el-table-column",{attrs:{align:"center",prop:"newsDec",label:"内容","min-width":"200","show-overflow-tooltip":""}}),n("el-table-column",{attrs:{align:"center",prop:"sectionName",label:"板块","min-width":"200","show-overflow-tooltip":""}}),n("el-table-column",{attrs:{align:"center",label:"操作",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[n("el-link",{attrs:{underline:!1,type:"primary"},on:{click:function(n){return t.compileCourse(e.row.newsId)}}},[t._v("编辑")]),n("el-popconfirm",{attrs:{title:"您确定要删除吗?"},on:{onConfirm:function(n){return t.delCourse(e.row,e.$index)}}},[n("el-link",{staticStyle:{"margin-left":"10px"},attrs:{slot:"reference",underline:!1,type:"danger"},slot:"reference"},[t._v("删除")])],1)]}}])})],1),n("Pagination",{attrs:{currentPage:t.currentPage,size:t.size,total:t.total},on:{currentChange:t.currentChange}})],1)])},a=[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"title"},[n("span",[t._v("新闻类目")])])}],i=(n("d81d"),n("aa2a")),r=n("39bd"),s=n("333d"),c={inject:["reload"],name:"news",components:{typeList:r["a"],Pagination:s["a"]},data:function(){return{sectionId:"",breadcrumb:[],currentPage:1,size:10,total:0,tableData:[]}},methods:{currentChange:function(t){console.log(t),this.currentPage=t,this.getData(this.sectionId,this.currentPage,this.size)},getData:function(t,e,n){var o=this;Object(i["f"])(t,e,n).then((function(t){if(200===t.code){e>1&&!t.data.list.length&&(o.currentPage=--e,o.getData(o.sectionId,o.currentPage,o.size));var n=t.data.list.map((function(t){return t}));o.total=t.data.total,o.tableData=n}else console.log(t)}))},typeMessage:function(t){console.log(t),t.sectionId&&(this.sectionId=t.sectionId,this.currentPage=1,this.getData(this.sectionId,this.currentPage,this.size))},newBook:function(){this.$router.push("/addnews")},delCourse:function(t,e){var n=this;console.log(t),Object(i["c"])(t.newsId).then((function(t){console.log(t),200==t.code&&(n.$message.success("删除成功!"),n.getData(n.sectionId,n.currentPage,n.size))}))},compileCourse:function(t){this.$router.push({path:"/addnews",query:{id:t}})},getTimes:function(t){var e=new Date(t),n=e.getFullYear(),o=e.getMonth()+1;o=o<10?"0"+o:o;var a=e.getDate(),i=e.getHours();i=i<10?"0"+i:i;var r=e.getMinutes();r=r<10?"0"+r:r;var s=e.getSeconds();return s=s<10?"0"+s:s,n+"年"+o+"月"+a+"日"}}},l=c,u=(n("67d5"),n("2877")),d=Object(u["a"])(l,o,a,!1,null,"1fec5780",null);e["default"]=d.exports}}]); |