refactor: 优化主题切换

This commit is contained in:
fit2cloud-chenyw 2022-01-12 11:07:03 +08:00
parent b571ef24e7
commit 0a3580ddae
4 changed files with 29 additions and 11 deletions

View File

@ -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<ThemeDto> themes(){
public List<ThemeDto> 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);
}
}

View File

@ -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',

View File

@ -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: '刷新',

View File

@ -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: '刷新',