From f35aeb9e9ac2c1a0bfd8d27516190c7ec609f9e0 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Fri, 31 May 2019 00:05:55 +0800 Subject: [PATCH] Support theme update. --- src/api/theme.js | 8 ++++ src/views/interface/ThemeList.vue | 77 +++++++++++++++++++++---------- 2 files changed, 61 insertions(+), 24 deletions(-) diff --git a/src/api/theme.js b/src/api/theme.js index e6a10e02..aad62d1f 100644 --- a/src/api/theme.js +++ b/src/api/theme.js @@ -39,6 +39,14 @@ themeApi.getActivatedTheme = () => { }) } +themeApi.update = themeId => { + return service({ + url: `${baseUrl}/${themeId}`, + timeout: 60000, + method: 'put' + }) +} + themeApi.delete = key => { return service({ url: `${baseUrl}/${key}`, diff --git a/src/views/interface/ThemeList.vue b/src/views/interface/ThemeList.vue index 93e22444..20618d6c 100644 --- a/src/views/interface/ThemeList.vue +++ b/src/views/interface/ThemeList.vue @@ -35,23 +35,23 @@ 已启用 + /> 已启用
- 启用 + 启用
- 设置 + 设置
- 更多 + 更多 - 删除 + 删除 - 删除 + 删除 + + + 更新 + + @@ -259,8 +269,34 @@
+ + + + + + 下载 + + + + + + + 支持单个或批量上传,仅支持 ZIP 格式的文件

- - - - - - - 确定 - - -
@@ -316,6 +336,7 @@ export default { themeLoading: false, optionLoading: true, uploadVisible: false, + fetchButtonLoading: false, wrapperCol: { xl: { span: 12 }, lg: { span: 12 }, @@ -382,6 +403,12 @@ export default { this.loadThemes() }) }, + handleUpdateTheme(themeId) { + themeApi.update(themeId).then(response => { + this.$message.success('更新成功!') + this.loadThemes() + }) + }, handleDeleteTheme(key) { themeApi.delete(key).then(response => { this.$message.success('删除成功!') @@ -421,9 +448,11 @@ export default { this.activeTheme(theme.id) }, handleFetching() { + this.fetchButtonLoading = true themeApi.fetching(this.fetchingUrl).then(response => { - this.$message.success('上传成功') + this.$message.success('拉取成功') this.uploadVisible = false + this.fetchButtonLoading = false this.loadThemes() }) },