Unverified Commit 631b2149 authored by Ryan Wang's avatar Ryan Wang Committed by GitHub
Browse files

release: 1.5.0-alpha.1 (#1671)

Signed-off-by: default avatarRyan Wang <i@ryanc.cc>
parent 94d718c0
Showing with 34 additions and 0 deletions
+34 -0
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[397],{69397:function(e,t,a){a.r(t),a.d(t,{default:function(){return S}});var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("page-view",{attrs:{"sub-title":e.sheetToStage.inProgress?"当前内容已保存,但还未发布。":"",title:e.sheetToStage.title?e.sheetToStage.title:"新页面",affix:""}},[a("template",{slot:"extra"},[a("a-space",[a("a-button",{attrs:{loading:e.previewSaving},on:{click:e.handlePreviewClick}},[e._v("预览")]),a("a-button",{attrs:{type:"primary"},on:{click:function(t){e.sheetSettingVisible=!0}}},[e._v("发布")])],1)],1),a("a-row",{attrs:{gutter:12}},[a("a-col",{attrs:{span:24}},[a("div",{staticClass:"mb-4"},[a("a-input",{attrs:{placeholder:"请输入页面标题",size:"large"},model:{value:e.sheetToStage.title,callback:function(t){e.$set(e.sheetToStage,"title",t)},expression:"sheetToStage.title"}})],1),a("div",{style:{height:e.editorHeight},attrs:{id:"editor"}},[a("MarkdownEditor",{attrs:{originalContent:e.sheetToStage.originalContent},on:{"update:originalContent":function(t){return e.$set(e.sheetToStage,"originalContent",t)},"update:original-content":function(t){return e.$set(e.sheetToStage,"originalContent",t)},change:e.onContentChange,save:function(t){return e.handleSaveDraft()}}})],1)])],1),a("SheetSettingModal",{attrs:{post:e.sheetToStage,savedCallback:e.onSheetSavedCallback,visible:e.sheetSettingVisible},on:{"update:visible":function(t){e.sheetSettingVisible=t},onUpdate:e.onUpdateFromSetting}})],2)},r=[],o=a(91057),i=(a(70315),a(12566),a(30535),a(85018),a(50990)),s=a(70014),l=a(26815),c=a(3832),u=a(86637),m=a(1540),d=a(86763),h=a.n(d),f={components:{PageView:i.B4,SheetSettingModal:s.Z,MarkdownEditor:l.Z},mixins:[c.jB,c.KT,c.g3],data:function(){return{sheetSettingVisible:!1,sheetToStage:{},contentChanges:0,previewSaving:!1}},beforeRouteEnter:function(e,t,a){var n=e.query.sheetId;a(function(){var e=(0,o.Z)(regeneratorRuntime.mark((function e(t){var a,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!n){e.next=6;break}return e.next=3,m.Z.sheet.get(Number(n));case 3:a=e.sent,r=a.data,t.sheetToStage=r;case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())},destroyed:function(){window.onbeforeunload&&(window.onbeforeunload=null)},beforeRouteLeave:function(e,t,a){var n=this.$createElement;this.contentChanges<=1?a():this.$confirm({title:"当前页面数据未保存,确定要离开吗?",content:function(){return n("div",{style:"color:red;"},["如果离开当面页面,你的数据很可能会丢失!"])},onOk:function(){a()},onCancel:function(){a(!1)}})},mounted:function(){window.onbeforeunload=function(e){return e=e||window.event,e&&(e.returnValue="当前页面数据未保存,确定要离开吗?"),"当前页面数据未保存,确定要离开吗?"}},beforeMount:function(){document.addEventListener("keydown",this.onRegisterSaveShortcut)},beforeDestroy:function(){document.removeEventListener("keydown",this.onRegisterSaveShortcut)},methods:{onRegisterSaveShortcut:function(e){!e.ctrlKey&&!e.metaKey||e.altKey||e.shiftKey||83!==e.keyCode||(e.preventDefault(),e.stopPropagation(),this.handleSaveDraft())},handleSaveDraft:h()((0,o.Z)(regeneratorRuntime.mark((function e(){var t,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(!this.sheetToStage.id){e.next=16;break}return e.prev=1,e.next=4,m.Z.sheet.updateDraftById(this.sheetToStage.id,this.sheetToStage.originalContent,this.sheetToStage.content,!0);case 4:t=e.sent,a=t.data,this.sheetToStage.inProgress=a.inProgress,this.handleRestoreSavedStatus(),this.$message.success({content:"内容已保存",duration:.5}),e.next=14;break;case 11:e.prev=11,e.t0=e["catch"](1),this.$log.error("Failed to update sheet content",e.t0);case 14:e.next=18;break;case 16:return e.next=18,this.handleCreateSheet();case 18:case"end":return e.stop()}}),e,this,[[1,11]])}))),300),handleCreateSheet:function(){var e=this;return(0,o.Z)(regeneratorRuntime.mark((function t(){var a,n,r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return e.sheetToStage.title||(e.sheetToStage.title=(0,u._)(new Date,"YYYY-MM-DD-HH-mm-ss")),t.prev=1,e.sheetToStage.keepRaw=!0,t.next=5,m.Z.sheet.create(e.sheetToStage);case 5:a=t.sent,n=a.data,e.sheetToStage=n,e.handleRestoreSavedStatus(),r=e.$router.history.current.path,e.$router.replace({path:r,query:{sheetId:e.sheetToStage.id}}).catch((function(e){return e})),e.$message.success({content:"页面已创建",duration:.5}),t.next=17;break;case 14:t.prev=14,t.t0=t["catch"](1),e.$log.error("Failed to create sheet",t.t0);case 17:case"end":return t.stop()}}),t,null,[[1,14]])})))()},handlePreviewClick:function(){var e=this;return(0,o.Z)(regeneratorRuntime.mark((function t(){var a,n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e.previewSaving=!0,!e.sheetToStage.id){t.next=9;break}return t.next=4,m.Z.sheet.updateDraftById(e.sheetToStage.id,e.sheetToStage.originalContent,e.sheetToStage.content,!0);case 4:a=t.sent,n=a.data,e.sheetToStage.inProgress=n.inProgress,t.next=11;break;case 9:return t.next=11,e.handleCreateSheet();case 11:return t.next=13,e.handleOpenPreview();case 13:case"end":return t.stop()}}),t)})))()},handleOpenPreview:function(){var e=this;return(0,o.Z)(regeneratorRuntime.mark((function t(){var a;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,m.Z.sheet.getPreviewLinkById(e.sheetToStage.id);case 3:a=t.sent,window.open(a,"_blank"),e.handleRestoreSavedStatus(),t.next=11;break;case 8:t.prev=8,t.t0=t["catch"](0),e.$log.error("Failed to get preview link",t.t0);case 11:return t.prev=11,setTimeout((function(){e.previewSaving=!1}),400),t.finish(11);case 14:case"end":return t.stop()}}),t,null,[[0,8,11,14]])})))()},handleRestoreSavedStatus:function(){this.contentChanges=0},onContentChange:function(e){var t=e.originalContent,a=e.renderContent;this.contentChanges++,this.sheetToStage.originalContent=t,this.sheetToStage.content=a},onSheetSavedCallback:function(){this.contentChanges=0,this.$router.push({name:"SheetList",query:{activeKey:"custom"}})},onUpdateFromSetting:function(e){this.sheetToStage=e}}},p=f,g=a(18156),v=(0,g.Z)(p,n,r,!1,null,null,null),S=v.exports},70014:function(e,t,a){a.d(t,{Z:function(){return S}});var n=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("a-modal",{attrs:{afterClose:e.onClosed,bodyStyle:{padding:0},maskClosable:!1,width:680,destroyOnClose:""},scopedSlots:e._u([{key:"title",fn:function(){return[e._v(" "+e._s(e.modalTitle)+" "),e.loading?a("a-icon",{attrs:{type:"loading"}}):e._e()]},proxy:!0}]),model:{value:e.modalVisible,callback:function(t){e.modalVisible=t},expression:"modalVisible"}},[a("div",{staticClass:"card-container"},[a("a-tabs",{attrs:{type:"card"}},[a("a-tab-pane",{key:"normal",attrs:{tab:"常规"}},[a("a-form",{attrs:{"label-col":{span:4},"wrapper-col":{span:20},labelAlign:"left"}},[a("a-form-item",{attrs:{label:"页面标题"}},[a("a-input",{model:{value:e.form.model.title,callback:function(t){e.$set(e.form.model,"title",t)},expression:"form.model.title"}})],1),a("a-form-item",{attrs:{help:e.fullPath,label:"页面别名"}},[a("a-input",{scopedSlots:e._u([{key:"addonAfter",fn:function(){return[a("a-popconfirm",{attrs:{"cancel-text":"取消","ok-text":"确定",placement:"left",title:"是否确定根据标题重新生成别名?"},on:{confirm:e.handleGenerateSlug}},[a("a-icon",{staticClass:"cursor-pointer",attrs:{type:"sync"}})],1)]},proxy:!0}]),model:{value:e.form.model.slug,callback:function(t){e.$set(e.form.model,"slug",t)},expression:"form.model.slug"}})],1),a("a-form-item",{attrs:{label:"摘要"}},[a("a-input",{attrs:{autoSize:{minRows:5},placeholder:"如不填写,会从页面中自动截取",type:"textarea"},model:{value:e.form.model.summary,callback:function(t){e.$set(e.form.model,"summary",t)},expression:"form.model.summary"}})],1)],1)],1),a("a-tab-pane",{key:"advanced",attrs:{tab:"高级"}},[a("a-form",{attrs:{"label-col":{span:4},"wrapper-col":{span:20},labelAlign:"left"}},[a("a-form-item",{attrs:{label:"禁止评论"}},[a("a-switch",{model:{value:e.form.model.disallowComment,callback:function(t){e.$set(e.form.model,"disallowComment",t)},expression:"form.model.disallowComment"}})],1),a("a-form-item",{attrs:{label:"发表时间:"}},[a("a-date-picker",{attrs:{defaultValue:e.createTimeDefaultValue,format:"YYYY-MM-DD HH:mm:ss",placeholder:"选择页面发表时间",showTime:""},on:{change:e.onCreateTimeSelect,ok:e.onCreateTimeSelect}})],1),a("a-form-item",{attrs:{label:"自定义模板:"}},[a("a-select",{model:{value:e.form.model.template,callback:function(t){e.$set(e.form.model,"template",t)},expression:"form.model.template"}},[a("a-select-option",{key:"",attrs:{value:""}},[e._v("")]),e._l(e.templates,(function(t){return a("a-select-option",{key:t,attrs:{value:t}},[e._v(" "+e._s(t)+" ")])}))],2)],1),a("a-form-item",{attrs:{label:"封面图:"}},[a("div",{staticClass:"post-thumb"},[a("a-space",{attrs:{direction:"vertical"}},[a("img",{staticClass:"img",attrs:{src:e.form.model.thumbnail||"/images/placeholder.jpg",alt:"Post cover thumbnail"},on:{click:function(t){e.attachmentSelectVisible=!0}}}),a("a-input",{attrs:{"allow-clear":"",placeholder:"点击封面图选择图片,或者输入外部链接"},model:{value:e.form.model.thumbnail,callback:function(t){e.$set(e.form.model,"thumbnail",t)},expression:"form.model.thumbnail"}})],1)],1)])],1)],1),a("a-tab-pane",{key:"seo",attrs:{tab:"SEO"}},[a("a-form",{attrs:{"label-col":{span:4},"wrapper-col":{span:20},labelAlign:"left"}},[a("a-form-item",{attrs:{label:"自定义关键词"}},[a("a-input",{attrs:{autoSize:{minRows:5},placeholder:"多个关键词以英文逗号隔开",type:"textarea"},model:{value:e.form.model.metaKeywords,callback:function(t){e.$set(e.form.model,"metaKeywords",t)},expression:"form.model.metaKeywords"}})],1),a("a-form-item",{attrs:{label:"自定义描述"}},[a("a-input",{attrs:{autoSize:{minRows:5},placeholder:"如不填写,会从页面中自动截取",type:"textarea"},model:{value:e.form.model.metaDescription,callback:function(t){e.$set(e.form.model,"metaDescription",t)},expression:"form.model.metaDescription"}})],1)],1)],1),a("a-tab-pane",{key:"meta",attrs:{tab:"元数据"}},[a("MetaEditor",{attrs:{metas:e.form.model.metas,targetId:e.form.model.id,target:"sheet"},on:{"update:metas":function(t){return e.$set(e.form.model,"metas",t)}}})],1)],1)],1),a("template",{slot:"footer"},[e._t("extraFooter"),a("a-button",{attrs:{disabled:e.loading},on:{click:function(t){e.modalVisible=!1}}},[e._v(" 关闭")]),e.form.model.id?e._e():a("ReactiveButton",{attrs:{errored:e.form.draftSaveErrored,loading:e.form.draftSaving,erroredText:"保存失败",loadedText:"保存成功",text:"保存草稿",type:"danger"},on:{callback:e.handleSavedCallback,click:function(t){return e.handleCreateOrUpdate("DRAFT")}}}),a("ReactiveButton",{attrs:{errored:e.form.saveErrored,erroredText:(e.form.model.id?"保存":"发布")+"失败",loadedText:(e.form.model.id?"保存":"发布")+"成功",loading:e.form.saving,text:e.form.model.id?"保存":"发布"},on:{callback:e.handleSavedCallback,click:function(t){return e.handleCreateOrUpdate()}}})],2),a("AttachmentSelectModal",{attrs:{multiSelect:!1,visible:e.attachmentSelectVisible},on:{"update:visible":function(t){e.attachmentSelectVisible=t},confirm:e.handleSelectSheetThumbnail}})],2)},r=[],o=a(91057),i=a(76381),s=(a(70315),a(41479),a(30535),a(85018),a(31875),a(18482),a(86381),a(59563)),l=a(3832),c=a(86637),u=a(73511),m=a.n(u),d=a(98906),h=a(1540),f={name:"SheetSettingModal",mixins:[l.jB,l.KT],components:{MetaEditor:s.Z},props:{visible:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},post:{type:Object,default:function(){return{}}},savedCallback:{type:Function,default:null}},data:function(){return{form:{model:{},saving:!1,saveErrored:!1,draftSaving:!1,draftSaveErrored:!1},templates:[],attachmentSelectVisible:!1}},computed:(0,i.Z)((0,i.Z)({},(0,d.Se)(["options"])),{},{modalVisible:{get:function(){return this.visible},set:function(e){this.$emit("update:visible",e)}},modalTitle:function(){return this.form.model.id?"页面设置":"页面发布"},createTimeDefaultValue:function(){if(this.form.model.createTime){var e=new Date(this.form.model.createTime);return(0,c._)(e,"YYYY-MM-DD HH:mm:ss")}return(0,c._)(new Date,"YYYY-MM-DD HH:mm:ss")},fullPath:function(){var e=this.options.sheet_permalink_type,t=this.options.blog_url,a=this.options.sheet_prefix,n=this.options.path_suffix?this.options.path_suffix:"",r=this.form.model.slug||"{slug}";switch(e){case"SECONDARY":return"".concat(t,"/").concat(a,"/").concat(r).concat(n);case"ROOT":return"".concat(t,"/").concat(r).concat(n);default:return""}}}),watch:{modalVisible:function(e){e&&(this.form.model=Object.assign({},this.post),this.form.model.slug||this.form.model.id||this.handleGenerateSlug())},post:{deep:!0,handler:function(e){this.form.model=Object.assign({},e)}}},created:function(){this.handleListCustomTemplates()},methods:{handleCreateOrUpdate:function(){var e=arguments,t=this;return(0,o.Z)(regeneratorRuntime.mark((function a(){var n,r,o,i;return regeneratorRuntime.wrap((function(a){while(1)switch(a.prev=a.next){case 0:if(n=e.length>0&&void 0!==e[0]?e[0]:"PUBLISHED",t.form.model.title){a.next=4;break}return t.$notification["error"]({message:"提示",description:"页面标题不能为空!"}),a.abrupt("return");case 4:if(t.form.model.status=n,t.form.model.keepRaw=!0,r=t.form.model,o=r.id,i=r.status,a.prev=7,t.form["PUBLISHED"===i?"saving":"draftSaving"]=!0,!o){a.next=14;break}return a.next=12,h.Z.sheet.update(o,t.form.model);case 12:a.next=16;break;case 14:return a.next=16,h.Z.sheet.create(t.form.model);case 16:a.next=22;break;case 18:a.prev=18,a.t0=a["catch"](7),t.form["PUBLISHED"===i?"saveErrored":"draftSaveErrored"]=!0,t.$log.error(a.t0);case 22:return a.prev=22,setTimeout((function(){t.form.saving=!1,t.form.draftSaving=!1}),400),a.finish(22);case 25:case"end":return a.stop()}}),a,null,[[7,18,22,25]])})))()},handleSavedCallback:function(){this.form.saveErrored||this.form.draftSaveErrored?(this.form.saveErrored=!1,this.form.draftSaveErrored=!1):this.savedCallback&&this.savedCallback()},handleListCustomTemplates:function(){var e=this;return(0,o.Z)(regeneratorRuntime.mark((function t(){var a;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,h.Z.theme.listCustomSheetTemplates();case 3:a=t.sent,e.templates=a.data,t.next=10;break;case 7:t.prev=7,t.t0=t["catch"](0),e.$log.error(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})))()},onCreateTimeSelect:function(e){this.form.model.createTime=e.valueOf()},handleGenerateSlug:function(){if(this.form.model.title&&m().isSupported()){var e,t="",a=m().parse(this.form.model.title.replace(/\s+/g,"").toLowerCase());a.forEach((function(a){if(2===a.type){var n=a.target?a.target.toLowerCase():"";t+=t&&!/\n|\s/.test(e.target)?"-"+n:n}else t+=(e&&2===e.type?"-":"")+a.target;e=a})),this.$set(this.form.model,"slug",t)}},handleSelectSheetThumbnail:function(e){var t=e.raw;t.length&&(this.form.model.thumbnail=encodeURI(t[0].path)),this.attachmentSelectVisible=!1},onClosed:function(){this.$emit("onClose"),this.$emit("onUpdate",this.form.model)}}},p=f,g=a(18156),v=(0,g.Z)(p,n,r,!1,null,null,null),S=v.exports}}]);
\ No newline at end of file
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[397],{69397:function(e,t,a){a.r(t),a.d(t,{default:function(){return S}});var o=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("page-view",{attrs:{"sub-title":e.sheetToStage.inProgress?"当前内容已保存,但还未发布。":"",title:e.sheetToStage.title?e.sheetToStage.title:"新页面",affix:""}},[a("template",{slot:"extra"},[a("a-space",[a("a-button",{attrs:{loading:e.previewSaving},on:{click:e.handlePreviewClick}},[e._v("预览")]),a("a-button",{attrs:{type:"primary"},on:{click:function(t){e.sheetSettingVisible=!0}}},[e._v("发布")])],1)],1),a("a-row",{attrs:{gutter:12}},[a("a-col",{attrs:{span:24}},[a("div",{staticClass:"mb-4"},[a("a-input",{attrs:{placeholder:"请输入页面标题",size:"large"},model:{value:e.sheetToStage.title,callback:function(t){e.$set(e.sheetToStage,"title",t)},expression:"sheetToStage.title"}})],1),a("div",{style:{height:e.editorHeight},attrs:{id:"editor"}},[a("MarkdownEditor",{attrs:{originalContent:e.sheetToStage.originalContent},on:{"update:originalContent":function(t){return e.$set(e.sheetToStage,"originalContent",t)},"update:original-content":function(t){return e.$set(e.sheetToStage,"originalContent",t)},change:e.onContentChange,save:function(t){return e.handleSaveDraft()}}})],1)])],1),a("SheetSettingModal",{attrs:{post:e.sheetToStage,savedCallback:e.onSheetSavedCallback,visible:e.sheetSettingVisible},on:{"update:visible":function(t){e.sheetSettingVisible=t},onUpdate:e.onUpdateFromSetting}})],2)},s=[],i=a(50990),r=a(70014),l=a(26815),n=a(3832),d=a(86637),m=a(1540),h=a(86763),c=a.n(h),u={components:{PageView:i.B4,SheetSettingModal:r.Z,MarkdownEditor:l.Z},mixins:[n.jB,n.KT,n.g3],data(){return{sheetSettingVisible:!1,sheetToStage:{},contentChanges:0,previewSaving:!1}},beforeRouteEnter(e,t,a){const o=e.query.sheetId;a((async e=>{if(o){const{data:t}=await m.Z.sheet.get(Number(o));e.sheetToStage=t}}))},destroyed:function(){window.onbeforeunload&&(window.onbeforeunload=null)},beforeRouteLeave(e,t,a){const o=this.$createElement;this.contentChanges<=1?a():this.$confirm({title:"当前页面数据未保存,确定要离开吗?",content:()=>o("div",{style:"color:red;"},["如果离开当面页面,你的数据很可能会丢失!"]),onOk(){a()},onCancel(){a(!1)}})},mounted(){window.onbeforeunload=function(e){return e=e||window.event,e&&(e.returnValue="当前页面数据未保存,确定要离开吗?"),"当前页面数据未保存,确定要离开吗?"}},beforeMount(){document.addEventListener("keydown",this.onRegisterSaveShortcut)},beforeDestroy(){document.removeEventListener("keydown",this.onRegisterSaveShortcut)},methods:{onRegisterSaveShortcut(e){!e.ctrlKey&&!e.metaKey||e.altKey||e.shiftKey||83!==e.keyCode||(e.preventDefault(),e.stopPropagation(),this.handleSaveDraft())},handleSaveDraft:c()((async function(){if(this.sheetToStage.id)try{const{data:e}=await m.Z.sheet.updateDraftById(this.sheetToStage.id,this.sheetToStage.originalContent,this.sheetToStage.content,!0);this.sheetToStage.inProgress=e.inProgress,this.handleRestoreSavedStatus(),this.$message.success({content:"内容已保存",duration:.5})}catch(e){this.$log.error("Failed to update sheet content",e)}else await this.handleCreateSheet()}),300),async handleCreateSheet(){this.sheetToStage.title||(this.sheetToStage.title=(0,d._)(new Date,"YYYY-MM-DD-HH-mm-ss"));try{this.sheetToStage.keepRaw=!0;const{data:e}=await m.Z.sheet.create(this.sheetToStage);this.sheetToStage=e,this.handleRestoreSavedStatus();const t=this.$router.history.current.path;this.$router.replace({path:t,query:{sheetId:this.sheetToStage.id}}).catch((e=>e)),this.$message.success({content:"页面已创建",duration:.5})}catch(e){this.$log.error("Failed to create sheet",e)}},async handlePreviewClick(){if(this.previewSaving=!0,this.sheetToStage.id){const{data:e}=await m.Z.sheet.updateDraftById(this.sheetToStage.id,this.sheetToStage.originalContent,this.sheetToStage.content,!0);this.sheetToStage.inProgress=e.inProgress}else await this.handleCreateSheet();await this.handleOpenPreview()},async handleOpenPreview(){try{const e=await m.Z.sheet.getPreviewLinkById(this.sheetToStage.id);window.open(e,"_blank"),this.handleRestoreSavedStatus()}catch(e){this.$log.error("Failed to get preview link",e)}finally{setTimeout((()=>{this.previewSaving=!1}),400)}},handleRestoreSavedStatus(){this.contentChanges=0},onContentChange({originalContent:e,renderContent:t}){this.contentChanges++,this.sheetToStage.originalContent=e,this.sheetToStage.content=t},onSheetSavedCallback(){this.contentChanges=0,this.$router.push({name:"SheetList",query:{activeKey:"custom"}})},onUpdateFromSetting(e){this.sheetToStage=e}}},f=u,p=a(18156),g=(0,p.Z)(f,o,s,!1,null,null,null),S=g.exports},70014:function(e,t,a){a.d(t,{Z:function(){return g}});var o=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("a-modal",{attrs:{afterClose:e.onClosed,bodyStyle:{padding:0},maskClosable:!1,width:680,destroyOnClose:""},scopedSlots:e._u([{key:"title",fn:function(){return[e._v(" "+e._s(e.modalTitle)+" "),e.loading?a("a-icon",{attrs:{type:"loading"}}):e._e()]},proxy:!0}]),model:{value:e.modalVisible,callback:function(t){e.modalVisible=t},expression:"modalVisible"}},[a("div",{staticClass:"card-container"},[a("a-tabs",{attrs:{type:"card"}},[a("a-tab-pane",{key:"normal",attrs:{tab:"常规"}},[a("a-form",{attrs:{"label-col":{span:4},"wrapper-col":{span:20},labelAlign:"left"}},[a("a-form-item",{attrs:{label:"页面标题"}},[a("a-input",{model:{value:e.form.model.title,callback:function(t){e.$set(e.form.model,"title",t)},expression:"form.model.title"}})],1),a("a-form-item",{attrs:{help:e.fullPath,label:"页面别名"}},[a("a-input",{scopedSlots:e._u([{key:"addonAfter",fn:function(){return[a("a-popconfirm",{attrs:{"cancel-text":"取消","ok-text":"确定",placement:"left",title:"是否确定根据标题重新生成别名?"},on:{confirm:e.handleGenerateSlug}},[a("a-icon",{staticClass:"cursor-pointer",attrs:{type:"sync"}})],1)]},proxy:!0}]),model:{value:e.form.model.slug,callback:function(t){e.$set(e.form.model,"slug",t)},expression:"form.model.slug"}})],1),a("a-form-item",{attrs:{label:"摘要"}},[a("a-input",{attrs:{autoSize:{minRows:5},placeholder:"如不填写,会从页面中自动截取",type:"textarea"},model:{value:e.form.model.summary,callback:function(t){e.$set(e.form.model,"summary",t)},expression:"form.model.summary"}})],1)],1)],1),a("a-tab-pane",{key:"advanced",attrs:{tab:"高级"}},[a("a-form",{attrs:{"label-col":{span:4},"wrapper-col":{span:20},labelAlign:"left"}},[a("a-form-item",{attrs:{label:"禁止评论"}},[a("a-switch",{model:{value:e.form.model.disallowComment,callback:function(t){e.$set(e.form.model,"disallowComment",t)},expression:"form.model.disallowComment"}})],1),a("a-form-item",{attrs:{label:"发表时间:"}},[a("a-date-picker",{attrs:{defaultValue:e.createTimeDefaultValue,format:"YYYY-MM-DD HH:mm:ss",placeholder:"选择页面发表时间",showTime:""},on:{change:e.onCreateTimeSelect,ok:e.onCreateTimeSelect}})],1),a("a-form-item",{attrs:{label:"自定义模板:"}},[a("a-select",{model:{value:e.form.model.template,callback:function(t){e.$set(e.form.model,"template",t)},expression:"form.model.template"}},[a("a-select-option",{key:"",attrs:{value:""}},[e._v("")]),e._l(e.templates,(function(t){return a("a-select-option",{key:t,attrs:{value:t}},[e._v(" "+e._s(t)+" ")])}))],2)],1),a("a-form-item",{attrs:{label:"封面图:"}},[a("div",{staticClass:"post-thumb"},[a("a-space",{attrs:{direction:"vertical"}},[a("img",{staticClass:"img",attrs:{src:e.form.model.thumbnail||"/images/placeholder.jpg",alt:"Post cover thumbnail"},on:{click:function(t){e.attachmentSelectVisible=!0}}}),a("a-input",{attrs:{"allow-clear":"",placeholder:"点击封面图选择图片,或者输入外部链接"},model:{value:e.form.model.thumbnail,callback:function(t){e.$set(e.form.model,"thumbnail",t)},expression:"form.model.thumbnail"}})],1)],1)])],1)],1),a("a-tab-pane",{key:"seo",attrs:{tab:"SEO"}},[a("a-form",{attrs:{"label-col":{span:4},"wrapper-col":{span:20},labelAlign:"left"}},[a("a-form-item",{attrs:{label:"自定义关键词"}},[a("a-input",{attrs:{autoSize:{minRows:5},placeholder:"多个关键词以英文逗号隔开",type:"textarea"},model:{value:e.form.model.metaKeywords,callback:function(t){e.$set(e.form.model,"metaKeywords",t)},expression:"form.model.metaKeywords"}})],1),a("a-form-item",{attrs:{label:"自定义描述"}},[a("a-input",{attrs:{autoSize:{minRows:5},placeholder:"如不填写,会从页面中自动截取",type:"textarea"},model:{value:e.form.model.metaDescription,callback:function(t){e.$set(e.form.model,"metaDescription",t)},expression:"form.model.metaDescription"}})],1)],1)],1),a("a-tab-pane",{key:"meta",attrs:{tab:"元数据"}},[a("MetaEditor",{attrs:{metas:e.form.model.metas,targetId:e.form.model.id,target:"sheet"},on:{"update:metas":function(t){return e.$set(e.form.model,"metas",t)}}})],1)],1)],1),a("template",{slot:"footer"},[e._t("extraFooter"),a("a-button",{attrs:{disabled:e.loading},on:{click:function(t){e.modalVisible=!1}}},[e._v(" 关闭")]),e.form.model.id?e._e():a("ReactiveButton",{attrs:{errored:e.form.draftSaveErrored,loading:e.form.draftSaving,erroredText:"保存失败",loadedText:"保存成功",text:"保存草稿",type:"danger"},on:{callback:e.handleSavedCallback,click:function(t){return e.handleCreateOrUpdate("DRAFT")}}}),a("ReactiveButton",{attrs:{errored:e.form.saveErrored,erroredText:(e.form.model.id?"保存":"发布")+"失败",loadedText:(e.form.model.id?"保存":"发布")+"成功",loading:e.form.saving,text:e.form.model.id?"保存":"发布"},on:{callback:e.handleSavedCallback,click:function(t){return e.handleCreateOrUpdate()}}})],2),a("AttachmentSelectModal",{attrs:{multiSelect:!1,visible:e.attachmentSelectVisible},on:{"update:visible":function(t){e.attachmentSelectVisible=t},confirm:e.handleSelectSheetThumbnail}})],2)},s=[],i=a(59563),r=a(3832),l=a(86637),n=a(73511),d=a.n(n),m=a(98906),h=a(1540),c={name:"SheetSettingModal",mixins:[r.jB,r.KT],components:{MetaEditor:i.Z},props:{visible:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},post:{type:Object,default:()=>({})},savedCallback:{type:Function,default:null}},data(){return{form:{model:{},saving:!1,saveErrored:!1,draftSaving:!1,draftSaveErrored:!1},templates:[],attachmentSelectVisible:!1}},computed:{...(0,m.Se)(["options"]),modalVisible:{get(){return this.visible},set(e){this.$emit("update:visible",e)}},modalTitle(){return this.form.model.id?"页面设置":"页面发布"},createTimeDefaultValue(){if(this.form.model.createTime){const e=new Date(this.form.model.createTime);return(0,l._)(e,"YYYY-MM-DD HH:mm:ss")}return(0,l._)(new Date,"YYYY-MM-DD HH:mm:ss")},fullPath(){const e=this.options.sheet_permalink_type,t=this.options.blog_url,a=this.options.sheet_prefix,o=this.options.path_suffix?this.options.path_suffix:"",s=this.form.model.slug||"{slug}";switch(e){case"SECONDARY":return`${t}/${a}/${s}${o}`;case"ROOT":return`${t}/${s}${o}`;default:return""}}},watch:{modalVisible(e){e&&(this.form.model=Object.assign({},this.post),this.form.model.slug||this.form.model.id||this.handleGenerateSlug())},post:{deep:!0,handler(e){this.form.model=Object.assign({},e)}}},created(){this.handleListCustomTemplates()},methods:{async handleCreateOrUpdate(e="PUBLISHED"){if(!this.form.model.title)return void this.$notification["error"]({message:"提示",description:"页面标题不能为空!"});this.form.model.status=e,this.form.model.keepRaw=!0;const{id:t,status:a}=this.form.model;try{this.form["PUBLISHED"===a?"saving":"draftSaving"]=!0,t?await h.Z.sheet.update(t,this.form.model):await h.Z.sheet.create(this.form.model)}catch(o){this.form["PUBLISHED"===a?"saveErrored":"draftSaveErrored"]=!0,this.$log.error(o)}finally{setTimeout((()=>{this.form.saving=!1,this.form.draftSaving=!1}),400)}},handleSavedCallback(){this.form.saveErrored||this.form.draftSaveErrored?(this.form.saveErrored=!1,this.form.draftSaveErrored=!1):this.savedCallback&&this.savedCallback()},async handleListCustomTemplates(){try{const e=await h.Z.theme.listCustomSheetTemplates();this.templates=e.data}catch(e){this.$log.error(e)}},onCreateTimeSelect(e){this.form.model.createTime=e.valueOf()},handleGenerateSlug(){if(this.form.model.title&&d().isSupported()){let e="";const t=d().parse(this.form.model.title.replace(/\s+/g,"").toLowerCase());let a;t.forEach((t=>{if(2===t.type){const o=t.target?t.target.toLowerCase():"";e+=e&&!/\n|\s/.test(a.target)?"-"+o:o}else e+=(a&&2===a.type?"-":"")+t.target;a=t})),this.$set(this.form.model,"slug",e)}},handleSelectSheetThumbnail({raw:e}){e.length&&(this.form.model.thumbnail=encodeURI(e[0].path)),this.attachmentSelectVisible=!1},onClosed(){this.$emit("onClose"),this.$emit("onUpdate",this.form.model)}}},u=c,f=a(18156),p=(0,f.Z)(u,o,s,!1,null,null,null),g=p.exports}}]);
\ No newline at end of file
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[403],{52403:function(t,e,n){n.r(e),n.d(e,{default:function(){return w}});var o=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("page-view",{attrs:{"sub-title":t.postToStage.inProgress?"当前内容已保存,但还未发布。":"",title:t.postToStage.title?t.postToStage.title:"新文章",affix:""}},[n("template",{slot:"extra"},[n("a-space",[n("a-button",{attrs:{loading:t.previewSaving},on:{click:t.handlePreviewClick}},[t._v("预览")]),n("a-button",{attrs:{type:"primary"},on:{click:function(e){t.postSettingVisible=!0}}},[t._v("发布")])],1)],1),n("a-row",{attrs:{gutter:12}},[n("a-col",{attrs:{span:24}},[n("div",{staticClass:"mb-4"},[n("a-input",{attrs:{placeholder:"请输入文章标题",size:"large"},model:{value:t.postToStage.title,callback:function(e){t.$set(t.postToStage,"title",e)},expression:"postToStage.title"}})],1),n("div",{style:{height:t.editorHeight},attrs:{id:"editor"}},[n("MarkdownEditor",{attrs:{originalContent:t.postToStage.originalContent},on:{"update:originalContent":function(e){return t.$set(t.postToStage,"originalContent",e)},"update:original-content":function(e){return t.$set(t.postToStage,"originalContent",e)},change:t.onContentChange,save:function(e){return t.handleSaveDraft()}}})],1)])],1),n("PostSettingModal",{attrs:{post:t.postToStage,savedCallback:t.onPostSavedCallback,visible:t.postSettingVisible},on:{"update:visible":function(e){t.postSettingVisible=e},onUpdate:t.onUpdateFromSetting}})],2)},r=[],a=n(91057),i=(n(70315),n(12566),n(92158)),s=n(26815),u=n(50990),c=n(3832),l=n(86637),p=n(1540),g=n(86763),d=n.n(g),h={mixins:[c.jB,c.KT,c.g3],components:{PostSettingModal:i.Z,MarkdownEditor:s.Z,PageView:u.B4},data:function(){return{postSettingVisible:!1,postToStage:{},contentChanges:0,previewSaving:!1}},beforeRouteEnter:function(t,e,n){var o=t.query.postId;n(function(){var t=(0,a.Z)(regeneratorRuntime.mark((function t(e){var n,r;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(!o){t.next=6;break}return t.next=3,p.Z.post.get(Number(o));case 3:n=t.sent,r=n.data,e.postToStage=r;case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())},destroyed:function(){window.onbeforeunload&&(window.onbeforeunload=null)},beforeRouteLeave:function(t,e,n){var o=this.$createElement;this.contentChanges<=1?n():this.$confirm({title:"当前页面数据未保存,确定要离开吗?",content:function(){return o("div",{style:"color:red;"},["如果离开当面页面,你的数据很可能会丢失!"])},onOk:function(){n()},onCancel:function(){n(!1)}})},mounted:function(){window.onbeforeunload=function(t){return t=t||window.event,t&&(t.returnValue="当前页面数据未保存,确定要离开吗?"),"当前页面数据未保存,确定要离开吗?"}},beforeMount:function(){document.addEventListener("keydown",this.onRegisterSaveShortcut)},beforeDestroy:function(){document.removeEventListener("keydown",this.onRegisterSaveShortcut)},methods:{onRegisterSaveShortcut:function(t){!t.ctrlKey&&!t.metaKey||t.altKey||t.shiftKey||83!==t.keyCode||(t.preventDefault(),t.stopPropagation(),this.handleSaveDraft())},handleSaveDraft:d()((0,a.Z)(regeneratorRuntime.mark((function t(){var e,n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(!this.postToStage.id){t.next=16;break}return t.prev=1,t.next=4,p.Z.post.updateDraftById(this.postToStage.id,this.postToStage.originalContent,this.postToStage.content,!0);case 4:e=t.sent,n=e.data,this.postToStage.inProgress=n.inProgress,this.handleRestoreSavedStatus(),this.$message.success({content:"内容已保存",duration:.5}),t.next=14;break;case 11:t.prev=11,t.t0=t["catch"](1),this.$log.error("Failed to update post content",t.t0);case 14:t.next=18;break;case 16:return t.next=18,this.handleCreatePost();case 18:case"end":return t.stop()}}),t,this,[[1,11]])}))),300),handleCreatePost:function(){var t=this;return(0,a.Z)(regeneratorRuntime.mark((function e(){var n,o,r;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return t.postToStage.title||(t.postToStage.title=(0,l._)(new Date,"YYYY-MM-DD-HH-mm-ss")),e.prev=1,t.postToStage.keepRaw=!0,e.next=5,p.Z.post.create(t.postToStage);case 5:n=e.sent,o=n.data,t.postToStage=o,t.handleRestoreSavedStatus(),r=t.$router.history.current.path,t.$router.push({path:r,query:{postId:t.postToStage.id}}).catch((function(t){return t})),t.$message.success({content:"文章已创建",duration:.5}),e.next=17;break;case 14:e.prev=14,e.t0=e["catch"](1),t.$log.error("Failed to create post",e.t0);case 17:case"end":return e.stop()}}),e,null,[[1,14]])})))()},handlePreviewClick:function(){var t=this;return(0,a.Z)(regeneratorRuntime.mark((function e(){var n,o;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(t.previewSaving=!0,!t.postToStage.id){e.next=9;break}return e.next=4,p.Z.post.updateDraftById(t.postToStage.id,t.postToStage.originalContent,t.postToStage.content,!0);case 4:n=e.sent,o=n.data,t.postToStage.inProgress=o.inProgress,e.next=11;break;case 9:return e.next=11,t.handleCreatePost();case 11:return e.next=13,t.handleOpenPreview();case 13:case"end":return e.stop()}}),e)})))()},handleOpenPreview:function(){var t=this;return(0,a.Z)(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,p.Z.post.getPreviewLinkById(t.postToStage.id);case 3:n=e.sent,window.open(n,"_blank"),t.handleRestoreSavedStatus(),e.next=11;break;case 8:e.prev=8,e.t0=e["catch"](0),t.$log.error("Failed to get preview link",e.t0);case 11:return e.prev=11,setTimeout((function(){t.previewSaving=!1}),400),e.finish(11);case 14:case"end":return e.stop()}}),e,null,[[0,8,11,14]])})))()},handleRestoreSavedStatus:function(){this.contentChanges=0},onContentChange:function(t){var e=t.originalContent,n=t.renderContent;this.contentChanges++,this.postToStage.originalContent=e,this.postToStage.content=n},onPostSavedCallback:function(){this.contentChanges=0,this.$router.push({name:"PostList"})},onUpdateFromSetting:function(t){this.postToStage=t}}},v=h,f=n(18156),S=(0,f.Z)(v,o,r,!1,null,null,null),w=S.exports}}]);
\ No newline at end of file
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[403],{52403:function(t,e,o){o.r(e),o.d(e,{default:function(){return w}});var n=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("page-view",{attrs:{"sub-title":t.postToStage.inProgress?"当前内容已保存,但还未发布。":"",title:t.postToStage.title?t.postToStage.title:"新文章",affix:""}},[o("template",{slot:"extra"},[o("a-space",[o("a-button",{attrs:{loading:t.previewSaving},on:{click:t.handlePreviewClick}},[t._v("预览")]),o("a-button",{attrs:{type:"primary"},on:{click:function(e){t.postSettingVisible=!0}}},[t._v("发布")])],1)],1),o("a-row",{attrs:{gutter:12}},[o("a-col",{attrs:{span:24}},[o("div",{staticClass:"mb-4"},[o("a-input",{attrs:{placeholder:"请输入文章标题",size:"large"},model:{value:t.postToStage.title,callback:function(e){t.$set(t.postToStage,"title",e)},expression:"postToStage.title"}})],1),o("div",{style:{height:t.editorHeight},attrs:{id:"editor"}},[o("MarkdownEditor",{attrs:{originalContent:t.postToStage.originalContent},on:{"update:originalContent":function(e){return t.$set(t.postToStage,"originalContent",e)},"update:original-content":function(e){return t.$set(t.postToStage,"originalContent",e)},change:t.onContentChange,save:function(e){return t.handleSaveDraft()}}})],1)])],1),o("PostSettingModal",{attrs:{post:t.postToStage,savedCallback:t.onPostSavedCallback,visible:t.postSettingVisible},on:{"update:visible":function(e){t.postSettingVisible=e},onUpdate:t.onUpdateFromSetting}})],2)},a=[],s=o(92158),i=o(26815),r=o(50990),l=o(3832),d=o(86637),h=o(1540),g=o(86763),p=o.n(g),c={mixins:[l.jB,l.KT,l.g3],components:{PostSettingModal:s.Z,MarkdownEditor:i.Z,PageView:r.B4},data(){return{postSettingVisible:!1,postToStage:{},contentChanges:0,previewSaving:!1}},beforeRouteEnter(t,e,o){const n=t.query.postId;o((async t=>{if(n){const{data:e}=await h.Z.post.get(Number(n));t.postToStage=e}}))},destroyed(){window.onbeforeunload&&(window.onbeforeunload=null)},beforeRouteLeave(t,e,o){const n=this.$createElement;this.contentChanges<=1?o():this.$confirm({title:"当前页面数据未保存,确定要离开吗?",content:()=>n("div",{style:"color:red;"},["如果离开当面页面,你的数据很可能会丢失!"]),onOk(){o()},onCancel(){o(!1)}})},mounted(){window.onbeforeunload=function(t){return t=t||window.event,t&&(t.returnValue="当前页面数据未保存,确定要离开吗?"),"当前页面数据未保存,确定要离开吗?"}},beforeMount(){document.addEventListener("keydown",this.onRegisterSaveShortcut)},beforeDestroy(){document.removeEventListener("keydown",this.onRegisterSaveShortcut)},methods:{onRegisterSaveShortcut(t){!t.ctrlKey&&!t.metaKey||t.altKey||t.shiftKey||83!==t.keyCode||(t.preventDefault(),t.stopPropagation(),this.handleSaveDraft())},handleSaveDraft:p()((async function(){if(this.postToStage.id)try{const{data:t}=await h.Z.post.updateDraftById(this.postToStage.id,this.postToStage.originalContent,this.postToStage.content,!0);this.postToStage.inProgress=t.inProgress,this.handleRestoreSavedStatus(),this.$message.success({content:"内容已保存",duration:.5})}catch(t){this.$log.error("Failed to update post content",t)}else await this.handleCreatePost()}),300),async handleCreatePost(){this.postToStage.title||(this.postToStage.title=(0,d._)(new Date,"YYYY-MM-DD-HH-mm-ss"));try{this.postToStage.keepRaw=!0;const{data:t}=await h.Z.post.create(this.postToStage);this.postToStage=t,this.handleRestoreSavedStatus();const e=this.$router.history.current.path;this.$router.push({path:e,query:{postId:this.postToStage.id}}).catch((t=>t)),this.$message.success({content:"文章已创建",duration:.5})}catch(t){this.$log.error("Failed to create post",t)}},async handlePreviewClick(){if(this.previewSaving=!0,this.postToStage.id){const{data:t}=await h.Z.post.updateDraftById(this.postToStage.id,this.postToStage.originalContent,this.postToStage.content,!0);this.postToStage.inProgress=t.inProgress}else await this.handleCreatePost();await this.handleOpenPreview()},async handleOpenPreview(){try{const t=await h.Z.post.getPreviewLinkById(this.postToStage.id);window.open(t,"_blank"),this.handleRestoreSavedStatus()}catch(t){this.$log.error("Failed to get preview link",t)}finally{setTimeout((()=>{this.previewSaving=!1}),400)}},handleRestoreSavedStatus(){this.contentChanges=0},onContentChange({originalContent:t,renderContent:e}){this.contentChanges++,this.postToStage.originalContent=t,this.postToStage.content=e},onPostSavedCallback(){this.contentChanges=0,this.$router.push({name:"PostList"})},onUpdateFromSetting(t){this.postToStage=t}}},u=c,S=o(18156),v=(0,S.Z)(u,n,a,!1,null,null,null),w=v.exports}}]);
\ No newline at end of file
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[415],{59563:function(t,e,n){n.d(e,{Z:function(){return i}});var N=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("a-form",t._l(t.presetMetas,(function(e,N){return n("a-form-item",{key:N},[n("a-row",{attrs:{gutter:5}},[n("a-col",{attrs:{span:12}},[n("a-input",{attrs:{disabled:!0},scopedSlots:t._u([{key:"addonBefore",fn:function(){return[n("i",[t._v("K")])]},proxy:!0}],null,!0),model:{value:e.key,callback:function(n){t.$set(e,"key",n)},expression:"meta.key"}})],1),n("a-col",{attrs:{span:12}},[n("a-input",{scopedSlots:t._u([{key:"addonBefore",fn:function(){return[n("i",[t._v("V")])]},proxy:!0}],null,!0),model:{value:e.value,callback:function(n){t.$set(e,"value",n)},expression:"meta.value"}})],1)],1)],1)})),1),n("a-form",[t._l(t.customMetas,(function(e,N){return n("a-form-item",{key:N},[n("a-row",{attrs:{gutter:5}},[n("a-col",{attrs:{span:12}},[n("a-input",{scopedSlots:t._u([{key:"addonBefore",fn:function(){return[n("i",[t._v("K")])]},proxy:!0}],null,!0),model:{value:e.key,callback:function(n){t.$set(e,"key",n)},expression:"meta.key"}})],1),n("a-col",{attrs:{span:12}},[n("a-input",{scopedSlots:t._u([{key:"addonBefore",fn:function(){return[n("i",[t._v("V")])]},proxy:!0},{key:"addonAfter",fn:function(){return[n("a-button",{staticClass:"!p-0 !h-auto",attrs:{type:"link"},on:{click:function(e){return e.preventDefault(),t.handleRemove(N)}}},[n("a-icon",{attrs:{type:"close"}})],1)]},proxy:!0}],null,!0),model:{value:e.value,callback:function(n){t.$set(e,"value",n)},expression:"meta.value"}})],1)],1)],1)})),n("a-form-item",[n("a-button",{attrs:{type:"dashed"},on:{click:t.handleAdd}},[t._v("新增")])],1)],2)],1)},r=[],a=n(91057),o=(n(70315),n(12566),n(82395),n(62888),n(31875),n(90195),n(55792),n(41479),n(1540)),A={name:"MetaEditor",props:{target:{type:String,default:"post",validator:function(t){return-1!==["post","sheet"].indexOf(t)}},targetId:{type:Number,default:null},metas:{type:Array,default:function(){return[]}}},data:function(){return{presetFields:[],presetMetas:[],customMetas:[]}},watch:{presetMetas:{handler:function(){this.handleChange()},deep:!0},customMetas:{handler:function(){this.handleChange()},deep:!0},targetId:function(){this.handleGenerateMetas()}},created:function(){this.handleListPresetMetasField()},methods:{handleListPresetMetasField:function(){var t=this;return(0,a.Z)(regeneratorRuntime.mark((function e(){var n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,o.Z.theme.getActivatedTheme();case 3:n=e.sent,t.presetFields=n.data["".concat(t.target,"MetaField")]||[],t.handleGenerateMetas(),e.next=11;break;case 8:e.prev=8,e.t0=e["catch"](0),t.$log.error(e.t0);case 11:case"end":return e.stop()}}),e,null,[[0,8]])})))()},handleGenerateMetas:function(){var t=this;this.presetMetas=this.presetFields.map((function(e){var n=t.metas.find((function(t){return t.key===e}));return n?{key:e,value:n.value}:{key:e,value:""}})),this.customMetas=this.metas.filter((function(e){return-1===t.presetFields.indexOf(e.key)})).map((function(t){return{key:t.key,value:t.value}}))},handleAdd:function(){this.customMetas.push({key:"",value:""})},handleRemove:function(t){this.customMetas.splice(t,1)},handleChange:function(){this.$emit("update:metas",this.presetMetas.concat(this.customMetas))}}},I=A,u=n(18156),U=(0,u.Z)(I,N,r,!1,null,null,null),i=U.exports},55792:function(t,e,n){var N=n(79644),r=n(8432),a=n(64235),o=n(69343),A=n(71768),I=n(43207),u=n(9510),U=n(51903),i=n(43297),s=i("splice"),l=r.TypeError,c=Math.max,G=Math.min,f=9007199254740991,O="Maximum allowed length exceeded";N({target:"Array",proto:!0,forced:!s},{splice:function(t,e){var n,N,r,i,s,H,E=I(this),p=A(E),d=a(t,p),h=arguments.length;if(0===h?n=N=0:1===h?(n=0,N=p-d):(n=h-2,N=G(c(o(e),0),p-d)),p+n-N>f)throw l(O);for(r=u(E,N),i=0;i<N;i++)s=d+i,s in E&&U(r,i,E[s]);if(r.length=N,n<N){for(i=d;i<p-N;i++)s=i+N,H=i+n,s in E?E[H]=E[s]:delete E[H];for(i=p;i>p-N+n;i--)delete E[i-1]}else if(n>N)for(i=p-N;i>d;i--)s=i+N-1,H=i+n-1,s in E?E[H]=E[s]:delete E[H];for(i=0;i<n;i++)E[i+d]=arguments[i+2];return E.length=p-N+n,r}})},21434:function(t,e,n){var N="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=n(15087),a="",o="鿿",A=1,I=2,u=3,U=null,i=void 0;function s(t){t&&("function"===typeof t&&(t=[t]),t.forEach&&t.forEach((function(t){"function"===typeof t&&t(r)})))}function l(t){return t||null===U?("object"===("undefined"===typeof Intl?"undefined":N(Intl))&&Intl.Collator?(i=new Intl.Collator(["zh-Hans-CN","zh-CN"]),U=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):U=!1,U):U}function c(t){var e=r.UNIHANS,n=r.PINYINS,N=r.EXCEPTIONS,U={source:t};if(t in N)return U.type=I,U.target=N[t],U;var s=-1,l=void 0;if(t.charCodeAt(0)<256)return U.type=A,U.target=t,U;if(l=i.compare(t,a),l<0)return U.type=u,U.target=t,U;if(0===l)U.type=I,s=0;else{if(l=i.compare(t,o),l>0)return U.type=u,U.target=t,U;0===l&&(U.type=I,s=e.length-1)}if(U.type=I,s<0){var c=0,G=e.length-1;while(c<=G){s=~~((c+G)/2);var f=e[s];if(l=i.compare(t,f),0===l)break;l>0?c=s+1:G=s-1}}return l<0&&s--,U.target=n[s],U.target||(U.type=u,U.target=U.source),U}function G(t){if("string"!==typeof t)throw new Error("argument should be string.");if(!l())throw new Error("not support Intl or zh-CN language.");return t.split("").map((function(t){return c(t)}))}t.exports={isSupported:l,parse:G,patchDict:s,genToken:c,convertToPinyin:function(t,e,n){return G(t).map((function(t){return n&&t.type===I?t.target.toLowerCase():t.target})).join(e||"")}}},15087:function(t){var e=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","辿","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","怀","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],n=["A","AI","AN","ANG","AO","BA","BAI","BAN","BANG","BAO","BEI","BEN","BENG","BI","BIAN","BIAO","BIE","BIN","BING","BO","BU","CA","CAI","CAN","CANG","CAO","CE","CEN","CENG","CHA","CHAI","CHAN","CHANG","CHAO","CHE","CHEN","CHENG","CHI","CHONG","CHOU","CHU","CHUA","CHUAI","CHUAN","CHUANG","CHUI","CHUN","CHUO","CI","CONG","COU","CU","CUAN","CUI","CUN","CUO","DA","DAI","DAN","DANG","DAO","DE","DEN","DENG","DI","DIAN","DIAO","DIE","DING","DIU","DONG","DOU","DU","DUAN","DUI","DUN","DUO","E","EI","EN","ENG","ER","FA","FAN","FANG","FEI","FEN","FENG","FIAO","FO","FOU","FU","GA","GAI","GAN","GANG","GAO","GE","GEI","GEN","GENG","GONG","GOU","GU","GUA","GUAI","GUAN","GUANG","GUI","GUN","GUO","HA","HAI","HAN","HANG","HAO","HE","HEI","HEN","HENG","HM","HONG","HOU","HU","HUA","HUAI","HUAN","HUANG","HUI","HUN","HUO","JI","JIA","JIAN","JIANG","JIAO","JIE","JIN","JING","JIONG","JIU","JU","JUAN","JUE","JUN","KA","KAI","KAN","KANG","KAO","KE","KEN","KENG","KONG","KOU","KU","KUA","KUAI","KUAN","KUANG","KUI","KUN","KUO","LA","LAI","LAN","LANG","LAO","LE","LEI","LENG","LI","LIA","LIAN","LIANG","LIAO","LIE","LIN","LING","LIU","LO","LONG","LOU","LU","LV","LUAN","LVE","LUN","LUO","M","MA","MAI","MAN","MANG","MAO","ME","MEI","MEN","MENG","MI","MIAN","MIAO","MIE","MIN","MING","MIU","MO","MOU","MU","N","NA","NAI","NAN","NANG","NAO","NE","NEI","NEN","NENG","NI","NIAN","NIANG","NIAO","NIE","NIN","NING","NIU","NONG","NOU","NU","NV","NUAN","NVE","NUN","NUO","O","OU","PA","PAI","PAN","PANG","PAO","PEI","PEN","PENG","PI","PIAN","PIAO","PIE","PIN","PING","PO","POU","PU","QI","QIA","QIAN","QIANG","QIAO","QIE","QIN","QING","QIONG","QIU","QU","QUAN","QUE","QUN","RAN","RANG","RAO","RE","REN","RENG","RI","RONG","ROU","RU","RUA","RUAN","RUI","RUN","RUO","SA","SAI","SAN","SANG","SAO","SE","SEN","SENG","SHA","SHAI","SHAN","SHANG","SHAO","SHE","SHEN","SHENG","SHI","SHOU","SHU","SHUA","SHUAI","SHUAN","SHUANG","SHUI","SHUN","SHUO","SI","SONG","SOU","SU","SUAN","SUI","SUN","SUO","TA","TAI","TAN","TANG","TAO","TE","TENG","TI","TIAN","TIAO","TIE","TING","TONG","TOU","TU","TUAN","TUI","TUN","TUO","WA","WAI","WAN","WANG","WEI","WEN","WENG","WO","WU","XI","XIA","XIAN","XIANG","XIAO","XIE","XIN","XING","XIONG","XIU","XU","XUAN","XUE","XUN","YA","YAN","YANG","YAO","YE","YI","YIN","YING","YO","YONG","YOU","YU","YUAN","YUE","YUN","ZA","ZAI","ZAN","ZANG","ZAO","ZE","ZEI","ZEN","ZENG","ZHA","ZHAI","ZHAN","ZHANG","ZHAO","ZHE","ZHEN","ZHENG","ZHI","ZHONG","ZHOU","ZHU","ZHUA","ZHUAI","ZHUAN","ZHUANG","ZHUI","ZHUN","ZHUO","ZI","ZONG","ZOU","ZU","ZUAN","ZUI","ZUN","ZUO",""],N={"":"ZENG","":"SHEN","":"DIA","":"ZHOU","":"GUO","":"QUE","":"KE","":"HUA","":"MO","":"MO","":"PAN","":"XI","":"PAN","":"XIAN","":"XIN","":"CHI","":"XING","":"JUN","":"CHANG","":"ZHEN","":"SHI","":"NA","":"XIONG","":"SHUI"};t.exports={PINYINS:n,UNIHANS:e,EXCEPTIONS:N}},73511:function(t,e,n){var N=n(21434),r=n(59729);N.isSupported()&&r.shouldPatch(N.genToken)&&N.patchDict(r),t.exports=N},59729:function(t,e){e=t.exports=function(t){t.EXCEPTIONS={"":"DIA","":"ZHOU","":"GUO","":"QUE","":"KE","":"HUA","":"MO","":"XI","":"PAN","":"XIAN","":"CHI","":"XING","":"ZHEN","":"XIONG","":"SHUI","":"KE"},t.UNIHANS[91]="",t.UNIHANS[347]="",t.UNIHANS[393]="",t.UNIHANS[39]="",t.UNIHANS[50]="",t.UNIHANS[369]="",t.UNIHANS[123]="",t.UNIHANS[171]="",t.UNIHANS[102]="",t.UNIHANS[126]="",t.UNIHANS[176]="",t.UNIHANS[178]="",t.UNIHANS[252]="",t.UNIHANS[330]=""},e.shouldPatch=function(t){return"function"===typeof t&&("FOU"===t("").target&&"XIA"===t("").target&&"ZHONG"===t("").target&&"CHONG"===t("").target&&"CONG"===t("").target&&"YONG"===t("").target&&"HOU"===t("").target&&"LENG"===t("").target&&"GONG"===t("").target&&"HUAI"===t("").target&&"LIAO"===t("").target&&"LIN"===t("").target&&"E"===t("").target)}}}]);
\ No newline at end of file
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[415],{59563:function(t,e,N){N.d(e,{Z:function(){return s}});var n=function(){var t=this,e=t.$createElement,N=t._self._c||e;return N("div",[N("a-form",t._l(t.presetMetas,(function(e,n){return N("a-form-item",{key:n},[N("a-row",{attrs:{gutter:5}},[N("a-col",{attrs:{span:12}},[N("a-input",{attrs:{disabled:!0},scopedSlots:t._u([{key:"addonBefore",fn:function(){return[N("i",[t._v("K")])]},proxy:!0}],null,!0),model:{value:e.key,callback:function(N){t.$set(e,"key",N)},expression:"meta.key"}})],1),N("a-col",{attrs:{span:12}},[N("a-input",{scopedSlots:t._u([{key:"addonBefore",fn:function(){return[N("i",[t._v("V")])]},proxy:!0}],null,!0),model:{value:e.value,callback:function(N){t.$set(e,"value",N)},expression:"meta.value"}})],1)],1)],1)})),1),N("a-form",[t._l(t.customMetas,(function(e,n){return N("a-form-item",{key:n},[N("a-row",{attrs:{gutter:5}},[N("a-col",{attrs:{span:12}},[N("a-input",{scopedSlots:t._u([{key:"addonBefore",fn:function(){return[N("i",[t._v("K")])]},proxy:!0}],null,!0),model:{value:e.key,callback:function(N){t.$set(e,"key",N)},expression:"meta.key"}})],1),N("a-col",{attrs:{span:12}},[N("a-input",{scopedSlots:t._u([{key:"addonBefore",fn:function(){return[N("i",[t._v("V")])]},proxy:!0},{key:"addonAfter",fn:function(){return[N("a-button",{staticClass:"!p-0 !h-auto",attrs:{type:"link"},on:{click:function(e){return e.preventDefault(),t.handleRemove(n)}}},[N("a-icon",{attrs:{type:"close"}})],1)]},proxy:!0}],null,!0),model:{value:e.value,callback:function(N){t.$set(e,"value",N)},expression:"meta.value"}})],1)],1)],1)})),N("a-form-item",[N("a-button",{attrs:{type:"dashed"},on:{click:t.handleAdd}},[t._v("新增")])],1)],2)],1)},a=[],A=N(1540),r={name:"MetaEditor",props:{target:{type:String,default:"post",validator:function(t){return-1!==["post","sheet"].indexOf(t)}},targetId:{type:Number,default:null},metas:{type:Array,default:()=>[]}},data(){return{presetFields:[],presetMetas:[],customMetas:[]}},watch:{presetMetas:{handler(){this.handleChange()},deep:!0},customMetas:{handler(){this.handleChange()},deep:!0},targetId(){this.handleGenerateMetas()}},created(){this.handleListPresetMetasField()},methods:{async handleListPresetMetasField(){try{const t=await A.Z.theme.getActivatedTheme();this.presetFields=t.data[`${this.target}MetaField`]||[],this.handleGenerateMetas()}catch(t){this.$log.error(t)}},handleGenerateMetas(){this.presetMetas=this.presetFields.map((t=>{const e=this.metas.find((e=>e.key===t));return e?{key:t,value:e.value}:{key:t,value:""}})),this.customMetas=this.metas.filter((t=>-1===this.presetFields.indexOf(t.key))).map((t=>({key:t.key,value:t.value})))},handleAdd(){this.customMetas.push({key:"",value:""})},handleRemove(t){this.customMetas.splice(t,1)},handleChange(){this.$emit("update:metas",this.presetMetas.concat(this.customMetas))}}},I=r,o=N(18156),U=(0,o.Z)(I,n,a,!1,null,null,null),s=U.exports},21434:function(t,e,N){var n="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"===typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=N(15087),A="",r="鿿",I=1,o=2,U=3,s=null,u=void 0;function l(t){t&&("function"===typeof t&&(t=[t]),t.forEach&&t.forEach((function(t){"function"===typeof t&&t(a)})))}function i(t){return t||null===s?("object"===("undefined"===typeof Intl?"undefined":n(Intl))&&Intl.Collator?(u=new Intl.Collator(["zh-Hans-CN","zh-CN"]),s=1===Intl.Collator.supportedLocalesOf(["zh-CN"]).length):s=!1,s):s}function G(t){var e=a.UNIHANS,N=a.PINYINS,n=a.EXCEPTIONS,s={source:t};if(t in n)return s.type=o,s.target=n[t],s;var l=-1,i=void 0;if(t.charCodeAt(0)<256)return s.type=I,s.target=t,s;if(i=u.compare(t,A),i<0)return s.type=U,s.target=t,s;if(0===i)s.type=o,l=0;else{if(i=u.compare(t,r),i>0)return s.type=U,s.target=t,s;0===i&&(s.type=o,l=e.length-1)}if(s.type=o,l<0){var G=0,O=e.length-1;while(G<=O){l=~~((G+O)/2);var H=e[l];if(i=u.compare(t,H),0===i)break;i>0?G=l+1:O=l-1}}return i<0&&l--,s.target=N[l],s.target||(s.type=U,s.target=s.source),s}function O(t){if("string"!==typeof t)throw new Error("argument should be string.");if(!i())throw new Error("not support Intl or zh-CN language.");return t.split("").map((function(t){return G(t)}))}t.exports={isSupported:i,parse:O,patchDict:l,genToken:G,convertToPinyin:function(t,e,N){return O(t).map((function(t){return N&&t.type===o?t.target.toLowerCase():t.target})).join(e||"")}}},15087:function(t){var e=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","辿","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","怀","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""],N=["A","AI","AN","ANG","AO","BA","BAI","BAN","BANG","BAO","BEI","BEN","BENG","BI","BIAN","BIAO","BIE","BIN","BING","BO","BU","CA","CAI","CAN","CANG","CAO","CE","CEN","CENG","CHA","CHAI","CHAN","CHANG","CHAO","CHE","CHEN","CHENG","CHI","CHONG","CHOU","CHU","CHUA","CHUAI","CHUAN","CHUANG","CHUI","CHUN","CHUO","CI","CONG","COU","CU","CUAN","CUI","CUN","CUO","DA","DAI","DAN","DANG","DAO","DE","DEN","DENG","DI","DIAN","DIAO","DIE","DING","DIU","DONG","DOU","DU","DUAN","DUI","DUN","DUO","E","EI","EN","ENG","ER","FA","FAN","FANG","FEI","FEN","FENG","FIAO","FO","FOU","FU","GA","GAI","GAN","GANG","GAO","GE","GEI","GEN","GENG","GONG","GOU","GU","GUA","GUAI","GUAN","GUANG","GUI","GUN","GUO","HA","HAI","HAN","HANG","HAO","HE","HEI","HEN","HENG","HM","HONG","HOU","HU","HUA","HUAI","HUAN","HUANG","HUI","HUN","HUO","JI","JIA","JIAN","JIANG","JIAO","JIE","JIN","JING","JIONG","JIU","JU","JUAN","JUE","JUN","KA","KAI","KAN","KANG","KAO","KE","KEN","KENG","KONG","KOU","KU","KUA","KUAI","KUAN","KUANG","KUI","KUN","KUO","LA","LAI","LAN","LANG","LAO","LE","LEI","LENG","LI","LIA","LIAN","LIANG","LIAO","LIE","LIN","LING","LIU","LO","LONG","LOU","LU","LV","LUAN","LVE","LUN","LUO","M","MA","MAI","MAN","MANG","MAO","ME","MEI","MEN","MENG","MI","MIAN","MIAO","MIE","MIN","MING","MIU","MO","MOU","MU","N","NA","NAI","NAN","NANG","NAO","NE","NEI","NEN","NENG","NI","NIAN","NIANG","NIAO","NIE","NIN","NING","NIU","NONG","NOU","NU","NV","NUAN","NVE","NUN","NUO","O","OU","PA","PAI","PAN","PANG","PAO","PEI","PEN","PENG","PI","PIAN","PIAO","PIE","PIN","PING","PO","POU","PU","QI","QIA","QIAN","QIANG","QIAO","QIE","QIN","QING","QIONG","QIU","QU","QUAN","QUE","QUN","RAN","RANG","RAO","RE","REN","RENG","RI","RONG","ROU","RU","RUA","RUAN","RUI","RUN","RUO","SA","SAI","SAN","SANG","SAO","SE","SEN","SENG","SHA","SHAI","SHAN","SHANG","SHAO","SHE","SHEN","SHENG","SHI","SHOU","SHU","SHUA","SHUAI","SHUAN","SHUANG","SHUI","SHUN","SHUO","SI","SONG","SOU","SU","SUAN","SUI","SUN","SUO","TA","TAI","TAN","TANG","TAO","TE","TENG","TI","TIAN","TIAO","TIE","TING","TONG","TOU","TU","TUAN","TUI","TUN","TUO","WA","WAI","WAN","WANG","WEI","WEN","WENG","WO","WU","XI","XIA","XIAN","XIANG","XIAO","XIE","XIN","XING","XIONG","XIU","XU","XUAN","XUE","XUN","YA","YAN","YANG","YAO","YE","YI","YIN","YING","YO","YONG","YOU","YU","YUAN","YUE","YUN","ZA","ZAI","ZAN","ZANG","ZAO","ZE","ZEI","ZEN","ZENG","ZHA","ZHAI","ZHAN","ZHANG","ZHAO","ZHE","ZHEN","ZHENG","ZHI","ZHONG","ZHOU","ZHU","ZHUA","ZHUAI","ZHUAN","ZHUANG","ZHUI","ZHUN","ZHUO","ZI","ZONG","ZOU","ZU","ZUAN","ZUI","ZUN","ZUO",""],n={"":"ZENG","":"SHEN","":"DIA","":"ZHOU","":"GUO","":"QUE","":"KE","":"HUA","":"MO","":"MO","":"PAN","":"XI","":"PAN","":"XIAN","":"XIN","":"CHI","":"XING","":"JUN","":"CHANG","":"ZHEN","":"SHI","":"NA","":"XIONG","":"SHUI"};t.exports={PINYINS:N,UNIHANS:e,EXCEPTIONS:n}},73511:function(t,e,N){var n=N(21434),a=N(59729);n.isSupported()&&a.shouldPatch(n.genToken)&&n.patchDict(a),t.exports=n},59729:function(t,e){e=t.exports=function(t){t.EXCEPTIONS={"":"DIA","":"ZHOU","":"GUO","":"QUE","":"KE","":"HUA","":"MO","":"XI","":"PAN","":"XIAN","":"CHI","":"XING","":"ZHEN","":"XIONG","":"SHUI","":"KE"},t.UNIHANS[91]="",t.UNIHANS[347]="",t.UNIHANS[393]="",t.UNIHANS[39]="",t.UNIHANS[50]="",t.UNIHANS[369]="",t.UNIHANS[123]="",t.UNIHANS[171]="",t.UNIHANS[102]="",t.UNIHANS[126]="",t.UNIHANS[176]="",t.UNIHANS[178]="",t.UNIHANS[252]="",t.UNIHANS[330]=""},e.shouldPatch=function(t){return"function"===typeof t&&("FOU"===t("").target&&"XIA"===t("").target&&"ZHONG"===t("").target&&"CHONG"===t("").target&&"CONG"===t("").target&&"YONG"===t("").target&&"HOU"===t("").target&&"LENG"===t("").target&&"GONG"===t("").target&&"HUAI"===t("").target&&"LIAO"===t("").target&&"LIN"===t("").target&&"E"===t("").target)}}}]);
\ No newline at end of file
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[442],{90442:function(e,r,t){t.r(r),t.d(r,{default:function(){return v}});var n=function(){var e=this,r=e.$createElement,t=e._self._c||r;return t("a-form",{attrs:{wrapperCol:e.wrapperCol,layout:"vertical"}},[t("a-form-item",{attrs:{label:"开发者选项:"}},[t("a-switch",{model:{value:e.options.developer_mode,callback:function(r){e.$set(e.options,"developer_mode",r)},expression:"options.developer_mode"}})],1),t("a-form-item",[t("ReactiveButton",{attrs:{errored:e.errored,loading:e.saving,erroredText:"保存失败",loadedText:"保存成功",text:"保存",type:"primary"},on:{callback:function(r){e.errored=!1},click:e.handleSaveOptions}})],1)],1)},a=[],o=t(91057),s=t(76381),i=(t(30535),t(85018),t(70315),t(98906)),c=t(1540),l={name:"SettingsForm",data:function(){return{options:{},wrapperCol:{xl:{span:8},lg:{span:8},sm:{span:12},xs:{span:24}},saving:!1,errored:!1}},created:function(){this.handleListOptions()},methods:(0,s.Z)((0,s.Z)({},(0,i.nv)(["refreshOptionsCache"])),{},{handleListOptions:function(){var e=this;return(0,o.Z)(regeneratorRuntime.mark((function r(){var t,n;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,c.Z.option.listAsMapViewByKeys(["developer_mode"]);case 3:t=r.sent,n=t.data,e.options=n,r.next=11;break;case 8:r.prev=8,r.t0=r["catch"](0),e.$log.error(r.t0);case 11:case"end":return r.stop()}}),r,null,[[0,8]])})))()},handleSaveOptions:function(){var e=this;return(0,o.Z)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.prev=0,e.saving=!0,r.next=4,c.Z.option.saveMapView(e.options);case 4:r.next=10;break;case 6:r.prev=6,r.t0=r["catch"](0),e.errored=!1,e.$log.error(r.t0);case 10:return r.prev=10,setTimeout((function(){e.saving=!1}),400),r.next=14,e.handleListOptions();case 14:return r.next=16,e.refreshOptionsCache();case 16:if(e.options.developer_mode){r.next=19;break}return r.next=19,e.$router.replace({name:"ToolList"});case 19:return r.finish(10);case 20:case"end":return r.stop()}}),r,null,[[0,6,10,20]])})))()}})},p=l,u=t(18156),d=(0,u.Z)(p,n,a,!1,null,null,null),v=d.exports}}]);
\ No newline at end of file
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[442],{90442:function(e,t,a){a.r(t),a.d(t,{default:function(){return h}});var o=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("a-form",{attrs:{wrapperCol:e.wrapperCol,layout:"vertical"}},[a("a-form-item",{attrs:{label:"开发者选项:"}},[a("a-switch",{model:{value:e.options.developer_mode,callback:function(t){e.$set(e.options,"developer_mode",t)},expression:"options.developer_mode"}})],1),a("a-form-item",[a("ReactiveButton",{attrs:{errored:e.errored,loading:e.saving,erroredText:"保存失败",loadedText:"保存成功",text:"保存",type:"primary"},on:{callback:function(t){e.errored=!1},click:e.handleSaveOptions}})],1)],1)},r=[],s=a(98906),i=a(1540),n={name:"SettingsForm",data(){return{options:{},wrapperCol:{xl:{span:8},lg:{span:8},sm:{span:12},xs:{span:24}},saving:!1,errored:!1}},created(){this.handleListOptions()},methods:{...(0,s.nv)(["refreshOptionsCache"]),async handleListOptions(){try{const{data:e}=await i.Z.option.listAsMapViewByKeys(["developer_mode"]);this.options=e}catch(e){this.$log.error(e)}},async handleSaveOptions(){try{this.saving=!0,await i.Z.option.saveMapView(this.options)}catch(e){this.errored=!1,this.$log.error(e)}finally{setTimeout((()=>{this.saving=!1}),400),await this.handleListOptions(),await this.refreshOptionsCache(),this.options.developer_mode||await this.$router.replace({name:"ToolList"})}}}},l=n,p=a(18156),d=(0,p.Z)(l,o,r,!1,null,null,null),h=d.exports}}]);
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
"use strict";(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[497],{5497:function(e,t,a){a.r(t),a.d(t,{default:function(){return S}});var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("page-view",[a("a-row",{attrs:{gutter:12}},[a("a-col",{staticClass:"pb-3",attrs:{lg:8,md:8,sm:24,xl:8,xs:24}},[a("a-card",{attrs:{bodyStyle:{padding:"16px"},"head-style":{padding:"8px 16px!important"},title:e.title}},[a("a-form-model",{ref:"categoryForm",attrs:{model:e.form.model,rules:e.form.rules,layout:"horizontal"}},[a("a-form-model-item",{attrs:{help:"* 页面上所显示的名称",label:"名称:",prop:"name"}},[a("a-input",{ref:"nameInput",model:{value:e.form.model.name,callback:function(t){e.$set(e.form.model,"name",t)},expression:"form.model.name"}})],1),a("a-form-model-item",{attrs:{help:"* 一般为单个分类页面的标识,最好为英文",label:"别名:",prop:"slug"}},[a("a-input",{model:{value:e.form.model.slug,callback:function(t){e.$set(e.form.model,"slug",t)},expression:"form.model.slug"}})],1),a("a-form-model-item",{attrs:{label:"上级目录:",prop:"parentId"}},[a("category-select-tree",{attrs:{categories:e.list.data,"category-id":e.form.model.parentId},on:{"update:categoryId":function(t){return e.$set(e.form.model,"parentId",t)},"update:category-id":function(t){return e.$set(e.form.model,"parentId",t)}}})],1),a("a-form-model-item",{attrs:{help:"* 在分类页面可展示,需要主题支持",label:"封面图:",prop:"thumbnail"}},[a("AttachmentInput",{attrs:{title:"选择封面图"},model:{value:e.form.model.thumbnail,callback:function(t){e.$set(e.form.model,"thumbnail",t)},expression:"form.model.thumbnail"}})],1),a("a-form-model-item",{attrs:{help:"* 分类密码",label:"密码:",prop:"password"}},[a("a-input-password",{attrs:{autocomplete:"new-password"},model:{value:e.form.model.password,callback:function(t){e.$set(e.form.model,"password",t)},expression:"form.model.password"}})],1),a("a-form-model-item",{attrs:{help:"* 分类描述,需要主题支持",label:"描述:",prop:"description"}},[a("a-input",{attrs:{autoSize:{minRows:3},type:"textarea"},model:{value:e.form.model.description,callback:function(t){e.$set(e.form.model,"description",t)},expression:"form.model.description"}})],1),a("a-form-model-item",[e.isUpdateMode?a("a-button-group",[a("ReactiveButton",{attrs:{errored:e.form.errored,loading:e.form.saving,erroredText:"更新失败",loadedText:"更新成功",text:"更新",type:"primary"},on:{callback:e.handleSavedCallback,click:e.handleCreateOrUpdateCategory}}),a("a-button",{attrs:{type:"dashed"},on:{click:function(t){e.form.model={}}}},[e._v("返回添加")])],1):a("ReactiveButton",{attrs:{errored:e.form.errored,loading:e.form.saving,erroredText:"保存失败",loadedText:"保存成功",text:"保存",type:"primary"},on:{callback:e.handleSavedCallback,click:e.handleCreateOrUpdateCategory}})],1)],1)],1)],1),a("a-col",{staticClass:"pb-3",attrs:{lg:16,md:16,sm:24,xl:16,xs:24}},[a("a-card",{attrs:{bodyStyle:{padding:"16px"},title:"分类列表"},scopedSlots:e._u([{key:"extra",fn:function(){return[a("ReactiveButton",{attrs:{disabled:e.list.data.length<=0,errored:e.formBatch.errored,loading:e.formBatch.saving,erroredText:"保存失败",loadedText:"保存成功",text:"保存"},on:{callback:function(t){e.formBatch.errored=!1},click:e.handleUpdateBatch}})]},proxy:!0}])},[a("a-spin",{attrs:{spinning:e.list.loading}},[a("CategoryTreeNode",{on:{edit:e.handleEdit,reload:e.handleListCategories,select:e.handleSelect},model:{value:e.list.treeData,callback:function(t){e.$set(e.list,"treeData",t)},expression:"list.treeData"}})],1)],1)],1)],1)],1)},o=[],l=a(50990),s=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("a-tree-select",{attrs:{allowClear:!0,treeData:e.categoryTreeData,treeDataSimpleMode:!0,placeholder:"请选择上级目录,默认为顶级目录",treeDefaultExpandAll:""},model:{value:e.categoryIdString,callback:function(t){e.categoryIdString=t},expression:"categoryIdString"}})},i=[],n={name:"CategorySelectTree",props:{categoryId:{type:Number,required:!0,default:0},categories:{type:Array,required:!1,default:()=>[]}},computed:{categoryTreeData(){return[{id:0,title:"根目录",value:"0",pId:-1},...this.categories.map((e=>({id:e.id,title:e.name,value:e.id.toString(),pId:e.parentId})))]},categoryIdString:{get(){return this.categoryId.toString()},set(e){this.$emit("update:categoryId",e?parseInt(e):0)}}}},d=n,c=a(18156),m=(0,c.Z)(d,s,i,!1,null,null,null),u=m.exports,p=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("a-list",{attrs:{"item-layout":"horizontal"}},[a("draggable",e._b({staticClass:"item-container",attrs:{list:e.list,value:e.value,handle:".mover",tag:"div"},on:{end:function(t){e.isDragging=!1},input:e.emitter,start:function(t){e.isDragging=!0}}},"draggable",{animation:300,group:"description",ghostClass:"ghost",chosenClass:"chosen",dragClass:"drag",emptyInsertThreshold:20},!1),[a("transition-group",e._l(e.realValue,(function(t){return a("div",{key:t.id},[a("a-list-item",{staticClass:"menu-item",scopedSlots:e._u([{key:"actions",fn:function(){return[a("a-button",{staticClass:"!p-0",attrs:{type:"link"},on:{click:function(a){return e.handleSelect(t)}}},[e._v("新增")]),a("a-button",{staticClass:"!p-0",attrs:{type:"link"},on:{click:function(a){return e.handleEdit(t)}}},[e._v("编辑")]),a("a-button",{staticClass:"!p-0",attrs:{type:"link"},on:{click:function(a){return e.handleDelete(t)}}},[e._v("删除")])]},proxy:!0}],null,!0)},[a("a-list-item-meta",[a("span",{staticClass:"inline-block font-bold title",attrs:{slot:"title"},slot:"title"},[a("a-icon",{staticClass:"cursor-move mover mr-1",attrs:{type:"bars"}}),e._v(" "+e._s(t.name)+e._s(t.hasPassword?"(加密)":"")+" ")],1),a("span",{staticClass:"inline-block",attrs:{slot:"description"},slot:"description"},[a("a",{staticClass:"ant-anchor-link-title",attrs:{href:t.fullPath,target:"_blank"}},[e._v(" "+e._s(t.fullPath)+" ")])])])],1),a("div",{staticClass:"a-list-nested",staticStyle:{"margin-left":"44px"}},[a("CategoryTreeNode",{attrs:{list:t.children},on:{edit:e.handleEdit,reload:function(t){return e.$emit("reload")},select:e.handleSelect}})],1)],1)})),0)],1)],1)},h=[],g=a(77513),f=a.n(g),y=a(1540),v={name:"CategoryTreeNode",components:{draggable:f()},props:{value:{required:!1,type:Array,default:null},list:{required:!1,type:Array,default:null}},computed:{realValue(){return this.value?this.value:this.list}},data(){return{isDragging:!1}},methods:{emitter(e){this.$emit("input",e)},handleDelete(e){const t=this;t.$confirm({title:"提示",content:`确定要删除名为${e.name}的分类?`,async onOk(){try{await y.Z.category["delete"](e.id),t.$emit("reload")}catch(a){t.$log.error("Fail to delete category",a)}}})},handleEdit(e){this.$emit("edit",e)},handleSelect(e){this.$emit("select",e)}}},b=v,C=(0,c.Z)(b,p,h,!1,null,"56da7354",null),x=C.exports,k=a(3832),I={components:{PageView:l.B4,CategorySelectTree:u,CategoryTreeNode:x},mixins:[k.jB,k.KT],data(){return{list:{data:[],treeData:[],loading:!1},form:{model:{},saving:!1,errored:!1,rules:{name:[{required:!0,message:"* 分类名称不能为空",trigger:["change"]},{max:255,message:"* 分类名称的字符长度不能超过 255",trigger:["change"]}],slug:[{max:255,message:"* 分类别名的字符长度不能超过 255",trigger:["change"]}],thumbnail:[{max:1023,message:"* 封面图链接的字符长度不能超过 1023",trigger:["change"]}],description:[{max:100,message:"* 分类描述的字符长度不能超过 100",trigger:["change"]}]}},formBatch:{saving:!1,errored:!1}}},computed:{title(){return this.isUpdateMode?"修改分类":"添加分类"},isUpdateMode(){return!!this.form.model.id}},created(){this.handleListCategories()},methods:{async handleListCategories(){try{this.list.loading=!0;const{data:e}=await y.Z.category.list({});this.list.data=e,this.list.treeData=this.convertDataToTree(e)}catch(e){this.$log.error("Failed to get categories",e)}finally{this.list.loading=!1}},convertDataToTree(e){const t={},a=[];return e.forEach((e=>t[e.id]={...e,children:[]})),e.forEach((e=>{const r=t[e.id],o=t[e.parentId];r.password&&(r.hasPassword=!0),o&&(o.password||o.hasPassword)&&(r.hasPassword=!0),e.parentId?t[e.parentId].children.push(r):a.push(r)})),a},async handleEdit(e){try{const{data:t}=await y.Z.category.get(e.id);this.form.model=t,this.$refs.nameInput.focus()}catch(t){this.$log.error("Failed to get category",t)}},handleSelect(e){this.form.model={parentId:e.id},this.$refs.nameInput.focus()},handleCreateOrUpdateCategory(){const e=this;e.$refs.categoryForm.validate((t=>{t&&(e.form.saving=!0,e.isUpdateMode?y.Z.category.update(e.form.model.id,e.form.model).catch((()=>{this.form.errored=!0})).finally((()=>{setTimeout((()=>{e.form.saving=!1}),400)})):y.Z.category.create(this.form.model).catch((()=>{this.form.errored=!0})).finally((()=>{setTimeout((()=>{e.form.saving=!1}),400)})))}))},async handleUpdateBatch(){const e=(t,a=0)=>t&&0!==t.length?t.reduce(((t,r,o)=>{r.priority=o+1,r.parentId=a;const l=r.children.length>0?e(r.children,r.id):[];return[...t,r,...l]}),[]):[],t=e(this.list.treeData);try{this.formBatch.saving=!0,await y.Z.category.updateInBatch(t)}catch(a){this.formBatch.errored=!0,this.$log.error("Failed to update categories",a)}finally{setTimeout((()=>{this.formBatch.saving=!1,this.handleListCategories()}),400)}},handleSavedCallback(){if(this.form.errored)this.form.errored=!1;else{const e=this;e.form.model={},e.handleListCategories()}},handleQueryCategoryPosts(e){this.$router.push({name:"PostList",query:{categoryId:e.id}})}}},$=I,w=(0,c.Z)($,r,o,!1,null,null,null),S=w.exports}}]);
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment