You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sonic/resources/admin/js/361.2f0bb9f1.js

1 line
28 KiB
JavaScript

(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[361],{53303:function(t,e,s){var a=s(15820),n=Math.floor,r=function(t,e){var s=t.length,l=n(s/2);return s<8?i(t,e):o(t,r(a(t,0,l),e),r(a(t,l),e),e)},i=function(t,e){var s,a,n=t.length,r=1;while(r<n){a=r,s=t[r];while(a&&e(t[a-1],s)>0)t[a]=t[--a];a!==r++&&(t[a]=s)}return t},o=function(t,e,s,a){var n=e.length,r=s.length,i=0,o=0;while(i<n||o<r)t[i+o]=i<n&&o<r?a(e[i],s[o])<=0?e[i++]:s[o++]:i<n?e[i++]:s[o++];return t};t.exports=r},52103:function(t,e,s){var a=s(82678),n=a.match(/firefox\/(\d+)/i);t.exports=!!n&&+n[1]},76044:function(t,e,s){var a=s(82678);t.exports=/MSIE|Trident/.test(a)},97551:function(t,e,s){var a=s(82678),n=a.match(/AppleWebKit\/(\d+)\./);t.exports=!!n&&+n[1]},19003:function(t,e,s){"use strict";var a=s(79644),n=s(33691),r=s(77925),i=s(43207),o=s(71768),l=s(43150),u=s(32640),c=s(53303),d=s(29415),p=s(52103),h=s(76044),f=s(3718),m=s(97551),g=[],v=n(g.sort),y=n(g.push),S=u((function(){g.sort(void 0)})),k=u((function(){g.sort(null)})),b=d("sort"),x=!u((function(){if(f)return f<70;if(!(p&&p>3)){if(h)return!0;if(m)return m<603;var t,e,s,a,n="";for(t=65;t<76;t++){switch(e=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:s=3;break;case 68:case 71:s=4;break;default:s=2}for(a=0;a<47;a++)g.push({k:e+a,v:s})}for(g.sort((function(t,e){return e.v-t.v})),a=0;a<g.length;a++)e=g[a].k.charAt(0),n.charAt(n.length-1)!==e&&(n+=e);return"DGBEFHACIJK"!==n}})),C=S||!k||!b||!x,w=function(t){return function(e,s){return void 0===s?-1:void 0===e?1:void 0!==t?+t(e,s)||0:l(e)>l(s)?1:-1}};a({target:"Array",proto:!0,forced:C},{sort:function(t){void 0!==t&&r(t);var e=i(this);if(x)return void 0===t?v(e):v(e,t);var s,a,n=[],l=o(e);for(a=0;a<l;a++)a in e&&y(n,e[a]);c(n,w(t)),s=n.length,a=0;while(a<s)e[a]=n[a++];while(a<l)delete e[a++];return e}})},66776:function(t,e,s){var a=s(79644),n=s(8432),r=s(15532),i=s(70305),o=s(33691),l=s(32640),u=n.Array,c=r("JSON","stringify"),d=o(/./.exec),p=o("".charAt),h=o("".charCodeAt),f=o("".replace),m=o(1..toString),g=/[\uD800-\uDFFF]/g,v=/^[\uD800-\uDBFF]$/,y=/^[\uDC00-\uDFFF]$/,S=function(t,e,s){var a=p(s,e-1),n=p(s,e+1);return d(v,t)&&!d(y,n)||d(y,t)&&!d(v,a)?"\\u"+m(h(t,0),16):t},k=l((function(){return'"\\udf06\\ud834"'!==c("\udf06\ud834")||'"\\udead"'!==c("\udead")}));c&&a({target:"JSON",stat:!0,forced:k},{stringify:function(t,e,s){for(var a=0,n=arguments.length,r=u(n);a<n;a++)r[a]=arguments[a];var o=i(c,null,r);return"string"==typeof o?f(o,g,S):o}})},89361:function(t,e,s){"use strict";s.r(e),s.d(e,{default:function(){return T}});var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("page-view",[s("PostListView",{ref:"postListView",attrs:{columns:t.postColumns,"default-statuses":[t.postStatuses.PUBLISHED.value,t.postStatuses.DRAFT.value,t.postStatuses.INTIMATE.value]},on:{"change:params":t.onChangeParams},scopedSlots:t._u([{key:"operator-before",fn:function(){return[s("router-link",{attrs:{to:{name:"PostWrite"}}},[s("a-button",{attrs:{icon:"plus",type:"primary"}},[t._v("写文章")])],1)]},proxy:!0},{key:"operator-after",fn:function(){return[s("a-button",{attrs:{icon:"delete"},on:{click:function(e){t.recyclePostModalVisible=!0}}},[t._v(" 回收站")])]},proxy:!0}])}),s("RecyclePostModal",{attrs:{visible:t.recyclePostModalVisible},on:{"update:visible":function(e){t.recyclePostModalVisible=e},close:t.onRecyclePostModalClose}})],1)},n=[],r=(s(12566),s(19003),s(30535),s(85018),s(96667)),i=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",[s("a-card",{attrs:{bodyStyle:{padding:"16px"},bordered:!1}},[t.searchWrapper?s("div",{staticClass:"table-page-search-wrapper"},[s("a-form",{attrs:{layout:"inline"}},[s("a-row",{attrs:{gutter:48}},[s("a-col",{attrs:{md:6,sm:24}},[s("a-form-item",{attrs:{label:"关键词:"}},[s("a-input",{on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleQuery()}},model:{value:t.list.params.keyword,callback:function(e){t.$set(t.list.params,"keyword",e)},expression:"list.params.keyword"}})],1)],1),s("a-col",{attrs:{md:6,sm:24}},[s("a-form-item",{attrs:{label:"文章状态:"}},[s("a-select",{attrs:{allowClear:"",placeholder:"请选择文章状态"},on:{change:t.handleChangeQueryStatus},model:{value:t.list.params.status,callback:function(e){t.$set(t.list.params,"status",e)},expression:"list.params.status"}},t._l(Object.keys(t.normalPostStatuses),(function(e){return s("a-select-option",{key:e,attrs:{value:e}},[t._v(" "+t._s(t.postStatuses[e].text)+" ")])})),1)],1)],1),s("a-col",{attrs:{md:6,sm:24}},[s("a-form-item",{attrs:{label:"分类目录:"}},[s("CategorySelectTree",{attrs:{categories:t.categories.data,"category-id":t.list.params.categoryId,root:{id:0,title:"全部",value:"0",pId:-1}},on:{"update:categoryId":function(e){return t.$set(t.list.params,"categoryId",e)},"update:category-id":function(e){return t.$set(t.list.params,"categoryId",e)},change:t.handleQuery}})],1)],1),s("a-col",{attrs:{md:6,sm:24}},[s("span",{staticClass:"table-page-search-submitButtons"},[s("a-space",[s("a-button",{attrs:{type:"primary"},on:{click:function(e){return t.handleQuery()}}},[t._v("查询")]),s("a-button",{on:{click:function(e){return t.handleResetParam()}}},[t._v("重置")])],1)],1)])],1)],1)],1):t._e(),s("div",{staticClass:"mb-5"},[s("a-space",[t._t("operator-before"),t.selectedRowKeys.length&&!t.isMobile()?s("a-dropdown",{scopedSlots:t._u([{key:"overlay",fn:function(){return[s("a-menu",[s("a-menu-item",{on:{click:function(e){return t.handleChangeStatusInBatch(t.postStatuses.PUBLISHED.value)}}},[t._v("发布")]),s("a-menu-item",{on:{click:function(e){return t.handleChangeStatusInBatch(t.postStatuses.DRAFT.value)}}},[t._v("转为草稿")]),t.defaultStatuses.includes(t.postStatuses.RECYCLE.value)?s("a-menu-item",{on:{click:t.handleDeleteInBatch}},[t._v(" 永久删除 ")]):s("a-menu-item",{on:{click:function(e){return t.handleChangeStatusInBatch(t.postStatuses.RECYCLE.value)}}},[t._v("删除")])],1)]},proxy:!0}],null,!1,4256031592)},[s("a-button",[t._v(" 批量操作 "),s("a-icon",{attrs:{type:"down"}})],1)],1):t._e(),t._t("operator-after")],2)],1),s("div",[t.isMobile()?s("a-list",{attrs:{dataSource:t.list.data,loading:t.list.loading,pagination:!1,itemLayout:"vertical",size:"large"},scopedSlots:t._u([{key:"renderItem",fn:function(e,a){return[s("a-list-item",{key:a,scopedSlots:t._u([{key:"actions",fn:function(){return[s("span",[s("a-icon",{attrs:{type:"eye"}}),t._v(" "+t._s(e.visits)+" ")],1),s("span",{on:{click:function(s){return t.handleOpenPostComments(e)}}},[s("a-icon",{attrs:{type:"message"}}),t._v(" "+t._s(e.commentCount)+" ")],1),s("a-dropdown",{attrs:{trigger:["click"],placement:"topLeft"},scopedSlots:t._u([{key:"overlay",fn:function(){return[s("a-menu",[[t.postStatuses.PUBLISHED.value,t.postStatuses.DRAFT.value,t.postStatuses.INTIMATE.value].includes(e.status)?s("a-menu-item",{on:{click:function(s){return t.handleEditClick(e)}}},[t._v(" 编辑 ")]):e.status===t.postStatuses.RECYCLE.value?s("a-menu-item",[s("a-popconfirm",{attrs:{title:"确定要发布【"+e.title+"】文章?",cancelText:"取消",okText:"确定"},on:{confirm:function(s){return t.handleChangeStatus(e.id,t.postStatuses.PUBLISHED.value)}}},[t._v(" 还原 ")])],1):t._e(),[t.postStatuses.PUBLISHED.value,t.postStatuses.DRAFT.value,t.postStatuses.INTIMATE.value].includes(e.status)?s("a-menu-item",[s("a-popconfirm",{attrs:{title:"确定要删除【"+e.title+"】文章?",cancelText:"取消",okText:"确定"},on:{confirm:function(s){return t.handleChangeStatus(e.id,t.postStatuses.RECYCLE.value)}}},[t._v(" 删除 ")])],1):e.status===t.postStatuses.RECYCLE.value?s("a-menu-item",[s("a-popconfirm",{attrs:{title:"确定要永久删除【"+e.title+"】文章?",cancelText:"取消",okText:"确定"},on:{confirm:function(s){return t.handleDelete(e.id)}}},[t._v(" 删除 ")])],1):t._e(),s("a-menu-item",{on:{click:function(s){return t.handleOpenPostSettings(e)}}},[t._v("设置")])],1)]},proxy:!0}],null,!0)},[s("span",[s("a-icon",{attrs:{type:"bars"}})],1)])]},proxy:!0},{key:"extra",fn:function(){return[s("a-badge",{attrs:{status:t.postStatuses[e.status].status,text:t._f("statusText")(e.status)}})]},proxy:!0}],null,!0)},[s("a-list-item-meta",{scopedSlots:t._u([{key:"description",fn:function(){return[t._v(" "+t._s(t._f("moment")(e.createTime))+" ")]},proxy:!0},{key:"title",fn:function(){return[s("div",{staticStyle:{"max-width":"300px",display:"block","white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis"}},[0!==e.topPriority?s("a-icon",{staticStyle:{"margin-right":"3px"},attrs:{theme:"twoTone",twoToneColor:"red",type:"pushpin"}}):t._e(),e.inProgress?s("a-tooltip",{attrs:{placement:"top",title:"当前有内容已保存,但还未发布。"}},[s("a-icon",{staticClass:"cursor-pointer",staticStyle:{"margin-right":"3px"},attrs:{theme:"twoTone",twoToneColor:"#52c41a",type:"info-circle"},on:{click:function(s){return t.handleEditClick(e)}}})],1):t._e(),[t.postStatuses.PUBLISHED.value,t.postStatuses.INTIMATE.value].includes(e.status)?s("a-tooltip",{attrs:{title:"点击访问【"+e.title+"】",placement:"top"}},[s("a",{staticClass:"no-underline",attrs:{href:e.fullPath,target:"_blank"}},[t._v(" "+t._s(e.title)+" ")])]):e.status===t.postStatuses.DRAFT.value?s("a-tooltip",{attrs:{title:"点击预览【"+e.title+"】",placement:"top"}},[s("a",{staticClass:"no-underline",attrs:{href:"javascript:void(0);"},on:{click:function(s){return t.handlePreview(e.id)}}},[t._v(" "+t._s(e.title)+" ")])]):s("a",{staticClass:"no-underline",attrs:{href:"javascript:void(0);",disabled:""}},[t._v(" "+t._s(e.title)+" ")])],1)]},proxy:!0}],null,!0)}),e.summary?s("div",{staticClass:"mb-3 block"},[s("span",[t._v(" "+t._s(e.summary)+"... ")])]):t._e(),s("div",{staticClass:"block"},t._l(e.categories,(function(e,a){return s("a-tag",{key:"category_"+a,staticStyle:{"margin-bottom":"8px"},attrs:{color:"blue"}},[t._v(" "+t._s(e.name)+" ")])})),1),t._l(e.tags,(function(t,e){return s("post-tag",{key:e,staticStyle:{"margin-bottom":"8px"},attrs:{tag:t}})}))],2)]}}],null,!1,2822372946)}):s("a-table",{attrs:{columns:t.columns,dataSource:t.list.data,loading:t.list.loading,pagination:!1,rowKey:function(t){return t.id},rowSelection:{selectedRowKeys:t.selectedRowKeys,onChange:t.onSelectionChange},scrollToFirstRowOnChange:!0},scopedSlots:t._u([{key:"postTitle",fn:function(e,a){return[0!==a.topPriority?s("a-icon",{staticStyle:{"margin-right":"3px"},attrs:{theme:"twoTone",twoToneColor:"red",type:"pushpin"}}):t._e(),a.inProgress?s("a-tooltip",{attrs:{placement:"top",title:"当前有内容已保存,但还未发布。"}},[s("a-icon",{staticClass:"cursor-pointer",staticStyle:{"margin-right":"3px"},attrs:{theme:"twoTone",twoToneColor:"#52c41a",type:"info-circle"},on:{click:function(e){return t.handleEditClick(a)}}})],1):t._e(),[t.postStatuses.PUBLISHED.value,t.postStatuses.INTIMATE.value].includes(a.status)?s("a-tooltip",{attrs:{title:"点击访问【"+e+"】",placement:"top"}},[s("a",{staticClass:"no-underline",attrs:{href:a.fullPath,target:"_blank"}},[t._v(" "+t._s(e)+" ")])]):a.status===t.postStatuses.DRAFT.value?s("a-tooltip",{attrs:{title:"点击预览【"+e+"】",placement:"top"}},[s("a",{staticClass:"no-underline",attrs:{href:"javascript:void(0);"},on:{click:function(e){return t.handlePreview(a.id)}}},[t._v(" "+t._s(e)+" ")])]):s("a",{staticClass:"no-underline",attrs:{href:"javascript:void(0);",disabled:""}},[t._v(" "+t._s(e)+" ")])]}},{key:"status",fn:function(e){return[s("a-badge",{attrs:{status:t.postStatuses[e].status,text:t._f("statusText")(e)}})]}},{key:"categories",fn:function(e){return t._l(e,(function(e,a){return s("a-tag",{key:a,staticStyle:{"margin-bottom":"8px"},attrs:{color:"blue"}},[t._v(" "+t._s(e.name)+" ")])}))}},{key:"tags",fn:function(e){return t._l(e,(function(t,e){return s("post-tag",{key:e,staticStyle:{"margin-bottom":"8px"},attrs:{tag:t}})}))}},{key:"commentCount",fn:function(e,a){return[s("a-badge",{staticClass:"cursor-pointer",attrs:{count:a.commentCount,numberStyle:{backgroundColor:"#f38181"},overflowCount:999,showZero:!0},on:{click:function(e){return t.handleOpenPostComments(a)}}})]}},{key:"visits",fn:function(t){return[s("a-badge",{staticClass:"cursor-pointer",attrs:{count:t,numberStyle:{backgroundColor:"#00e0ff"},overflowCount:9999,showZero:!0}})]}},{key:"createTime",fn:function(e){return[s("a-tooltip",{attrs:{placement:"top"},scopedSlots:t._u([{key:"title",fn:function(){return[t._v(" "+t._s(t._f("moment")(e))+" ")]},proxy:!0}],null,!0)},[t._v(" "+t._s(t._f("timeAgo")(e))+" ")])]}},{key:"action",fn:function(e,a){return[[t.postStatuses.PUBLISHED.value,t.postStatuses.DRAFT.value,t.postStatuses.INTIMATE.value].includes(a.status)?s("a-button",{staticClass:"!p-0",attrs:{type:"link"},on:{click:function(e){return t.handleEditClick(a)}}},[t._v(" 编辑 ")]):a.status===t.postStatuses.RECYCLE.value?s("a-popconfirm",{attrs:{title:"确定要发布【"+a.title+"】文章?",cancelText:"取消",okText:"确定"},on:{confirm:function(e){return t.handleChangeStatus(a.id,t.postStatuses.PUBLISHED.value)}}},[s("a-button",{staticClass:"!p-0",attrs:{type:"link"}},[t._v("还原")])],1):t._e(),s("a-divider",{attrs:{type:"vertical"}}),[t.postStatuses.PUBLISHED.value,t.postStatuses.DRAFT.value,t.postStatuses.INTIMATE.value].includes(a.status)?s("a-popconfirm",{attrs:{title:"确定要删除【"+a.title+"】文章?",cancelText:"取消",okText:"确定"},on:{confirm:function(e){return t.handleChangeStatus(a.id,t.postStatuses.RECYCLE.value)}}},[s("a-button",{staticClass:"!p-0",attrs:{type:"link"}},[t._v("删除")])],1):a.status===t.postStatuses.RECYCLE.value?s("a-popconfirm",{attrs:{title:"确定要永久删除【"+a.title+"】文章?",cancelText:"取消",okText:"确定"},on:{confirm:function(e){return t.handleDelete(a.id)}}},[s("a-button",{staticClass:"!p-0",attrs:{type:"link"}},[t._v("删除")])],1):t._e(),s("a-divider",{attrs:{type:"vertical"}}),s("a-button",{staticClass:"!p-0",attrs:{type:"link"},on:{click:function(e){return t.handleOpenPostSettings(a)}}},[t._v("设置")])]}}])}),s("div",{staticClass:"page-wrapper"},[s("a-pagination",{staticClass:"pagination",attrs:{current:t.pagination.page,defaultPageSize:t.pagination.size,pageSizeOptions:["5","10","20","50","100"],total:t.pagination.total,showLessItems:"",showSizeChanger:""},on:{change:t.handlePageChange,showSizeChange:t.handlePageSizeChange}})],1)],1)]),s("PostSettingModal",{attrs:{loading:t.postSettingLoading,post:t.list.selected,savedCallback:t.onPostSavedCallback,visible:t.postSettingVisible},on:{"update:visible":function(e){t.postSettingVisible=e},onClose:function(e){t.list.selected={}}},scopedSlots:t._u([{key:"extraFooter",fn:function(){return[s("a-button",{attrs:{disabled:t.selectPreviousButtonDisabled},on:{click:t.handleSelectPrevious}},[t._v(" 上一篇")]),s("a-button",{attrs:{disabled:t.selectNextButtonDisabled},on:{click:t.handleSelectNext}},[t._v(" 下一篇")])]},proxy:!0}])}),s("TargetCommentListModal",{attrs:{"target-id":t.list.selected.id,title:"「"+t.list.selected.title+"」的评论",visible:t.postCommentVisible,target:"post"},on:{"update:visible":function(e){t.postCommentVisible=e},close:t.onPostCommentsClose},scopedSlots:t._u([{key:"extraFooter",fn:function(){return[s("a-button",{attrs:{disabled:t.selectPreviousButtonDisabled},on:{click:t.handleSelectPrevious}},[t._v(" 上一篇")]),s("a-button",{attrs:{disabled:t.selectNextButtonDisabled},on:{click:t.handleSelectNext}},[t._v(" 下一篇")])]},proxy:!0}])})],1)},o=[],l=s(54288),u=(s(70315),s(15928),s(66776),s(41479),s(82395),s(7530)),c=s(2756),d=s(64346),p=s(94370),h=s(43376),f=s(36591),m={name:"PostListView",components:{PostSettingModal:u.Z,TargetCommentListModal:c.Z,CategorySelectTree:d.Z},mixins:[p.KT],props:{defaultStatuses:{type:Array,default:function(){return[]}},defaultPageSize:{type:Number,default:10},searchWrapper:{type:Boolean,default:!0},columns:{type:Array,default:function(){return[]}}},data:function(){return{postStatuses:h.JQ,normalPostStatuses:h.hh,list:{data:[],loading:!1,total:0,hasPrevious:!1,hasNext:!1,params:{page:0,size:10,keyword:void 0,categoryId:void 0,statuses:[]},selected:{}},categories:{data:[],loading:!1},selectedRowKeys:[],postSettingVisible:!1,postSettingLoading:!1,postCommentVisible:!1}},computed:{pagination:function(){return{page:this.list.params.page+1,size:this.list.params.size,total:this.list.total}},selectPreviousButtonDisabled:function(){var t=this,e=this.list.data.findIndex((function(e){return e.id===t.list.selected.id}));return 0===e&&!this.list.hasPrevious},selectNextButtonDisabled:function(){var t=this,e=this.list.data.findIndex((function(e){return e.id===t.list.selected.id}));return e===this.list.data.length-1&&!this.list.hasNext}},created:function(){this.list.params.statuses=this.defaultStatuses,this.list.params.size=this.defaultPageSize,this.handleListCategories()},watch:{"list.params":{deep:!0,handler:function(t){if(t){var e=JSON.parse(JSON.stringify(this.list.params));this.$emit("change:params",e)}}}},methods:{handleListPosts:function(){var t=arguments,e=this;return(0,l.Z)(regeneratorRuntime.mark((function s(){var a,n,r;return regeneratorRuntime.wrap((function(s){while(1)switch(s.prev=s.next){case 0:return a=!(t.length>0&&void 0!==t[0])||t[0],s.prev=1,a&&(e.list.loading=!0),n=e.list.params.categoryId,e.list.params.categoryId=0===n?void 0:n,s.next=7,f.Z.post.list(e.list.params);case 7:if(r=s.sent,!(0===r.data.content.length&&e.list.params.page>0)){s.next=13;break}return e.list.params.page--,s.next=12,e.handleListPosts();case 12:return s.abrupt("return");case 13:e.list.data=r.data.content,e.list.total=r.data.total,e.list.hasPrevious=r.data.hasPrevious,e.list.hasNext=r.data.hasNext,s.next=22;break;case 19:s.prev=19,s.t0=s["catch"](1),e.$log.error(s.t0);case 22:return s.prev=22,e.list.loading=!1,s.finish(22);case 25:case"end":return s.stop()}}),s,null,[[1,19,22,25]])})))()},handleListCategories:function(){var t=this;return(0,l.Z)(regeneratorRuntime.mark((function e(){var s;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,t.categories.loading=!0,e.next=4,f.Z.category.list({sort:[],more:!0});case 4:s=e.sent,t.categories.data=s.data,e.next=11;break;case 8:e.prev=8,e.t0=e["catch"](0),t.$log.error(e.t0);case 11:return e.prev=11,t.categories.loading=!1,e.finish(11);case 14:case"end":return e.stop()}}),e,null,[[0,8,11,14]])})))()},handleEditClick:function(t){this.$router.push({name:"PostEdit",query:{postId:t.id}})},onSelectionChange:function(t){this.selectedRowKeys=t,this.$log.debug("SelectedRowKeys: ".concat(t))},handlePageChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.list.params.page=t-1,this.handleListPosts()},handlePageSizeChange:function(t,e){this.$log.debug("Current: ".concat(t,", PageSize: ").concat(e)),this.list.params.page=0,this.list.params.size=e,this.handleListPosts()},handleResetParam:function(){this.list.params.keyword=void 0,this.list.params.categoryId=void 0,this.list.params.statuses=this.defaultStatuses,this.list.params.status=void 0,this.selectedRowKeys=[],this.handlePageChange(1),this.handleListCategories()},handleQuery:function(){this.selectedRowKeys=[],this.handlePageChange(1)},handleChangeQueryStatus:function(t){t?(this.list.params.statuses=[t],this.list.params.status=t):(this.list.params.statuses=this.defaultStatuses,this.list.params.status=void 0),this.handleQuery()},handleChangeStatus:function(t,e){var s=this;return(0,l.Z)(regeneratorRuntime.mark((function a(){return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:return a.prev=0,a.next=3,f.Z.post.updateStatusById(t,e);case 3:s.$message.success("操作成功!"),a.next=9;break;case 6:a.prev=6,a.t0=a["catch"](0),s.$log.error("Failed to change post status",a.t0);case 9:return a.prev=9,a.next=12,s.handleListPosts();case 12:return a.finish(9);case 13:case"end":return a.stop()}}),a,null,[[0,6,9,13]])})))()},handleChangeStatusInBatch:function(t){var e=this;return(0,l.Z)(regeneratorRuntime.mark((function s(){return regeneratorRuntime.wrap((function(s){while(1)switch(s.prev=s.next){case 0:if(!(e.selectedRowKeys.length<=0)){s.next=3;break}return e.$message.info("请至少选择一项!"),s.abrupt("return");case 3:e.$confirm({title:"提示",content:"确定要将所选的文章转为".concat(h.JQ[t].text,"状态吗?"),okText:"确定",cancelText:"取消",onOk:function(){var s=(0,l.Z)(regeneratorRuntime.mark((function s(){return regeneratorRuntime.wrap((function(s){while(1)switch(s.prev=s.next){case 0:return s.prev=0,s.next=3,f.Z.post.updateStatusInBatch(e.selectedRowKeys,t);case 3:e.selectedRowKeys=[],e.$message.success("操作成功!"),s.next=10;break;case 7:s.prev=7,s.t0=s["catch"](0),e.$log.error("Failed to change status in batch",s.t0);case 10:return s.prev=10,s.next=13,e.handleListPosts();case 13:return s.finish(10);case 14:case"end":return s.stop()}}),s,null,[[0,7,10,14]])})));function a(){return s.apply(this,arguments)}return a}()});case 4:case"end":return s.stop()}}),s)})))()},handleDelete:function(t){var e=this;return(0,l.Z)(regeneratorRuntime.mark((function s(){return regeneratorRuntime.wrap((function(s){while(1)switch(s.prev=s.next){case 0:return s.prev=0,s.next=3,f.Z.post["delete"](t);case 3:e.$message.success("删除成功!"),s.next=9;break;case 6:s.prev=6,s.t0=s["catch"](0),e.$log.error("Failed to delete post",s.t0);case 9:return s.prev=9,s.next=12,e.handleListPosts();case 12:return s.finish(9);case 13:case"end":return s.stop()}}),s,null,[[0,6,9,13]])})))()},handleDeleteInBatch:function(){var t=this;return(0,l.Z)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!(t.selectedRowKeys.length<=0)){e.next=3;break}return t.$message.info("请至少选择一项!"),e.abrupt("return");case 3:t.$confirm({title:"提示",content:"确定删除所选的文章吗?",okText:"确定",cancelText:"取消",onOk:function(){var e=(0,l.Z)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,f.Z.post.deleteInBatch(t.selectedRowKeys);case 3:t.selectedRowKeys=[],t.$message.success("删除成功!"),e.next=10;break;case 7:e.prev=7,e.t0=e["catch"](0),t.$log.error("Failed to delete posts in batch",e.t0);case 10:return e.prev=10,e.next=13,t.handleListPosts();case 13:return e.finish(10);case 14:case"end":return e.stop()}}),e,null,[[0,7,10,14]])})));function s(){return e.apply(this,arguments)}return s}()});case 4:case"end":return e.stop()}}),e)})))()},handleDeleteCurrentPage:function(){var t=this;return(0,l.Z)(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t.list.data.length){e.next=3;break}return t.$message.info("当前页没有文章"),e.abrupt("return");case 3:t.$confirm({title:"提示",content:"确定删除当前页的所有文章吗?",okText:"确定",cancelText:"取消",onOk:function(){var e=(0,l.Z)(regeneratorRuntime.mark((function e(){var s;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,s=t.list.data.map((function(t){return t.id})),e.next=4,f.Z.post.deleteInBatch(s);case 4:t.$message.success("删除成功!"),e.next=10;break;case 7:e.prev=7,e.t0=e["catch"](0),t.$log.error("Failed to delete posts in batch",e.t0);case 10:return e.prev=10,e.next=13,t.handleListPosts();case 13:return e.finish(10);case 14:case"end":return e.stop()}}),e,null,[[0,7,10,14]])})));function s(){return e.apply(this,arguments)}return s}()});case 4:case"end":return e.stop()}}),e)})))()},handleOpenPostSettings:function(t){var e=this;return(0,l.Z)(regeneratorRuntime.mark((function s(){var a,n;return regeneratorRuntime.wrap((function(s){while(1)switch(s.prev=s.next){case 0:return s.prev=0,e.postSettingVisible=!0,e.postSettingLoading=!0,s.next=5,f.Z.post.get(t.id);case 5:a=s.sent,n=a.data,e.list.selected=n,s.next=13;break;case 10:s.prev=10,s.t0=s["catch"](0),e.$log.error("Failed to open post settings",s.t0);case 13:return s.prev=13,e.postSettingLoading=!1,s.finish(13);case 16:case"end":return s.stop()}}),s,null,[[0,10,13,16]])})))()},handleOpenPostComments:function(t){this.list.selected=t,this.postCommentVisible=!0},handlePreview:function(t){f.Z.post.getPreviewLinkById(t).then((function(t){window.open(t,"_blank")}))},onPostSavedCallback:function(){this.handleListPosts(!1)},onPostCommentsClose:function(){this.postCommentVisible=!1,this.list.selected={},this.handleListPosts(!1)},handleSelectPrevious:function(){var t=this;return(0,l.Z)(regeneratorRuntime.mark((function e(){var s,a,n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(s=t.list.data.findIndex((function(e){return e.id===t.list.selected.id})),!(s>0)){e.next=9;break}return t.postSettingLoading=!0,e.next=5,f.Z.post.get(t.list.data[s-1].id);case 5:return a=e.sent,t.list.selected=a.data,t.postSettingLoading=!1,e.abrupt("return");case 9:if(0!==s||!t.list.hasPrevious){e.next=19;break}return t.list.params.page--,e.next=13,t.handleListPosts();case 13:return t.postSettingLoading=!0,e.next=16,f.Z.post.get(t.list.data[t.list.data.length-1].id);case 16:n=e.sent,t.list.selected=n.data,t.postSettingLoading=!1;case 19:case"end":return e.stop()}}),e)})))()},handleSelectNext:function(){var t=this;return(0,l.Z)(regeneratorRuntime.mark((function e(){var s,a,n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(s=t.list.data.findIndex((function(e){return e.id===t.list.selected.id})),!(s<t.list.data.length-1)){e.next=9;break}return t.postSettingLoading=!0,e.next=5,f.Z.post.get(t.list.data[s+1].id);case 5:return a=e.sent,t.list.selected=a.data,t.postSettingLoading=!1,e.abrupt("return");case 9:if(s!==t.list.data.length-1||!t.list.hasNext){e.next=19;break}return t.list.params.page++,e.next=13,t.handleListPosts();case 13:return t.postSettingLoading=!0,e.next=16,f.Z.post.get(t.list.data[0].id);case 16:n=e.sent,t.list.selected=n.data,t.postSettingLoading=!1;case 19:case"end":return e.stop()}}),e)})))()}},filters:{statusText:function(t){return t?h.JQ[t].text:""}}},g=m,v=s(70739),y=(0,v.Z)(g,i,o,!1,null,null,null),S=y.exports,k=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("a-modal",{attrs:{afterClose:t.onClose,bodyStyle:{padding:"8px"},width:1080,destroyOnClose:"",title:"回收站"},scopedSlots:t._u([{key:"footer",fn:function(){return[s("a-button",{on:{click:function(e){t.modalVisible=!1}}},[t._v("关闭")])]},proxy:!0}]),model:{value:t.modalVisible,callback:function(e){t.modalVisible=e},expression:"modalVisible"}},[s("PostListView",{ref:"postListView",attrs:{columns:t.recyclePostColumns,"default-page-size":5,"default-statuses":[t.postStatuses.RECYCLE.value],searchWrapper:!1},scopedSlots:t._u([{key:"operator-after",fn:function(){return[s("a-button",{attrs:{icon:"delete",type:"danger"},on:{click:t.handleDeleteCurrentPage}},[t._v("删除当前页")])]},proxy:!0}])})],1)},b=[],x={name:"RecyclePostModal",components:{PostListView:S},props:{visible:{type:Boolean,default:!0}},data:function(){return{postStatuses:h.JQ,recyclePostColumns:h.z$}},computed:{modalVisible:{get:function(){return this.visible},set:function(t){this.$emit("update:visible",t)}}},watch:{modalVisible:function(t){var e=this;t&&this.$nextTick((function(){e.$refs.postListView.handleListPosts()}))}},methods:{onClose:function(){this.$emit("close")},handleDeleteCurrentPage:function(){this.$refs.postListView.handleDeleteCurrentPage()}}},C=x,w=(0,v.Z)(C,k,b,!1,null,null,null),_=w.exports,P={name:"PostList",components:{PageView:r.B4,PostListView:S,RecyclePostModal:_},data:function(){return{postStatuses:h.JQ,postColumns:h.nM,recyclePostModalVisible:!1}},beforeRouteEnter:function(t,e,s){s((function(e){var s=e.$refs.postListView;t.query.page&&(s.list.params.page=Number(t.query.page)),t.query.size&&(s.list.params.size=Number(t.query.size)),s.list.params.sort=t.query.sort,s.list.params.keyword=t.query.keyword,s.list.params.categoryId=t.query.categoryId,s.list.params.status=t.query.status,s.handleListPosts()}))},methods:{onChangeParams:function(t){var e=this.$router.history.current.path;this.$router.replace({path:e,query:t}).catch((function(t){return t}))},onRecyclePostModalClose:function(){this.$refs.postListView.handleListPosts()}}},L=P,R=(0,v.Z)(L,a,n,!1,null,null,null),T=R.exports}}]);