<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>米菇菜果管理系统</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>


    <link rel="shortcut icon" th:href="@{ /images/logo.jpg}"/>
    <link rel="stylesheet" th:href="@{/css/font.css}">
    <link rel="stylesheet" th:href="@{/css/xadmin.css}">
    <script type="text/javascript" th:src="@{/js/jquery-3.3.1.min.js}"></script>
    <script th:src="@{/js/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/md5.js}"></script>
</head>
<body>

<!-- 顶部开始 -->
<div class="container">
    <div class="logo"><a>米菇菜果管理系统</a></div>
    <div class="left_open">
        <i title="展开左侧栏" class="iconfont">&#xe699;</i>
    </div>
    <ul class="layui-nav right" lay-filter="">
        <li class="layui-nav-item">
            <a href="javascript:;" th:text="${admin.adminName+'['+admin.adminAccount+']'}"></a>
            <dl class="layui-nav-child">
                <dd><a onclick="adminInfo()">个人信息</a></dd>
                <dd><a href="login">退出</a></dd>
            </dl>
        </li>
        <li class="layui-nav-item to-index" th:text="${admin.roleName}"></li>
    </ul>

</div>
<div class="left-nav">
    <div id="side-nav">
        <ul id="nav">

        </ul>
    </div>
</div>
<div class="page-content">
    <div class="layui-tab tab" lay-filter="xbs_tab" lay-allowclose="false">
        <ul class="layui-tab-title">
            <li class="home"><i class="layui-icon">&#xe68e;</i>首页</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <iframe src='welcome' frameborder="0" scrolling="yes" class="x-iframe"></iframe>
            </div>
        </div>
    </div>
</div>
<div class="page-content-bg"></div>

<div class="footer" style="text-align: center">
    <div class="copyright"></div>
</div>
<script type="text/javascript">
    layui.use('layer', function () {
        var layer = layui.layer;
    });
    $(function () {
        $.ajax({
            url: "menu/getMenu",
            type: "POST",
            async: false,
            dataType: "json",
            success: function (result) {
                initMenu(result.adminMenu[0].childMenus, '#nav');
            },
            error: function (data) {
                console.log(data);
            },
        });
    })

    function initMenu(menuList, pId) {
        for (var i = 0; i < menuList.length; i++) {
            var menu = menuList[i];
            var menuIcon = menu.menuIcon;
            if (menuIcon != '' && menuIcon != null) {
                menuIcon = '&#' + menuIcon + ';';
            }
            if (menu.childMenus.length > 0) {
                $(pId).append('<li id="li' + menu.menuId + '"><a> <i class="iconfont">' + menuIcon + '</i> <cite>' + menu.menuName + '</cite><i class="iconfont nav_right">&#xe697;</i></a><ul class="sub-menu" id="ul' + menu.menuId + '"></ul></li>');
                initMenu(menu.childMenus, '#ul' + menu.menuId);
            } else {
                $(pId).append('<li id="li' + menu.menuId + '"><a _href="' + menu.menuUrl + '"> <i class="iconfont">' + menuIcon + '</i> <cite>' + menu.menuName + '</cite></a></li>');

            }
        }
    }

    function adminInfo() {
        var w = ($(window).width() * 0.9);
        var h = ($(window).height() * 0.9);
        layer.open({
            type: 2,
            area: [w + 'px', h + 'px'],
            fix: false,
            shadeClose: true,
            shade: 0.4,
            title: '个人信息',
            content: '/admin/adminInfo'
            , btn: ['保存', '关闭']
            , yes: function (index, layero) {
                var body = layer.getChildFrame('body', index); //得到iframe页面层的BODY
                var iframeBtn = body.find('#saveBtn');//得到iframe页面层的提交按钮
                iframeBtn.click();//模拟iframe页面层的提交按钮点击
            }

        });
    }

</script>
<script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
<!--<script type="text/javascript" th:src="@{/beta/js/xadmin.js}"></script>-->
</body>
</html>
