From 0a3580ddaeba4cb484949134161979aecbeb51e4 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 12 Jan 2022 11:07:03 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/plugins/server/ThemeServer.java | 22 ++++++++++++------- frontend/src/lang/en.js | 6 ++++- frontend/src/lang/tw.js | 6 ++++- frontend/src/lang/zh.js | 6 ++++- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/backend/src/main/java/io/dataease/plugins/server/ThemeServer.java b/backend/src/main/java/io/dataease/plugins/server/ThemeServer.java index 08e2d10374..99dc4c5fec 100644 --- a/backend/src/main/java/io/dataease/plugins/server/ThemeServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/ThemeServer.java @@ -4,12 +4,13 @@ import java.util.List; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.dataease.commons.exception.DEException; +import io.dataease.commons.utils.LogUtil; import io.dataease.plugins.config.SpringContextUtil; import io.dataease.plugins.xpack.theme.dto.ThemeDto; import io.dataease.plugins.xpack.theme.dto.ThemeItem; @@ -20,10 +21,8 @@ import io.dataease.plugins.xpack.theme.service.ThemeXpackService; @RestController public class ThemeServer { - - @PostMapping("/themes") - public List themes(){ + public List themes() { ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class); return themeXpackService.themes(); @@ -36,15 +35,22 @@ public class ThemeServer { } @PostMapping("/save") - public void save(@RequestPart("request") ThemeRequest request, @RequestPart(value = "file", required = false) MultipartFile bodyFile) { + public void save(@RequestPart("request") ThemeRequest request, + @RequestPart(value = "file", required = false) MultipartFile bodyFile) { ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class); - themeXpackService.save(request, bodyFile); + try { + themeXpackService.save(request, bodyFile); + } catch (Exception e) { + LogUtil.error(e.getMessage(), e); + DEException.throwException(e); + } + } @PostMapping("/delete/{themeId}") - public void save(@PathVariable("themeId") int themeId) { + public void delete(@PathVariable("themeId") int themeId) { ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class); themeXpackService.deleteTheme(themeId); } - + } diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index d0c8e5d03a..497a9f9ec0 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -131,6 +131,7 @@ export default { default_login: 'Normal' }, commons: { + apply: 'Apply', search: 'Search', folder: 'Folder', no_target_permission: 'No permission', @@ -437,7 +438,10 @@ export default { background: 'Background color', custom: 'Custom color', otherSave: 'Theme Save as', - info: 'Theme info' + info: 'Theme info', + add: 'Add Theme', + please_input_name: 'Please enter a name', + name_repeat: 'Name already exists' }, tagsView: { refresh: 'Refresh', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index e7780a44cd..d819bad6a1 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -131,6 +131,7 @@ export default { default_login: '普通登錄' }, commons: { + apply: '應用', search: '搜索', folder: '目錄', no_target_permission: '沒有權限', @@ -437,7 +438,10 @@ export default { background: '背景顏色', custom: '自定義顏色', otherSave: '主題另存為', - info: '主題信息' + info: '主題信息', + add: '新增主題', + please_input_name: '請輸入名稱', + name_repeat: '名稱已存在' }, tagsView: { refresh: '刷新', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 0a5a33a417..5fb9fcfdcf 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -131,6 +131,7 @@ export default { default_login: '普通登录' }, commons: { + apply: '应用', search: '搜索', folder: '目录', no_target_permission: '没有权限', @@ -438,7 +439,10 @@ export default { background: '背景颜色', custom: '自定义颜色', otherSave: '主题另存为', - info: '主题信息' + info: '主题信息', + add: '新增主题', + please_input_name: '请输入名称', + name_repeat: '名称已存在' }, tagsView: { refresh: '刷新',