From 035aeda7b42cd79a41471b4940fd40d4c394a7e3 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Thu, 26 Dec 2019 00:12:57 +0800 Subject: [PATCH 1/5] feat: add static pages manage in tool list. --- src/views/system/ToolList.vue | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/views/system/ToolList.vue b/src/views/system/ToolList.vue index 8d3e22a2..96c6c35d 100644 --- a/src/views/system/ToolList.vue +++ b/src/views/system/ToolList.vue @@ -18,7 +18,7 @@
开发者选项
-

点击进入开发者选项页面

+

点击进入开发者选项页面

进入 + + +
+ 静态部署 +
+

生成静态页面并部署到 Github Pages 之类的托管平台

+ 管理 +
+
博客备份 -

支持备份全站数据

+

备份全站数据,支持下载到本地

Markdown 文章导入 -

支持 Hexo/Jekyll 文章导入并解析元数据

+

支持 Hexo/Jekyll 文章导入并解析元数据

Date: Thu, 26 Dec 2019 00:26:02 +0800 Subject: [PATCH 2/5] feat: add static pages manage in tool list. --- babel.config.js | 2 +- src/config/router.config.js | 7 ++++ src/views/system/ToolList.vue | 4 +++ .../system/staticpages/StaticPagesManage.vue | 32 +++++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 src/views/system/staticpages/StaticPagesManage.vue diff --git a/babel.config.js b/babel.config.js index d8e93c42..a35822f3 100644 --- a/babel.config.js +++ b/babel.config.js @@ -16,4 +16,4 @@ module.exports = { ] ], plugins -} \ No newline at end of file +} diff --git a/src/config/router.config.js b/src/config/router.config.js index 2c32156c..c4fed704 100644 --- a/src/config/router.config.js +++ b/src/config/router.config.js @@ -185,6 +185,13 @@ export const asyncRouterMap = [ component: () => import('@/views/system/ToolList'), meta: { title: '小工具', hiddenHeaderContent: false } }, + { + path: '/system/tools/staticpages', + name: 'StaticPagesManage', + hidden: true, + component: () => import('@/views/system/staticpages/StaticPagesManage'), + meta: { title: '静态部署', hiddenHeaderContent: false } + }, { path: '/system/about', name: 'About', diff --git a/src/views/system/ToolList.vue b/src/views/system/ToolList.vue index 96c6c35d..669284a3 100644 --- a/src/views/system/ToolList.vue +++ b/src/views/system/ToolList.vue @@ -45,6 +45,7 @@ 管理
@@ -150,6 +151,9 @@ export default { handleToDeveloperOptions() { this.$router.push({ name: 'DeveloperOptions' }) }, + handleToStaticPagesManage() { + this.$router.push({ name: 'StaticPagesManage' }) + }, onUploadClose() { this.$refs.upload.handleClearFileList() } diff --git a/src/views/system/staticpages/StaticPagesManage.vue b/src/views/system/staticpages/StaticPagesManage.vue new file mode 100644 index 00000000..939c7408 --- /dev/null +++ b/src/views/system/staticpages/StaticPagesManage.vue @@ -0,0 +1,32 @@ + + From 7a0334a4693093229168212859a0e640b2fcffe9 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Thu, 26 Dec 2019 14:19:36 +0800 Subject: [PATCH 3/5] feat: add static pages manage in tool list. --- src/api/staticPage.js | 39 +++++++ .../system/developer/tabs/SettingsForm.vue | 13 ++- .../system/staticpages/StaticPagesManage.vue | 13 ++- .../staticpages/tabs/DeploySettingsForm.vue | 100 +++++++++++++++++ .../system/staticpages/tabs/SettingsForm.vue | 10 ++ .../staticpages/tabs/StaticPagesList.vue | 105 ++++++++++++++++++ 6 files changed, 277 insertions(+), 3 deletions(-) create mode 100644 src/api/staticPage.js create mode 100644 src/views/system/staticpages/tabs/DeploySettingsForm.vue create mode 100644 src/views/system/staticpages/tabs/SettingsForm.vue create mode 100644 src/views/system/staticpages/tabs/StaticPagesList.vue diff --git a/src/api/staticPage.js b/src/api/staticPage.js new file mode 100644 index 00000000..10f5150f --- /dev/null +++ b/src/api/staticPage.js @@ -0,0 +1,39 @@ +import service from '@/utils/service' + +const baseUrl = '/api/admin/static_page' + +const staticPageApi = {} + +staticPageApi.list = () => { + return service({ + url: baseUrl, + method: 'get' + }) +} + +staticPageApi.generate = () => { + return service({ + url: `${baseUrl}/generate`, + method: 'get' + }) +} + +staticPageApi.deploy = () => { + return service({ + url: `${baseUrl}/deploy`, + method: 'get' + }) +} + +staticPageApi.deployType = { + GIT: { + type: 'GIT', + text: 'Git' + }, + NETLIFY: { + type: 'NETLIFY', + text: 'Netlify' + } +} + +export default staticPageApi diff --git a/src/views/system/developer/tabs/SettingsForm.vue b/src/views/system/developer/tabs/SettingsForm.vue index 646e26d0..f1fe7b86 100644 --- a/src/views/system/developer/tabs/SettingsForm.vue +++ b/src/views/system/developer/tabs/SettingsForm.vue @@ -1,5 +1,8 @@ diff --git a/src/views/system/staticpages/tabs/DeploySettingsForm.vue b/src/views/system/staticpages/tabs/DeploySettingsForm.vue new file mode 100644 index 00000000..c9a1a4fb --- /dev/null +++ b/src/views/system/staticpages/tabs/DeploySettingsForm.vue @@ -0,0 +1,100 @@ + + diff --git a/src/views/system/staticpages/tabs/SettingsForm.vue b/src/views/system/staticpages/tabs/SettingsForm.vue new file mode 100644 index 00000000..2202e09b --- /dev/null +++ b/src/views/system/staticpages/tabs/SettingsForm.vue @@ -0,0 +1,10 @@ + + diff --git a/src/views/system/staticpages/tabs/StaticPagesList.vue b/src/views/system/staticpages/tabs/StaticPagesList.vue new file mode 100644 index 00000000..9b77cdf3 --- /dev/null +++ b/src/views/system/staticpages/tabs/StaticPagesList.vue @@ -0,0 +1,105 @@ + + From 4b47e2519ab758977b9c05547ef29011ccdc0c47 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Thu, 26 Dec 2019 20:17:29 +0800 Subject: [PATCH 4/5] fix: table row key error. --- src/views/system/developer/tabs/StaticStorage.vue | 2 +- src/views/system/staticpages/tabs/StaticPagesList.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/system/developer/tabs/StaticStorage.vue b/src/views/system/developer/tabs/StaticStorage.vue index 767dbd08..fadfbfac 100644 --- a/src/views/system/developer/tabs/StaticStorage.vue +++ b/src/views/system/developer/tabs/StaticStorage.vue @@ -27,7 +27,7 @@
Date: Thu, 26 Dec 2019 20:38:50 +0800 Subject: [PATCH 5/5] refactor: static pages generate and deploy method. --- .../staticpages/tabs/StaticPagesList.vue | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/views/system/staticpages/tabs/StaticPagesList.vue b/src/views/system/staticpages/tabs/StaticPagesList.vue index 826e323f..56fc626e 100644 --- a/src/views/system/staticpages/tabs/StaticPagesList.vue +++ b/src/views/system/staticpages/tabs/StaticPagesList.vue @@ -85,20 +85,28 @@ export default { handleGenerate() { this.loading = true const hide = this.$message.loading('生成中...', 0) - staticPageApi.generate().then(response => { - hide() - this.$message.success('生成成功!') - this.loadStaticPageList() - }) + staticPageApi + .generate() + .then(response => { + this.$message.success('生成成功!') + }) + .finally(response => { + this.loadStaticPageList() + hide() + }) }, handleDeploy() { this.deployLoading = true const hide = this.$message.loading('部署中...', 0) - staticPageApi.deploy().then(response => { - hide() - this.deployLoading = false - this.$message.success('部署成功!') - }) + staticPageApi + .deploy() + .then(response => { + this.$message.success('部署成功!') + }) + .finally(response => { + this.deployLoading = false + hide() + }) } } }