<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover">
	<meta name="applicable-device" content="pc, mobile">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="renderer" content="webkit">
	<meta name="force-rendering" content="webkit">
    <link href="{$data.bz_logo}" rel="icon">
    <title>{$data.bz_title}</title>
    <meta name="keywords" content="{$data.bz_keywords}">
	<meta name="description" content="{$data.bz_description}">
    <link rel="stylesheet" href="../../static/assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="../../static/assets/module/admin.css"/>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <!-- 头部 -->
    <div class="layui-header">
        <div class="layui-logo">
            <img src="../../static/assets/images/dsadsaf2.png"/>
            <cite>&nbsp;码商管理</cite>
        </div>
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="flexible" title="侧边伸缩"><i class="layui-icon layui-icon-shrink-right"></i></a>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="refresh" title="刷新"><i class="layui-icon layui-icon-refresh-3"></i></a>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item" lay-unselect>
                <a>
                    <img src="../../static/assets/images/dsadsaf2.png" class="layui-nav-img">
                    <cite>{$data.username}</cite>
                </a>
                <dl class="layui-nav-child">
                    <dd lay-unselect><a ew-event="psw" data-url="password.html" data-window="parent">修改密码</a></dd>
                    <dd lay-unselect><a ew-event="logout" data-url="{:url('Login')}" data-ajax="{:url('Logout')}" data-method="post" data-code="404" data-parse-data="return {code: res.status, msg: res.msg}" data-confirm="true">退出登录</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="theme" data-url="theme.html" data-window="parent" lay-tips="主题"><i class="layui-icon layui-icon-more-vertical"></i></a>
            </li>
        </ul>
    </div>
    <!-- 侧边栏 -->
    <div class="layui-side">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree" lay-filter="admin-side-nav" style="margin: 15px 0;">
            </ul>
        </div>
    </div>
    <!-- 主体部分 -->
    <div class="layui-body"></div>
    <!-- 底部 -->
    <div class="layui-footer layui-text">
        &copy; {:date('Y')} All {$data.bz_title} 版权所有.  <a href="http://beian.miit.gov.cn" target="_blank"> {$data.bz_icp}</a>
        <span class="pull-right">本站程序由呆呆提供学习研究服务</span>
    </div>
</div>
<!-- 加载动画 -->
<div class="page-loading">
    <div class="ball-loader">
        <span></span><span></span><span></span><span></span>
    </div>
</div>
<!-- 侧边栏渲染模板 -->
<script id="sideNav" type="text/html">
    {{#  layui.each(d, function(index, item){ }}
    <li class="layui-nav-item {{= item.itemed ? 'layui-nav-itemed' : '' }}">
        <a {{# if (item.url) { }}lay-href="{{item.url}}"{{# } }}>
            {{# if (item.icon) { }}<i class="{{item.icon}}"></i>{{# } }}
            &emsp;
            <cite>{{ item.name }}</cite>
        </a>
        {{# if(item.subMenus&&item.subMenus.length>0){ getSubMenus(item.subMenus); } }}
    </li>
    {{#  }); }}
    {{# function getSubMenus(subMenus){ }}
    <dl class="layui-nav-child">
        {{# layui.each(subMenus, function(index, subItem){ }}
        <dd class="{{= subItem.itemed ? 'layui-nav-itemed' : '' }}">
            <a {{# if (subItem.url) { }}lay-href="{{subItem.url}}"{{# } }}>{{# if (subItem.icon) { }}<i class="{{subItem.icon}}"></i>{{# } }}&emsp;<cite>{{ subItem.name }}</cite></a>
            {{# if(subItem.subMenus&&subItem.subMenus.length>0){ getSubMenus(subItem.subMenus); } }}
        </dd>
        {{# }); }}
    </dl>
    {{# } }}
</script>
<!-- js部分 -->
<script type="text/javascript" src="../../static/assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="../../static/assets/js/common.js"></script>
<script>
    layui.use(['layer', 'admin', 'index', 'laytpl', 'element'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var admin = layui.admin;
        var index = layui.index;
        var laytpl = layui.laytpl;
        var element = layui.element;
        
        $.ajaxSetup({
            complete: function (xhr) {
                try {
                    var res = JSON.parse(xhr.responseText);
                    if (404 === res.status) {
                        location.replace("{:url('login')}");
                    }
                } catch (e) {
                    
                }
            }
        });
        // ajax渲染侧边栏
        admin.req("{:url('index_menu')}", function(res){
            console.log(res);
            if (res.status === 1) {
                laytpl(sideNav.innerHTML).render(res.data.json, function (html) {
                    $('*[lay-filter=admin-side-nav]').html(html);
                    element.render('nav');
                    index.loadHome({
                        menuPath: res.data.json[0].url,
                        menuName: '<i class="layui-icon layui-icon-home"></i>',
                        loadSetting: true,
                        onlyLast: false
                    });
                    admin.activeNav(res.data.json[0].url);
                });
            }else{
                location.replace("{:url('login')}");
            }
            
        }, 'post');
    });
</script>
</body>
</html>