提交 410aaa2d 编写于 作者: Skyeye云's avatar Skyeye云

添加二级菜单展示30%

上级 c1e00acf
......@@ -398,6 +398,52 @@ public class ToolUtil {
return treeNode;
}
/**
* 使用递归建树
* @param deskTops
* @return
*/
public static List<Map<String, Object>> deskTopsTree(List<Map<String, Object>> deskTops){
List<Map<String, Object>> resultList = new ArrayList<>();
for(Map<String, Object> bean : deskTops){
if ("0".equals(bean.get("parentId").toString())) {
resultList.add(findChildren(bean, deskTops, 0));
}
}
for(Map<String, Object> bean : deskTops){
if(!findChildren(resultList, bean.get("id").toString())){
resultList.add(bean);
}
}
return resultList;
}
/**
* 递归判断id是否在集合中存在
* @param treeNode
* @param id
* @return
*/
@SuppressWarnings("unchecked")
public static boolean findChildren(List<Map<String, Object>> treeNode, String id){
List<Map<String, Object>> child = null;
for(Map<String, Object> bean : treeNode){
if(id.equals(bean.get("id").toString())){
return true;
}else{
child = (List<Map<String, Object>>) bean.get("childs");
if(child != null){
boolean in = findChildren(child, id);
if(in){
return in;
}
}
}
}
return false;
}
/**
* 获取ip.properties路径
* @return
......
......@@ -155,6 +155,7 @@ public class SysEveUserServiceImpl implements SysEveUserService{
List<Map<String, Object>> deskTops = sysEveUserDao.queryDeskTopsMenuByUserId(userMation);//桌面菜单列表
List<Map<String, Object>> allMenu = sysEveUserDao.queryAllMenuByUserId(userMation);
allMenu = ToolUtil.allMenuToTree(allMenu);
deskTops = ToolUtil.deskTopsTree(deskTops);
jedisClient.set("userMation:" + userMation.get("id").toString(), JSON.toJSONString(userMation));
jedisClient.expire("userMation:" + userMation.get("id").toString(), 1800);//时间为30分钟
jedisClient.set("deskTopsMation:" + userMation.get("id").toString(), JSON.toJSONString(deskTops));
......
......@@ -128,7 +128,9 @@
c.open_type openType,
'-1' maxOpen,
'false' extend,
'' childs
null childs,
c.menu_parent_id parentId,
c.menu_level menuLevel
FROM
sys_eve_user a,
sys_eve_role_menu b,
......
......@@ -312,12 +312,12 @@ button{
height: 40px;
position: fixed;
bottom: 0;
z-index: 201704011157;
z-index: 9998;
}
.winui-taskbar > * {
display: inline-block;
}
.winui-taskbar > * {
display: inline-block;
}
/*开始按钮*/
......@@ -330,20 +330,20 @@ button{
position: absolute;
}
.winui-taskbar-start:hover {
color: #1E91EA;
}
.winui-taskbar-start:hover {
color: #1E91EA;
}
/*开始按钮选中*/
/*开始按钮选中*/
.winui-taskbar-start.winui-this {
/*background: #004275;*/
}
.winui-taskbar-start.winui-this {
/*background: #004275;*/
}
.winui-taskbar-start i {
font-size: 18px;
}
.winui-taskbar-start i {
font-size: 18px;
}
/*任务栏任务*/
......@@ -2424,6 +2424,28 @@ body .layer-ext-winconfirm {
cursor: pointer;
}
.icon-drawer {
width: 35px;
height: 35px;
margin: 0px auto;
border: 1px solid rgba(255, 255, 255, 0.5);
overflow: hidden;
padding: 4px;
position: relative;
background-color: rgba(255, 255, 255, 0.19);
}
.icon-drawer-icon{
width: 50%;
height: 50%;
float: left;
margin-top: 2px;
}
.icon-child{
display: none;
}
/*** 小程序页面管理start ***/
.smpro{
height: calc(100vh - 45px);
......
......@@ -20,20 +20,55 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) {
if (this.data === null) return;
var html = '';
$(this.data).each(function (index, item) {
var id = (item.id == '' || item.id == undefined) ? '' : 'win-id="' + item.id + '"',
url = (item.pageURL == '' || item.pageURL == undefined) ? '' : 'win-url="' + item.pageURL + '"',
title = (item.title == '' || item.title == undefined) ? '' : 'win-title="' + item.title + '"',
opentype = (item.openType == '' || item.openType == undefined) ? '' : 'win-opentype="' + item.openType + '"',
maxOpen = (item.maxOpen == '' || item.maxOpen == undefined) ? '' : 'win-maxOpen="' + item.maxOpen + '"',
//icon的算法存在纰漏,但出现错误几率较小
isFaIcon = (item.icon.indexOf('fa-') != -1 && item.icon.indexOf('.') == -1),
icon = isFaIcon ? '<i class="fa ' + item.icon + ' fa-fw"></i>' : '<img src="' + item.icon + '" />';
html += '<div class="winui-desktop-item" ' + id + ' ' + url + ' ' + title + ' ' + opentype + ' ' + maxOpen + '>';
html += '<div class="winui-icon ' + (isFaIcon ? 'winui-icon-font' : 'winui-icon-img') + '">';
html += icon;
html += '</div>';
html += '<p>' + item.name + '</p>';
html += '</div>';
var id = (item.id == '' || item.id == undefined) ? '' : 'win-id="' + item.id + '"',
url = (item.pageURL == '' || item.pageURL == undefined) ? '' : 'win-url="' + item.pageURL + '"',
title = (item.title == '' || item.title == undefined) ? '' : 'win-title="' + item.title + '"',
opentype = (item.openType == '' || item.openType == undefined) ? '' : 'win-opentype="' + item.openType + '"',
maxOpen = (item.maxOpen == '' || item.maxOpen == undefined) ? '' : 'win-maxOpen="' + item.maxOpen + '"',
//icon的算法存在纰漏,但出现错误几率较小
isFaIcon = (item.icon.indexOf('fa-') != -1 && item.icon.indexOf('.') == -1),
icon = isFaIcon ? '<i class="fa ' + item.icon + ' fa-fw"></i>' : '<img src="' + item.icon + '" />';
if(isNull(item.childs)){
html += '<div class="winui-desktop-item" ' + id + ' ' + url + ' ' + title + ' ' + opentype + ' ' + maxOpen + '>';
html += '<div class="winui-icon ' + (isFaIcon ? 'winui-icon-font' : 'winui-icon-img') + '">';
html += icon;
html += '</div>';
html += '<p>' + item.name + '</p>';
html += '</div>';
}else{
html += '<div class="winui-desktop-item" ' + id + ' ' + url + ' ' + title + ' ' + opentype + ' ' + maxOpen + '>';
html += '<div class="winui-icon ' + (isFaIcon ? 'winui-icon-font' : 'winui-icon-img') + '">';
html += '<div class="icon-drawer">';
var childsIconContent = '';
var childsHtml = '';
$(item.childs).each(function (index, bean) {
var childsid = (bean.id == '' || bean.id == undefined) ? '' : 'win-id="' + bean.id + '"',
childsurl = (bean.pageURL == '' || bean.pageURL == undefined) ? '' : 'win-url="' + bean.pageURL + '"',
childstitle = (bean.title == '' || bean.title == undefined) ? '' : 'win-title="' + bean.title + '"',
childsopentype = (bean.openType == '' || bean.openType == undefined) ? '' : 'win-opentype="' + bean.openType + '"',
childsmaxOpen = (bean.maxOpen == '' || bean.maxOpen == undefined) ? '' : 'win-maxOpen="' + bean.maxOpen + '"',
//icon的算法存在纰漏,但出现错误几率较小
childsisFaIcon = (bean.icon.indexOf('fa-') != -1 && bean.icon.indexOf('.') == -1),
childsicon = childsisFaIcon ? '<i class="fa ' + bean.icon + ' fa-fw"></i>' : '<img src="' + bean.icon + '" />',
childsiconsmall = childsisFaIcon ? '<i class="fa ' + bean.icon + ' fa-fw icon-drawer-icon"></i>' : '<img src="' + bean.icon + '" />';
childsIconContent += childsiconsmall;
childsHtml += '<div class="winui-desktop-item" ' + childsid + ' ' + childsurl + ' ' + childstitle + ' ' + childsopentype + ' ' + childsmaxOpen + '>';
childsHtml += '<div class="winui-icon ' + (childsisFaIcon ? 'winui-icon-font' : 'winui-icon-img') + '">';
childsHtml += childsicon;
childsHtml += '</div>';
childsHtml += '<p>' + bean.name + '</p>';
childsHtml += '</div>';
});
html += childsIconContent;
html += '</div>';
html += '<div class="icon-child">';
html += childsHtml;
html += '</div>';
html += '</div>';
html += '<p>' + item.name + '</p>';
html += '</div>';
}
});
$('.winui-desktop').html(html);
//定位应用
......
......@@ -45,6 +45,19 @@ layui.define(['layer', 'winui'], function (exports) {
if (!winui.taskAuto()) {
return;
}
if(isNull(options.shadeClose)){
options.shadeClose = false;
}
if(isNull(options.skin)){
options.skin = 'winui-window';
}
if(isNull(options.closeBtn) && options.closeBtn != 0){
options.closeBtn = '1';
}
if(isNull(options.maxmin) && options.maxmin != false){
options.maxmin = true;
}
//打开窗口
var windowIndex = layer.open({
id: options.id || winui.guid(),
......@@ -56,10 +69,13 @@ layui.define(['layer', 'winui'], function (exports) {
anim: options.anim || this.settings.anim,
move: MOVE,
shade: options.shade || 0,
maxmin: true, //允许最大最小化
maxmin: options.maxmin, //允许最大最小化
moveOut: true, //允许拖出窗外
skin: 'winui-window', //窗口皮肤
skin: options.skin, //窗口皮肤
zIndex: layer.zIndex,
shadeClose: options.shadeClose, //点击空白处关闭
scrollbar: false,
closeBtn: options.closeBtn,
//销毁回调
end: options.end || function () {
......@@ -127,91 +143,93 @@ layui.define(['layer', 'winui'], function (exports) {
common.setWindowBody(window);
}
});
//重新获取window
var windowDom = common.getWindow(options.id);
if (((options.type || this.settings.type) == 2) && (options.refresh === undefined ? this.settings.refresh : options.refresh)) {
$(windowDom).find('.layui-layer-setwin').prepend('<a class="layui-layer-ico layui-layer-refresh"><i class="layui-icon" style="font-size:14px;left:17px;font-weight:600;">&#x1002;<i></a>');
$(windowDom).find('.layui-layer-refresh').on('click', function (e) {
var $iframe = $(windowDom).find('iframe');
try {
$iframe.attr('src', $iframe[0].contentWindow.location.href);
} catch (e) {
$iframe.attr('src', $iframe.attr('src'));
}
});
}
$(windowDom).find('.layui-layer-max').html('<i class="layui-icon" style="font-size:12px;left:18px;" >&#xe626;<i>');
$(windowDom).find('.layui-layer-close').html('<i class="layui-icon">&#x1006;<i>');
//打开最大化
switch ((options.maxOpen || this.settings.maxOpen)) {
case 1:
if ((options.anim || this.settings.anim) !== -1) {
$(windowDom).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
if(!isNull(windowDom)){
//重新获取window
if (((options.type || this.settings.type) == 2) && (options.refresh === undefined ? this.settings.refresh : options.refresh)) {
$(windowDom).find('.layui-layer-setwin').prepend('<a class="layui-layer-ico layui-layer-refresh"><i class="layui-icon" style="font-size:14px;left:17px;font-weight:600;">&#x1002;<i></a>');
$(windowDom).find('.layui-layer-refresh').on('click', function (e) {
var $iframe = $(windowDom).find('iframe');
try {
$iframe.attr('src', $iframe[0].contentWindow.location.href);
} catch (e) {
$iframe.attr('src', $iframe.attr('src'));
}
});
}
$(windowDom).find('.layui-layer-max').html('<i class="layui-icon" style="font-size:12px;left:18px;" >&#xe626;<i>');
$(windowDom).find('.layui-layer-close').html('<i class="layui-icon">&#x1006;<i>');
//打开最大化
switch ((options.maxOpen || this.settings.maxOpen)) {
case 1:
if ((options.anim || this.settings.anim) !== -1) {
$(windowDom).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
$(windowDom).find('.layui-layer-max').trigger('click');
});
} else {
$(windowDom).find('.layui-layer-max').trigger('click');
}
break;
case 2:
var top;
//根据任务栏模式调整位置
switch (winui.settings.taskbarMode) {
case 'top':
top = taskbarHeight + 'px';
break;
case 'bottom':
top = '0';
break;
case 'left':
break;
case 'right':
break;
default:
}
layer.style(windowIndex, {
'top': top,
'left': '0',
'width': $(window).width() + 'px',
'height': $(window).height() - taskbarHeight + 'px'
});
} else {
break;
default:
};
//去除最小化按钮
if (!(options.min === undefined ? this.settings.min : options.min))
$(windowDom).find('.layui-layer-min').remove();
//去除最大化按钮
if (!(options.max === undefined ? this.settings.max : options.max))
$(windowDom).find('.layui-layer-max').remove();
//增加任务项
var taskItem = common.addTaskItem(options.id, options.title);
//选中任务项
common.selectDom(taskItem);
//绑定任务项mouseup事件
common.resetMouseUp(taskItem, call.taskItemMouseUp);
//双击窗口标题栏最大化(由于不明原因,标题栏的拖动好像阻碍了标题栏的双击事件,所以这里用mousedown模拟双击)
var lastTime = 0;
$(windowDom).find(MOVE).on('mousedown', function () {
$('.layui-layer-move').css('cursor', 'default');
var thisTime = new Date().getTime();
if (thisTime - lastTime < 300) {
$(windowDom).find('.layui-layer-max').trigger('click');
}
break;
case 2:
var top;
//根据任务栏模式调整位置
switch (winui.settings.taskbarMode) {
case 'top':
top = taskbarHeight + 'px';
break;
case 'bottom':
top = '0';
break;
case 'left':
break;
case 'right':
break;
default:
}
layer.style(windowIndex, {
'top': top,
'left': '0',
'width': $(window).width() + 'px',
'height': $(window).height() - taskbarHeight + 'px'
});
break;
default:
};
//去除最小化按钮
if (!(options.min === undefined ? this.settings.min : options.min))
$(windowDom).find('.layui-layer-min').remove();
//去除最大化按钮
if (!(options.max === undefined ? this.settings.max : options.max))
$(windowDom).find('.layui-layer-max').remove();
//增加任务项
var taskItem = common.addTaskItem(options.id, options.title);
//选中任务项
common.selectDom(taskItem);
//绑定任务项mouseup事件
common.resetMouseUp(taskItem, call.taskItemMouseUp);
//双击窗口标题栏最大化(由于不明原因,标题栏的拖动好像阻碍了标题栏的双击事件,所以这里用mousedown模拟双击)
var lastTime = 0;
$(windowDom).find(MOVE).on('mousedown', function () {
$('.layui-layer-move').css('cursor', 'default');
var thisTime = new Date().getTime();
if (thisTime - lastTime < 300) {
$(windowDom).find('.layui-layer-max').trigger('click');
}
lastTime = thisTime;
});
//移除最小化最大化关闭按钮a标签的href属性
$(windowDom).find('.layui-layer-setwin').children('a').removeAttr('href');
//点击置顶
layer.setTop($(windowDom));
//手动置顶windowDom
windowfunc.setTop(windowDom);
//鼠标按下窗口时选中对应任务栏
$(windowDom).on('mousedown', function () {
var taskItem = common.getTaskItemByWindowDom(this);
common.selectDom(taskItem);
});
lastTime = thisTime;
});
//移除最小化最大化关闭按钮a标签的href属性
$(windowDom).find('.layui-layer-setwin').children('a').removeAttr('href');
//点击置顶
layer.setTop($(windowDom));
//手动置顶windowDom
windowfunc.setTop(windowDom);
//鼠标按下窗口时选中对应任务栏
$(windowDom).on('mousedown', function () {
var taskItem = common.getTaskItemByWindowDom(this);
common.selectDom(taskItem);
});
}
//隐藏开始菜单
$('.winui-start').addClass('layui-hide');
//移除开始按钮的选中样式
......
......@@ -57,7 +57,12 @@
}, //可以为{} 默认 请求 json/desktopmenu.json
done: function (desktopApp) {
desktopApp.ondblclick(function (id, elem) {
OpenWindow(elem);
var item = $(elem);
if(item.find(".icon-drawer").length > 0){
showBigWin(elem);
}else{
OpenWindow(elem);
}
});
desktopApp.contextmenu({
item: ["打开", "删除", '右键菜单可自定义'],
......@@ -187,19 +192,40 @@
id: id,
type: type,
title: title,
content: content
content: content,
//,area: ['70vw','80vh']
//,offset: ['10vh', '15vw']
, maxOpen: maxOpen
maxOpen: maxOpen,
//, max: false
//, min: false
, refresh:true
refresh:true
});
}else{
location.href = "login.html";
}
}});
}
function showBigWin(menuItem){
var menu = $(menuItem);
winui.window.config({
anim: 0,
miniAnim: 0,
maxOpen: -1
}).open({
id: '1',
type: 1,
title: false,
closeBtn: 0,
content: '1111',
area: ['30vw', '40vh'],
shadeClose: true,
skin: 'demo-class',
scrollbar: false,
shade: 0.5,
maxmin: false
});
}
//注销登录
$('.logout').on('click', function () {
......
useLoop(); 检查数组是否包含某个值的方法
getUrlParams(); 将url参数转换成map
isBlank(); 判断字符串是否为空
isNumeric(); 判断是不是数字
isPhone(); 检测手机号是否合格
isEmail(); 验证邮箱
isIP(); 验证IP地址
isDate(); 验证日期时间
isUrl(); 验证网址Url
isPostalcode(); 验证输入邮政编号
match(); 如果str 符合 regex的正则表达式格式,返回true, 否则返回 false;
isIDcard(); 验证输入身份证号
containsBoolean(); 请求xml参数判断
getTimeAndToString(); 获取当前日期(2016-12-29 11:23:09)
getProperties(); 读取.properties 结尾的配置文件用,getP, getParam
getSurFaceId(); 获取ID
MD5(); 加密
allMenuToTree(); 使用递归方法建树
findChildren(); 递归查找子节点
getIPPropertiesPath(); 获取ip.properties路径
deleteFile(); 删除单个文件
card(); 随机不重复的6-8位
replaceUnderLineAndUpperCase(); 将表名转为Java经常使用的名字,如code_model转CodeModel
toLowerCaseFirstOne(); 字符串首字母转小写
writeTxtFile(); 写入内容到文件
useLoop(); 检查数组是否包含某个值的方法
getUrlParams(); 将url参数转换成map
isBlank(); 判断字符串是否为空
isNumeric(); 判断是不是数字
isPhone(); 检测手机号是否合格
isEmail(); 验证邮箱
isIP(); 验证IP地址
isDate(); 验证日期时间
isUrl(); 验证网址Url
isPostalcode(); 验证输入邮政编号
match(); 如果str 符合 regex的正则表达式格式,返回true, 否则返回 false;
isIDcard(); 验证输入身份证号
containsBoolean(); 请求xml参数判断
getTimeAndToString(); 获取当前日期(2016-12-29 11:23:09)
getProperties(); 读取.properties 结尾的配置文件用,getP, getParam
getSurFaceId(); 获取ID
MD5(); 加密
allMenuToTree(); 使用递归方法建树
findChildren(Map<String, Object> treeNode, List<Map<String, Object>> treeNodes, int level); 递归查找子节点
deskTopsTree(); 使用递归建树
findChildren(List<Map<String, Object>> treeNode, String id); 递归判断id是否在集合中存在
getIPPropertiesPath(); 获取ip.properties路径
deleteFile(); 删除单个文件
card(); 随机不重复的6-8位
replaceUnderLineAndUpperCase(); 将表名转为Java经常使用的名字,如code_model转CodeModel
toLowerCaseFirstOne(); 字符串首字母转小写
writeTxtFile(); 写入内容到文件
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册