From 9828aaef74da8a79217e4435b78ef424cb0f8b1a Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Tue, 14 Jul 2020 16:51:40 +0800 Subject: [PATCH] pref: code optimization again. (#215) --- .../Attachment/AttachmentSelectDrawer.vue | 14 +- src/components/GlobalHeader/GlobalHeader.vue | 2 +- src/components/Tools/Logo.vue | 4 +- src/layouts/BasicLayout.vue | 9 - src/permission.js | 2 +- src/store/modules/option.js | 2 +- src/store/modules/user.js | 2 +- src/views/attachment/AttachmentList.vue | 1 + .../components/AttachmentDrawer.vue | 20 +- src/views/comment/components/CommentTab.vue | 1 + .../components/TargetCommentDrawer.vue | 16 +- .../dashboard/components/LogListDrawer.vue | 14 +- src/views/interface/MenuList.vue | 4 +- src/views/interface/ThemeEdit.vue | 2 +- src/views/interface/ThemeList.vue | 2 +- .../components/ThemeSettingDrawer.vue | 36 +-- src/views/post/CategoryList.vue | 4 +- src/views/post/PostEdit.vue | 8 +- src/views/post/PostList.vue | 2 + src/views/post/TagList.vue | 4 +- .../post/components/PostSettingDrawer.vue | 19 +- src/views/sheet/SheetEdit.vue | 8 +- .../sheet/components/CustomSheetList.vue | 1 + .../sheet/components/SheetSettingDrawer.vue | 17 +- src/views/sheet/independent/JournalList.vue | 9 +- src/views/sheet/independent/LinkList.vue | 8 +- src/views/sheet/independent/PhotoList.vue | 9 +- src/views/system/Installation.vue | 2 +- src/views/system/SystemOptions.vue | 23 +- .../system/components/BackupWorkDirDrawer.vue | 28 +- .../system/components/ExportDataDrawer.vue | 28 +- .../system/developer/tabs/OptionsList.vue | 9 +- .../system/developer/tabs/SettingsForm.vue | 4 +- .../system/optiontabs/AdvancedOtherTab.vue | 30 +- src/views/system/optiontabs/ApiTab.vue | 34 ++- src/views/system/optiontabs/AttachmentTab.vue | 262 +++++++++--------- src/views/system/optiontabs/CommentTab.vue | 66 +++-- src/views/system/optiontabs/GeneralTab.vue | 153 ++++++---- src/views/system/optiontabs/OtherTab.vue | 42 ++- src/views/system/optiontabs/PermalinkTab.vue | 62 +++-- src/views/system/optiontabs/PostTab.vue | 70 +++-- src/views/system/optiontabs/SeoTab.vue | 48 +++- src/views/system/optiontabs/SmtpTab.vue | 90 +++--- .../staticpages/tabs/DeploySettingsForm.vue | 4 +- src/views/user/Login.vue | 8 +- src/views/user/Profile.vue | 95 ++----- 46 files changed, 720 insertions(+), 558 deletions(-) diff --git a/src/components/Attachment/AttachmentSelectDrawer.vue b/src/components/Attachment/AttachmentSelectDrawer.vue index 06350bbc..ce115a66 100644 --- a/src/components/Attachment/AttachmentSelectDrawer.vue +++ b/src/components/Attachment/AttachmentSelectDrawer.vue @@ -7,6 +7,7 @@ :visible="visible" destroyOnClose @close="onClose" + :afterVisibleChange="handleAfterVisibleChanged" > @@ -136,13 +138,6 @@ export default { uploadHandler: attachmentApi.upload } }, - watch: { - visible: function(newValue, oldValue) { - if (newValue) { - this.handleListAttachments() - } - } - }, methods: { handleShowUploadModal() { this.uploadVisible = true @@ -182,6 +177,11 @@ export default { this.$refs.upload.handleClearFileList() this.handlePaginationChange(1, this.pagination.size) }, + handleAfterVisibleChanged(visible) { + if (visible) { + this.handleListAttachments() + } + }, handleJudgeMediaType(attachment) { var mediaType = attachment.mediaType // 判断文件类型 diff --git a/src/components/GlobalHeader/GlobalHeader.vue b/src/components/GlobalHeader/GlobalHeader.vue index 9a607ae1..3a07d4b2 100644 --- a/src/components/GlobalHeader/GlobalHeader.vue +++ b/src/components/GlobalHeader/GlobalHeader.vue @@ -7,7 +7,7 @@
{ - this.loadOptions() + this.refreshOptionsCache() this.$message.success(`开发者选项已启用!`) this.clickCount = 0 this.$router.push({ name: 'ToolList' }) diff --git a/src/layouts/BasicLayout.vue b/src/layouts/BasicLayout.vue index 8ce1b8ff..b7cb6798 100644 --- a/src/layouts/BasicLayout.vue +++ b/src/layouts/BasicLayout.vue @@ -156,15 +156,6 @@ export default {