12 changed files with 489 additions and 180 deletions
@ -0,0 +1,124 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en"> |
||||
|
<head> |
||||
|
<meta charset="utf-8"> |
||||
|
<title>用户功能</title> |
||||
|
<meta name="renderer" content="webkit"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
||||
|
</head> |
||||
|
<body> |
||||
|
<style> |
||||
|
.layui-colla-content:before,.layui-colla-content:after{ |
||||
|
content: ""; |
||||
|
display: block; |
||||
|
clear: both; |
||||
|
} |
||||
|
</style> |
||||
|
<div class="layuimini-container"> |
||||
|
<div class="layuimini-main"> |
||||
|
<div class="layuimini-authority" id="layuimini-authority"> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
||||
|
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script> |
||||
|
<script> |
||||
|
|
||||
|
layui.use(['layer', 'miniTab', 'echarts','element'], function () { |
||||
|
var $ = layui.jquery, |
||||
|
layer = layui.layer, |
||||
|
element = layui.element, |
||||
|
miniTab = layui.miniTab; |
||||
|
|
||||
|
miniTab.listen(); |
||||
|
$(function () { |
||||
|
$.ajax({ |
||||
|
url: "/index/menus", |
||||
|
type: 'get', |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (data) { |
||||
|
let menuInfo = data.menuInfo; |
||||
|
for (let i = 0; i < menuInfo.length; i++) { |
||||
|
let menuInfoElement = menuInfo[i]; |
||||
|
if (menuInfoElement.href === '') { |
||||
|
let menuItem = createMenuList(menuInfoElement); |
||||
|
if(menuInfoElement.title.indexOf("辅助管理") !== -1){ |
||||
|
let resultChild = '<div class="layui-collapse"> ' + |
||||
|
'<div class="layui-colla-item">' + |
||||
|
'<h2 class="layui-colla-title">' + menuInfoElement.title + '</h2>' + |
||||
|
'<div class="layui-colla-content" >'; |
||||
|
resultChild += menuItem; |
||||
|
resultChild += '</div></div></div>'; |
||||
|
menuItem = resultChild; |
||||
|
} |
||||
|
$("#layuimini-authority").append(menuItem); |
||||
|
element.render(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
// 用于构造菜单列表 |
||||
|
function createMenuList(data) { |
||||
|
// 获取子菜单 |
||||
|
let childList = data.child; |
||||
|
// 如果存在子菜单 |
||||
|
if (childList.length > 0) { |
||||
|
let result = ''; |
||||
|
// 循环子菜单 |
||||
|
for (let i = 0; i < childList.length; i++) { |
||||
|
let childListElement = childList[i]; |
||||
|
if (childListElement.href.indexOf("my_")!== -1) { |
||||
|
continue; |
||||
|
} |
||||
|
result += createChildMenuList(childListElement); |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 用于构造子菜单列表 |
||||
|
function createChildMenuList(data) { |
||||
|
// 获取当前子菜单 |
||||
|
let childList = data.child; |
||||
|
// 定义返回结果 |
||||
|
let result; |
||||
|
// 如果存在子菜单 |
||||
|
if (childList !== undefined && childList !== null && childList.length > 0) { |
||||
|
let resultChild = '<div class="layui-collapse"> ' + |
||||
|
'<div class="layui-colla-item">' + |
||||
|
'<h2 class="layui-colla-title">' + data.title + '</h2>' + |
||||
|
'<div class="layui-colla-content" >'; |
||||
|
for (let i = 0; i < childList.length; i++) { |
||||
|
let childMenuList = createChildMenuList(childList[i]); |
||||
|
resultChild += childMenuList; |
||||
|
} |
||||
|
resultChild += '</div></div></div>'; |
||||
|
return resultChild; |
||||
|
} else { |
||||
|
// 如果不存在子菜单 |
||||
|
|
||||
|
// 构造标签 |
||||
|
let childItem_out = '<div class="layuimini-authority-content-item layuimini-qiuck-module">'; |
||||
|
let childItem_a = '<a href="javascript:;" layuimini-content-href="' + data.href+ '" data-title="' + data.title + '" data-icon="' + data.icon + '">'; |
||||
|
let childItem_i = '<i class="' + data.icon + '"></i>'; |
||||
|
let childItem_cite = ' <cite>' + data.title + '</cite></a></div>'; |
||||
|
result = childItem_out + childItem_a + childItem_i + childItem_cite; |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
}); |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
Loading…
Reference in new issue