From 588a45ee079d03f673407d8b0f9d859d8a2e6593 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Sat, 7 Mar 2020 16:17:34 +0800 Subject: [PATCH] refactor: options page. (#89) * refactor: options page. * fix: option api. --- src/api/option.js | 13 +- src/config/router.config.js | 4 +- src/store/modules/option.js | 2 +- src/views/post/TagList.vue | 2 +- src/views/system/OptionForm.vue | 1252 ----------------- src/views/system/SystemOptions.vue | 198 +++ .../system/optiontabs/AdvancedOtherTab.vue | 52 + src/views/system/optiontabs/ApiTab.vue | 65 + src/views/system/optiontabs/AttachmentTab.vue | 577 ++++++++ src/views/system/optiontabs/CommentTab.vue | 109 ++ src/views/system/optiontabs/GeneralTab.vue | 143 ++ src/views/system/optiontabs/OtherTab.vue | 81 ++ src/views/system/optiontabs/PermalinkTab.vue | 111 ++ src/views/system/optiontabs/PostTab.vue | 89 ++ src/views/system/optiontabs/SeoTab.vue | 62 + src/views/system/optiontabs/SmtpTab.vue | 180 +++ 16 files changed, 1680 insertions(+), 1260 deletions(-) delete mode 100644 src/views/system/OptionForm.vue create mode 100644 src/views/system/SystemOptions.vue create mode 100644 src/views/system/optiontabs/AdvancedOtherTab.vue create mode 100644 src/views/system/optiontabs/ApiTab.vue create mode 100644 src/views/system/optiontabs/AttachmentTab.vue create mode 100644 src/views/system/optiontabs/CommentTab.vue create mode 100644 src/views/system/optiontabs/GeneralTab.vue create mode 100644 src/views/system/optiontabs/OtherTab.vue create mode 100644 src/views/system/optiontabs/PermalinkTab.vue create mode 100644 src/views/system/optiontabs/PostTab.vue create mode 100644 src/views/system/optiontabs/SeoTab.vue create mode 100644 src/views/system/optiontabs/SmtpTab.vue diff --git a/src/api/option.js b/src/api/option.js index 561ba3d57..e87b7d6d6 100644 --- a/src/api/option.js +++ b/src/api/option.js @@ -4,16 +4,21 @@ const baseUrl = '/api/admin/options' const optionApi = {} -optionApi.listAll = keys => { +optionApi.listAll = () => { return service({ url: `${baseUrl}/map_view`, - params: { - key: keys - }, method: 'get' }) } +optionApi.listAllByKeys = keys => { + return service({ + url: `${baseUrl}/map_view/keys`, + data: keys, + method: 'post' + }) +} + optionApi.query = params => { return service({ url: `${baseUrl}/list_view`, diff --git a/src/config/router.config.js b/src/config/router.config.js index 190176c09..de276065e 100644 --- a/src/config/router.config.js +++ b/src/config/router.config.js @@ -175,8 +175,8 @@ export const asyncRouterMap = [ }, { path: '/system/options', - name: 'OptionForm', - component: () => import('@/views/system/OptionForm'), + name: 'SystemOptions', + component: () => import('@/views/system/SystemOptions'), meta: { title: '博客设置', hiddenHeaderContent: false } }, { diff --git a/src/store/modules/option.js b/src/store/modules/option.js index 91937b7a6..dd6fb7d1b 100644 --- a/src/store/modules/option.js +++ b/src/store/modules/option.js @@ -31,7 +31,7 @@ const option = { }) { return new Promise((resolve, reject) => { optionApi - .listAll(keys) + .listAllByKeys(keys) .then(response => { commit('SET_OPTIONS', response.data.data) resolve(response) diff --git a/src/views/post/TagList.vue b/src/views/post/TagList.vue index 3606912c6..6317d5efc 100644 --- a/src/views/post/TagList.vue +++ b/src/views/post/TagList.vue @@ -97,7 +97,7 @@ {{ tag.name }} diff --git a/src/views/system/OptionForm.vue b/src/views/system/OptionForm.vue deleted file mode 100644 index 6182ea088..000000000 --- a/src/views/system/OptionForm.vue +++ /dev/null @@ -1,1252 +0,0 @@ - - diff --git a/src/views/system/SystemOptions.vue b/src/views/system/SystemOptions.vue new file mode 100644 index 000000000..4c9e49794 --- /dev/null +++ b/src/views/system/SystemOptions.vue @@ -0,0 +1,198 @@ + + diff --git a/src/views/system/optiontabs/AdvancedOtherTab.vue b/src/views/system/optiontabs/AdvancedOtherTab.vue new file mode 100644 index 000000000..e5b21e047 --- /dev/null +++ b/src/views/system/optiontabs/AdvancedOtherTab.vue @@ -0,0 +1,52 @@ + + diff --git a/src/views/system/optiontabs/ApiTab.vue b/src/views/system/optiontabs/ApiTab.vue new file mode 100644 index 000000000..7f6756a7e --- /dev/null +++ b/src/views/system/optiontabs/ApiTab.vue @@ -0,0 +1,65 @@ + + diff --git a/src/views/system/optiontabs/AttachmentTab.vue b/src/views/system/optiontabs/AttachmentTab.vue new file mode 100644 index 000000000..a1251865f --- /dev/null +++ b/src/views/system/optiontabs/AttachmentTab.vue @@ -0,0 +1,577 @@ + + diff --git a/src/views/system/optiontabs/CommentTab.vue b/src/views/system/optiontabs/CommentTab.vue new file mode 100644 index 000000000..820e684d3 --- /dev/null +++ b/src/views/system/optiontabs/CommentTab.vue @@ -0,0 +1,109 @@ + + diff --git a/src/views/system/optiontabs/GeneralTab.vue b/src/views/system/optiontabs/GeneralTab.vue new file mode 100644 index 000000000..16741e2fb --- /dev/null +++ b/src/views/system/optiontabs/GeneralTab.vue @@ -0,0 +1,143 @@ + + + diff --git a/src/views/system/optiontabs/OtherTab.vue b/src/views/system/optiontabs/OtherTab.vue new file mode 100644 index 000000000..69c28f908 --- /dev/null +++ b/src/views/system/optiontabs/OtherTab.vue @@ -0,0 +1,81 @@ + + diff --git a/src/views/system/optiontabs/PermalinkTab.vue b/src/views/system/optiontabs/PermalinkTab.vue new file mode 100644 index 000000000..2d1057065 --- /dev/null +++ b/src/views/system/optiontabs/PermalinkTab.vue @@ -0,0 +1,111 @@ + + diff --git a/src/views/system/optiontabs/PostTab.vue b/src/views/system/optiontabs/PostTab.vue new file mode 100644 index 000000000..c5f863493 --- /dev/null +++ b/src/views/system/optiontabs/PostTab.vue @@ -0,0 +1,89 @@ + + diff --git a/src/views/system/optiontabs/SeoTab.vue b/src/views/system/optiontabs/SeoTab.vue new file mode 100644 index 000000000..30bc6dfb0 --- /dev/null +++ b/src/views/system/optiontabs/SeoTab.vue @@ -0,0 +1,62 @@ + + diff --git a/src/views/system/optiontabs/SmtpTab.vue b/src/views/system/optiontabs/SmtpTab.vue new file mode 100644 index 000000000..c94f29cb8 --- /dev/null +++ b/src/views/system/optiontabs/SmtpTab.vue @@ -0,0 +1,180 @@ + +