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/773.a6f95edf.js

1 line
12 KiB
JavaScript

(self["webpackChunkhalo_admin"]=self["webpackChunkhalo_admin"]||[]).push([[773],{53303:function(e,t,o){var n=o(15820),r=Math.floor,i=function(e,t){var o=e.length,s=r(o/2);return o<8?a(e,t):l(e,i(n(e,0,s),t),i(n(e,s),t),t)},a=function(e,t){var o,n,r=e.length,i=1;while(i<r){n=i,o=e[i];while(n&&t(e[n-1],o)>0)e[n]=e[--n];n!==i++&&(e[n]=o)}return e},l=function(e,t,o,n){var r=t.length,i=o.length,a=0,l=0;while(a<r||l<i)e[a+l]=a<r&&l<i?n(t[a],o[l])<=0?t[a++]:o[l++]:a<r?t[a++]:o[l++];return e};e.exports=i},52103:function(e,t,o){var n=o(82678),r=n.match(/firefox\/(\d+)/i);e.exports=!!r&&+r[1]},76044:function(e,t,o){var n=o(82678);e.exports=/MSIE|Trident/.test(n)},97551:function(e,t,o){var n=o(82678),r=n.match(/AppleWebKit\/(\d+)\./);e.exports=!!r&&+r[1]},19003:function(e,t,o){"use strict";var n=o(79644),r=o(33691),i=o(77925),a=o(43207),l=o(71768),s=o(43150),d=o(32640),c=o(53303),m=o(29415),u=o(52103),h=o(76044),f=o(3718),v=o(97551),p=[],F=r(p.sort),y=r(p.push),C=d((function(){p.sort(void 0)})),b=d((function(){p.sort(null)})),g=m("sort"),k=!d((function(){if(f)return f<70;if(!(u&&u>3)){if(h)return!0;if(v)return v<603;var e,t,o,n,r="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:o=3;break;case 68:case 71:o=4;break;default:o=2}for(n=0;n<47;n++)p.push({k:t+n,v:o})}for(p.sort((function(e,t){return t.v-e.v})),n=0;n<p.length;n++)t=p[n].k.charAt(0),r.charAt(r.length-1)!==t&&(r+=t);return"DGBEFHACIJK"!==r}})),x=C||!b||!g||!k,S=function(e){return function(t,o){return void 0===o?-1:void 0===t?1:void 0!==e?+e(t,o)||0:s(t)>s(o)?1:-1}};n({target:"Array",proto:!0,forced:x},{sort:function(e){void 0!==e&&i(e);var t=a(this);if(k)return void 0===e?F(t):F(t,e);var o,n,r=[],s=l(t);for(n=0;n<s;n++)n in t&&y(r,t[n]);c(r,S(e)),o=r.length,n=0;while(n<o)t[n]=r[n++];while(n<s)delete t[n++];return t}})},47773:function(e,t,o){"use strict";o.r(t),o.d(t,{default:function(){return v}});var n=function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"option-tab-wrapper"},[o("a-card",{attrs:{bodyStyle:{padding:0},bordered:!1}},[o("div",{staticClass:"table-operator"},[o("a-button",{attrs:{icon:"cloud-upload",type:"primary"},on:{click:function(t){e.uploadModal.visible=!0}}},[e._v("上传")]),o("a-button",{attrs:{icon:"plus"},on:{click:function(t){return e.handleOpenCreateDirectoryModal({})}}},[e._v(" 新建文件夹")]),o("a-button",{attrs:{loading:e.list.loading,icon:"sync"},on:{click:e.handleListStatics}},[e._v(" 刷新")])],1),o("div",{staticClass:"mt-4"},[o("a-table",{attrs:{columns:e.list.columns,dataSource:e.sortedStatics,loading:e.list.loading,pagination:!1,rowKey:function(e){return e.id},size:"middle"},scopedSlots:e._u([{key:"name",fn:function(t){return o("span",{},[o("ellipsis",{attrs:{length:64,tooltip:""}},[e._v(" "+e._s(t)+" ")])],1)}},{key:"createTime",fn:function(t){return o("span",{},[e._v(" "+e._s(e._f("moment")(t))+" ")])}},{key:"action",fn:function(t,n){return o("span",{},[n.isFile?o("a",{attrs:{href:e.options.blog_url+n.relativePath,target:"_blank"}},[e._v("访问")]):o("a-button",{staticClass:"!p-0",attrs:{type:"link"},on:{click:function(t){return e.handleUpload(n)}}},[e._v("上传")]),o("a-divider",{attrs:{type:"vertical"}}),o("a-dropdown",{attrs:{trigger:["click"]}},[o("a-button",{staticClass:"!p-0",attrs:{type:"link"}},[e._v("更多")]),o("a-menu",{attrs:{slot:"overlay"},slot:"overlay"},[n.isFile?e._e():o("a-menu-item",{key:"1",on:{click:function(t){return e.handleOpenCreateDirectoryModal(n)}}},[e._v(" 创建文件夹 ")]),o("a-menu-item",{key:"2"},[o("a-popconfirm",{attrs:{title:n.isFile?"你确定要删除该文件?":"你确定要删除该文件夹?",cancelText:"取消",okText:"确定"},on:{confirm:function(t){return e.handleDelete(n.relativePath)}}},[e._v(" 删除 ")])],1),o("a-menu-item",{key:"3",on:{click:function(t){return e.handleOpenRenameModal(n)}}},[e._v("重命名")]),n.isFile?o("a-menu-item",{key:"4",on:{click:function(t){return e.handleOpenEditContentModal(n)}}},[e._v(" 编辑 ")]):e._e()],1)],1)],1)}}])})],1)]),o("a-modal",{attrs:{afterClose:e.onUploadModalClose,footer:null,destroyOnClose:"",title:"上传文件"},model:{value:e.uploadModal.visible,callback:function(t){e.$set(e.uploadModal,"visible",t)},expression:"uploadModal.visible"}},[o("FilePondUpload",{ref:"upload",attrs:{field:e.list.selected.relativePath,uploadHandler:e.uploadModal.uploadHandler,name:"file"}})],1),o("a-modal",{attrs:{afterClose:e.onDirectoryFormModalClose,title:"创建文件夹"},model:{value:e.directoryForm.visible,callback:function(t){e.$set(e.directoryForm,"visible",t)},expression:"directoryForm.visible"}},[o("template",{slot:"footer"},[o("ReactiveButton",{attrs:{errored:e.directoryForm.saveErrored,loading:e.directoryForm.saving,erroredText:"创建失败",loadedText:"创建成功",text:"创建"},on:{callback:e.handleCreateDirectoryCallback,click:e.handleCreateDirectory}})],1),o("a-form-model",{ref:"directoryForm",attrs:{model:e.directoryForm.model,rules:e.directoryForm.rules,layout:"vertical"}},[o("a-form-model-item",{attrs:{label:"文件夹名:",prop:"name"}},[o("a-input",{ref:"createDirectoryInput",on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleCreateDirectory.apply(null,arguments)}},model:{value:e.directoryForm.model.name,callback:function(t){e.$set(e.directoryForm.model,"name",t)},expression:"directoryForm.model.name"}})],1)],1)],2),o("a-modal",{attrs:{afterClose:e.onRenameModalClose,title:"重命名"},model:{value:e.renameForm.visible,callback:function(t){e.$set(e.renameForm,"visible",t)},expression:"renameForm.visible"}},[o("template",{slot:"footer"},[o("ReactiveButton",{attrs:{errored:e.renameForm.saveErrored,loading:e.renameForm.saving,erroredText:"重命名失败",loadedText:"重命名成功",text:"重命名"},on:{callback:e.handleRenameDirectoryOrFileCallback,click:e.handleRenameDirectoryOrFile}})],1),o("a-form-model",{ref:"renameForm",attrs:{model:e.renameForm.model,rules:e.renameForm.rules,layout:"vertical"}},[o("a-form-model-item",{attrs:{label:e.list.selected.isFile?"文件名:":"文件夹名:",prop:"name"}},[o("a-input",{ref:"renameModalInput",on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleRenameDirectoryOrFile.apply(null,arguments)}},model:{value:e.renameForm.model.name,callback:function(t){e.$set(e.renameForm.model,"name",t)},expression:"renameForm.model.name"}})],1)],1)],2),o("a-modal",{staticStyle:{"max-width":"1000px"},attrs:{closable:!1,keyboard:!1,maskClosable:!1,title:"编辑文件",width:"80%"},model:{value:e.editContentForm.visible,callback:function(t){e.$set(e.editContentForm,"visible",t)},expression:"editContentForm.visible"}},[o("template",{slot:"footer"},[o("a-popconfirm",{attrs:{cancelText:"取消",okText:"确定",title:"未保存的内容将会丢失,确定要退出吗?"},on:{confirm:e.handleEditContentModalClose}},[o("a-button",[e._v("取消")])],1),o("ReactiveButton",{attrs:{errored:e.editContentForm.saveErrored,loading:e.editContentForm.saving,erroredText:"保存失败",loadedText:"保存成功",text:"保存"},on:{callback:e.handleContentEditCallback,click:e.handleContentEdit}})],1),o("a-form",{attrs:{layout:"vertical"}},[o("a-form-item",[o("Codemirror",{ref:"editor",attrs:{height:"600px"},model:{value:e.editContentForm.model.content,callback:function(t){e.$set(e.editContentForm.model,"content",t)},expression:"editContentForm.model.content"}})],1)],1)],2)],1)},r=[],i=o(22373),a=(o(96153),o(19003),o(31875),o(21082),o(30535),o(96339),o(98906)),l=o(36591),s=o(26788),d=o(91860),c=[{title:"文件名",dataIndex:"name",scopedSlots:{customRender:"name"}},{title:"文件类型",dataIndex:"mimeType",scopedSlots:{customRender:"mimeType"}},{title:"上传时间",dataIndex:"createTime",width:"200px",scopedSlots:{customRender:"createTime"}},{title:"操作",dataIndex:"action",width:"120px",scopedSlots:{customRender:"action"}}],m={components:{Codemirror:s.Z},name:"StaticStorage",data:function(){return{list:{columns:c,data:[],loading:!1,selected:{}},uploadModal:{visible:!1,uploadHandler:function(e,t,o){return l.Z.staticStorage.upload(e,t,o)}},directoryForm:{model:{name:null},visible:!1,saving:!1,saveErrored:!1,rules:{name:[{required:!0,message:"* 文件夹名不能为空",trigger:["change"]}]}},renameForm:{model:{name:null},visible:!1,saving:!1,saveErrored:!1,rules:{name:[{required:!0,message:"* 文件夹名不能为空",trigger:["change"]}]}},editContentForm:{model:{content:null},visible:!1,saving:!1,saveErrored:!1}}},beforeMount:function(){this.handleListStatics()},computed:(0,i.Z)((0,i.Z)({},(0,a.Se)(["options"])),{},{sortedStatics:function(){var e=this.list.data.slice(0);return e.sort((function(e,t){return e.isFile-t.isFile}))}}),methods:{handleListStatics:function(){var e=this;this.list.loading=!0,l.Z.staticStorage.list().then((function(t){e.list.data=t.data})).finally((function(){e.list.loading=!1}))},handleDelete:function(e){var t=this;l.Z.staticStorage["delete"](e).then((function(){t.$message.success("删除成功!")})).finally((function(){t.handleListStatics()}))},handleUpload:function(e){this.list.selected=e,this.uploadModal.visible=!0},handleOpenCreateDirectoryModal:function(e){var t=this;this.list.selected=e,this.directoryForm.visible=!0,this.$nextTick((function(){t.$refs.createDirectoryInput.focus()}))},handleCreateDirectory:function(){var e=this;this.$refs.directoryForm.validate((function(t){if(t){e.directoryForm.saving=!0;var o=e.list.selected.relativePath||"/";l.Z.staticStorage.createFolder(o,e.directoryForm.model.name).catch((function(){e.directoryForm.saveErrored=!0})).finally((function(){setTimeout((function(){e.directoryForm.saving=!1}),400)}))}}))},handleCreateDirectoryCallback:function(){this.directoryForm.saveErrored?this.directoryForm.saveErrored=!1:(this.directoryForm.model={},this.directoryForm.visible=!1,this.handleListStatics())},handleOpenRenameModal:function(e){var t=this;this.list.selected=e,this.$set(this.renameForm.model,"name",e.name),this.renameForm.visible=!0,this.$nextTick((function(){var e=t.$refs.renameModalInput,o=e.value.split(".");e.focus(),o.length<=1?e.$el.setSelectionRange(0,e.value.length):e.$el.setSelectionRange(0,e.value.length-o.pop().length-1)}))},handleRenameDirectoryOrFile:function(){var e=this;this.$refs.renameForm.validate((function(t){t&&(e.renameForm.saving=!0,l.Z.staticStorage.rename(e.list.selected.relativePath,e.renameForm.model.name).catch((function(){e.renameForm.saveErrored=!0})).finally((function(){setTimeout((function(){e.renameForm.saving=!1}),400)})))}))},handleRenameDirectoryOrFileCallback:function(){this.renameForm.saveErrored?this.renameForm.saveErrored=!1:(this.renameForm.model={},this.renameForm.visible=!1,this.handleListStatics())},handleOpenEditContentModal:function(e){var t=this;this.list.selected=e,d.Axios.get(this.options.blog_url+e.relativePath).then((function(e){t.editContentForm.model.content=e.data+"",t.editContentForm.visible=!0,t.$nextTick((function(){t.$refs.editor.handleInitCodemirror()}))}))},handleContentEdit:function(){var e=this;this.editContentForm.saving=!0,l.Z.staticStorage.saveContent({path:this.list.selected.relativePath,content:this.editContentForm.model.content}).catch((function(){e.editContentForm.saveErrored=!0})).finally((function(){setTimeout((function(){e.editContentForm.saving=!1}),400)}))},handleContentEditCallback:function(){this.editContentForm.saveErrored?this.editContentForm.saveErrored=!1:(this.editContentForm.model={},this.editContentForm.visible=!1,this.handleListStatics())},onDirectoryFormModalClose:function(){this.list.selected={},this.$set(this.directoryForm.model,"name",null)},onRenameModalClose:function(){this.list.selected={},this.$set(this.renameForm.model,"name",null)},onUploadModalClose:function(){this.$refs.upload.handleClearFileList(),this.list.selected={},this.handleListStatics()},handleEditContentModalClose:function(){this.editContentForm.visible=!1,this.list.selected={},this.editContentForm.model.content=""}}},u=m,h=o(70739),f=(0,h.Z)(u,n,r,!1,null,null,null),v=f.exports}}]);