增加了系统短标题与短LOGO配置

This commit is contained in:
wanggeng 2021-07-30 19:53:03 +08:00
parent 76ff082345
commit ecf0ad625c
5 changed files with 140 additions and 27 deletions

View File

@ -40,7 +40,7 @@ public interface IUserCenterConst {
/**
* 系统简称菜单上方名称
*/
String SYSTEM_SIMPLE_TITLE = "systemSimpleTitle";
String SYSTEM_SHORT_TITLE = "systemShortTitle";
/**
* 版权年份
*/
@ -65,6 +65,10 @@ public interface IUserCenterConst {
* 系统LOGO
*/
String SYSTEM_LOGO = "systemLogo";
/**
* 系统短LOGO菜单上方LOGO
*/
String SYSTEM_SHORT_LOGO = "systemShortLogo";
/**
* 扫码登录类型
*/

View File

@ -63,21 +63,19 @@ public class IndexRouteController {
UserInfoBO userInfoBO = securityComponent.getCurrentUser();
mv.addObject("userUsername", userInfoBO.getUserUsername());
Map<String, Object> config = ConfigManager.getInstance().getConfig();
if (!Objects.isNull(config.get(IUserCenterConst.SYSTEM_TITLE)) && !StringUtils.isBlank(config.get(IUserCenterConst.SYSTEM_TITLE).toString())) {
mv.addObject(IUserCenterConst.SYSTEM_TITLE, config.get(IUserCenterConst.SYSTEM_TITLE).toString());
// 先加载系统短标题没有加载主标题没有加载配置文件系统标题
if (!Objects.isNull(config.get(IUserCenterConst.SYSTEM_SHORT_TITLE)) && !StringUtils.isBlank(config.get(IUserCenterConst.SYSTEM_SHORT_TITLE).toString())) {
mv.addObject(IUserCenterConst.SYSTEM_SHORT_TITLE, config.get(IUserCenterConst.SYSTEM_SHORT_TITLE).toString());
} else if(!Objects.isNull(config.get(IUserCenterConst.SYSTEM_TITLE)) && !StringUtils.isBlank(config.get(IUserCenterConst.SYSTEM_TITLE).toString())) {
mv.addObject(IUserCenterConst.SYSTEM_SHORT_TITLE, config.get(IUserCenterConst.SYSTEM_TITLE).toString());
} else {
mv.addObject(IUserCenterConst.SYSTEM_TITLE, serverProperties.getSystemTitle());
mv.addObject(IUserCenterConst.SYSTEM_SHORT_TITLE, serverProperties.getSystemTitle());
}
if (!Objects.isNull(config.get(IUserCenterConst.SYSTEM_SUB_TITLE)) && !StringUtils.isBlank(config.get(IUserCenterConst.SYSTEM_SUB_TITLE).toString())) {
mv.addObject(IUserCenterConst.SYSTEM_SUB_TITLE, config.get(IUserCenterConst.SYSTEM_SUB_TITLE).toString());
// 系统短LOGO
if (!Objects.isNull(config.get(IUserCenterConst.SYSTEM_SHORT_LOGO)) && !StringUtils.isBlank(config.get(IUserCenterConst.SYSTEM_SHORT_LOGO).toString())) {
mv.addObject(IUserCenterConst.SYSTEM_SHORT_LOGO, config.get(IUserCenterConst.SYSTEM_SHORT_LOGO).toString());
} else {
mv.addObject(IUserCenterConst.SYSTEM_SUB_TITLE, serverProperties.getSystemSubTitle());
}
// 系统LOGO
if (!Objects.isNull(config.get(IUserCenterConst.SYSTEM_LOGO)) && !StringUtils.isBlank(config.get(IUserCenterConst.SYSTEM_LOGO).toString())) {
mv.addObject(IUserCenterConst.SYSTEM_LOGO, config.get(IUserCenterConst.SYSTEM_LOGO).toString());
} else {
mv.addObject(IUserCenterConst.SYSTEM_LOGO, "");
mv.addObject(IUserCenterConst.SYSTEM_SHORT_LOGO, "");
}
mv.addObject("ws", serverProperties.getWs());
// 菜单模式

View File

@ -4,7 +4,6 @@ package ink.wgink.login.base.pojo.vos.config;
import ink.wgink.annotation.CheckEmptyAnnotation;
import ink.wgink.annotation.CheckNumberAnnotation;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.login.base.consts.IUserCenterConst;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -40,6 +39,8 @@ public class ConfigVO {
private String loginBackgroundImages;
@ApiModelProperty(name = "systemLogo", value = "系统LOGO")
private String systemLogo;
@ApiModelProperty(name = "systemShortLogo", value = "系统短LOGO")
private String systemShortLogo;
@ApiModelProperty(name = "systemTitle", value = "系统主名称")
private String systemTitle;
@ApiModelProperty(name = "systemTitleSize", value = "系统主名称字体大小")
@ -48,6 +49,8 @@ public class ConfigVO {
private String systemSubTitle;
@ApiModelProperty(name = "systemSubTitleSize", value = "系统副标题字体大小")
private Integer systemSubTitleSize;
@ApiModelProperty(name = "systemShortTitle", value = "系统短标题")
private String systemShortTitle;
@ApiModelProperty(name = "copyRightYear", value = "版权年份")
private String copyRightYear;
@ApiModelProperty(name = "copyleft", value = "版权所有")
@ -229,4 +232,20 @@ public class ConfigVO {
public void setMenuMode(String menuMode) {
this.menuMode = menuMode;
}
public String getSystemShortLogo() {
return systemShortLogo == null ? "" : systemShortLogo.trim();
}
public void setSystemShortLogo(String systemShortLogo) {
this.systemShortLogo = systemShortLogo;
}
public String getSystemShortTitle() {
return systemShortTitle == null ? "" : systemShortTitle.trim();
}
public void setSystemShortTitle(String systemShortTitle) {
this.systemShortTitle = systemShortTitle;
}
}

View File

@ -31,8 +31,9 @@
<div class="layui-card-body" style="padding: 15px;">
<div class="layui-form-item" style="margin: 4px 0;">
<div class="layui-form-mid layui-word-aux base-form-item-title">系统主标题</div>
<div class="layui-input-inline" style="width: 400px;">
<input type="text" name="systemTitle" placeholder="请输入系统主标题XXXX系统..." class="layui-input">
<div class="layui-input-inline" style="width: 600px;">
<input type="text" name="systemTitle" placeholder="请输入系统主标题" class="layui-input">
<div class="layui-form-mid layui-word-aux">登录页面中登录表单上的主标题,如果为空,以配置文件为主</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
<input type="number" name="systemTitleSize" placeholder="字体大小" class="layui-input">
@ -40,29 +41,40 @@
</div>
<div class="layui-form-item" style="margin: 4px 0;">
<div class="layui-form-mid layui-word-aux base-form-item-title">系统副标题</div>
<div class="layui-input-inline" style="width: 400px;">
<input type="text" name="systemSubTitle" placeholder="请输入系统副标题XX软件、XX科技" class="layui-input">
<div class="layui-input-inline" style="width: 600px;">
<input type="text" name="systemSubTitle" placeholder="请输入系统副标题" class="layui-input">
<div class="layui-form-mid layui-word-aux">登录表单上的副标题,在没有设置时,为空时,以配置文件为主,设置过之后,为空时,表单中不显示</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
<input type="number" name="systemSubTitleSize" placeholder="字体大小" class="layui-input">
</div>
</div>
<div class="layui-form-item" style="margin: 4px 0;">
<div class="layui-form-mid layui-word-aux base-form-item-title">系统短标题</div>
<div class="layui-input-inline" style="width: 600px;">
<input type="text" name="systemShortTitle" placeholder="请输入系统短" class="layui-input">
<div class="layui-form-mid layui-word-aux">登录后菜单上方显示如果为空时显示主标题或配置文件中系统标题当没有设置短LOGO时最多显示11个汉字或19个大写字母或23个小写字母当设置短LOGO时最多显示9个汉字或13个大写字母或17个小写字母</div>
</div>
</div>
<div class="layui-form-item" style="margin: 4px 0;">
<div class="layui-form-mid layui-word-aux base-form-item-title">版权年份</div>
<div class="layui-input-inline" style="width: 400px;">
<div class="layui-input-inline" style="width: 600px;">
<input type="text" name="copyRightYear" placeholder="请输入版权年份2019-..." class="layui-input">
<div class="layui-form-mid layui-word-aux">如果需要可进行设置2019-2021</div>
</div>
</div>
<div class="layui-form-item" style="margin: 4px 0;">
<div class="layui-form-mid layui-word-aux base-form-item-title">版权所有</div>
<div class="layui-input-inline" style="width: 400px;">
<input type="text" name="copyleft" placeholder="请输入版权所属XXXX公司..." class="layui-input">
<div class="layui-input-inline" style="width: 600px;">
<input type="text" name="copyleft" placeholder="请输入版权所属" class="layui-input">
<div class="layui-form-mid layui-word-aux">如果需要可进行设置XXXX公司...</div>
</div>
</div>
<div class="layui-form-item" style="margin: 4px 0;">
<div class="layui-form-mid layui-word-aux base-form-item-title">官方地址</div>
<div class="layui-input-inline" style="width: 400px;">
<input type="text" name="officialUrl" placeholder="请输入官方地址http://...." class="layui-input">
<div class="layui-input-inline" style="width: 600px;">
<input type="text" name="officialUrl" placeholder="请输入官方地址" class="layui-input">
<div class="layui-form-mid layui-word-aux">如果需要可进行设置http://....</div>
</div>
</div>
</div>
@ -70,7 +82,7 @@
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a href="javascript:void(0);"><cite>系统 LOGO</cite></a>
<a href="javascript:void(0);"><cite>系统 LOGO(登录界面)</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
@ -79,6 +91,18 @@
</div>
</div>
</div>
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a href="javascript:void(0);"><cite>系统短 LOGO登录系统后菜单上方</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<div class="layui-form-item">
<div id="shortLogoShow" class="col-lg-12 photo-show"></div>
</div>
</div>
</div>
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
@ -250,6 +274,21 @@
</span>
{{# } }}
</script>
<script id="shortLogoTemple" type="text/html">
{{# layui.each(d.shortLogos, function(index, item){ }}
<span class="photo-show-wrap">
<span class="photo-wrap">
<img src="route/file/download/true/{{item}}"/>
<a href="javascript:void(0)" data-id="{{item}}" class="layui-btn layui-btn-xs layui-btn-danger remove-logo-short-btn"><i class="fa fa-trash"></i></a>
</span>
</span>
{{# }); }}
{{# if(d.shortLogos.length < 1) { }}
<span>
<a href="javascript:void(0)" id="selectShortLogo"><i class="fa fa-plus-square-o fa-5x"></i></a>
</span>
{{# } }}
</script>
<script id="backgroundTemple" type="text/html">
{{# layui.each(d.photos, function(index, item){ }}
<span class="photo-show-wrap">
@ -278,9 +317,11 @@
var form = layui.form;
var laytpl = layui.laytpl;
var logos = [];
var shortLogos = [];
var photos = [];
var photoViewer = new Viewer(document.getElementById('photoShow'), {});
var logoViewer = new Viewer(document.getElementById('logoShow'), {});
var shortLogoViewer = new Viewer(document.getElementById('shortLogoShow'), {});
// 设置logo图片
function setLogoTemple() {
@ -294,6 +335,18 @@
logoViewer.update();
}
// 设置logo图片
function setShortLogoTemple() {
var shortLogoTemple = document.getElementById('shortLogoTemple').innerHTML;
var shortLogoShow = document.getElementById('shortLogoShow');
laytpl(shortLogoTemple).render({
shortLogos: shortLogos
}, function(html) {
shortLogoShow.innerHTML = html;
});
shortLogoViewer.update();
}
// 事件-删除图片
$(document).on('click', '.remove-logo-btn', function() {
var fileId = this.dataset.id;
@ -307,6 +360,19 @@
setLogoTemple();
});
// 事件-删除图片
$(document).on('click', '.remove-logo-short-btn', function() {
var fileId = this.dataset.id;
for(var i = 0; i < shortLogos.length; i++) {
var item = shortLogos[i]
if(item == fileId) {
shortLogos.splice(i, 1);
break;
}
}
setShortLogoTemple();
});
// 事件-上传图片
$(document).on('click', '#selectLogo', function() {
top.dialog.file({
@ -327,6 +393,26 @@
});
});
// 事件-上传图片
$(document).on('click', '#selectShortLogo', function() {
top.dialog.file({
type: 'image',
title: '选择短LOGO',
width: '800px',
height: '400px',
maxFileCount: (1 - shortLogos.length),
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
for(var i = 0, item = uploadFileArray[i]; item = uploadFileArray[i++];) {
shortLogos.push(item.data);
}
setShortLogoTemple();
}
}
});
});
// 设置背景图片
function setBackgroundTemple() {
var backgroundTemple = document.getElementById('backgroundTemple').innerHTML;
@ -381,6 +467,7 @@
systemTitleSize: data.systemTitleSize,
systemSubTitle: data.systemSubTitle,
systemSubTitleSize: data.systemSubTitleSize,
systemShortTitle: data.systemShortTitle,
copyRightYear: data.copyRightYear,
copyleft: data.copyleft,
officialUrl: data.officialUrl,
@ -401,12 +488,16 @@
logos = data.systemLogo.split(',');
}
setLogoTemple();
if(data.systemShortLogo) {
shortLogos = data.systemShortLogo.split(',');
}
setShortLogoTemple();
if(data.loginBackgroundImages) {
photos = data.loginBackgroundImages.split(',');
}
setBackgroundTemple();
}, function(code, data) {
top.DialogBox.msg(data.msg);
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
@ -422,6 +513,7 @@
var loadLayerIndex;
formData.field.loginBackgroundImages = photos.toString();
formData.field.systemLogo = logos.length > 0 ? logos[0] : '';
formData.field.systemShortLogo = shortLogos.length > 0 ? shortLogos[0] : '';
top.restAjax.put(top.restAjax.path('api/config/updateconfig', []), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg('更新成功', {
time: 0,

View File

@ -88,8 +88,8 @@
<div id="sideMenu" class="layui-side layui-side-menu layui-side-menu-hidden">
<div class="layui-side-scroll">
<div class="layui-logo">
<img th:src="'route/file/download/true/'+ ${systemLogo}" style="width: 32px; height: 32px;" th:if="${systemLogo ne ''}">
<span th:text="${systemTitle}" style="font-weight: bold;"></span>
<img th:src="'route/file/download/true/'+ ${systemShortLogo}" style="width: 32px; height: 32px;" th:if="${systemShortLogo ne ''}">
<span th:text="${systemShortTitle}" style="font-weight: bold;"></span>
</div>
<ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">