<?php defined('EM_ROOT') || exit('access denied!'); ?>
<!doctype html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
<!--    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name=renderer content=webkit>
    <title>管理中心 - <?= Option::get('blogname') ?></title>
    <link rel="shortcut icon" href="./views/images/favicon.ico"/>

    <link rel="stylesheet" href="./views/layui-v2.11.6//layui/css/layui.css">
    <script src="./views/layui-v2.11.6/layui/layui.js"></script>


    <!-- jquery v3.5.1 -->
    <script src="./views/js/jquery.min.3.5.1.js"></script>



    <!-- 字体 -->
    <link rel="stylesheet" type="text/css" href="./views/font-awesome-4.7.0/css/font-awesome.min.css">

    <!--  拖动排序  -->
    <script src="./views/js/jquery-ui.min.js?t=<?= Option::EM_VERSION_TIMESTAMP ?>"></script>



<!--    <script src="./views/js/bootstrap.bundle.min.4.6.js?t=--><?php //= Option::EM_VERSION_TIMESTAMP ?><!--"></script>-->

<!--    <script src="./views/js/jquery.ui.touch-punch.min.js?t=--><?php //= Option::EM_VERSION_TIMESTAMP ?><!--"></script>-->
<!--    <script src="./views/js/jquery.ui.timepicker-addon.min.js?t=--><?php //= Option::EM_VERSION_TIMESTAMP ?><!--"></script>-->
<!--    <script src="./views/js/jquery.pjax.js?t=--><?php //= Option::EM_VERSION_TIMESTAMP ?><!--"></script>-->
<!--    <script src="./views/js/js.cookie-2.2.1.min.js?t=--><?php //= Option::EM_VERSION_TIMESTAMP ?><!--"></script>-->




    <link rel="stylesheet" href="./views/css/style.css?v=<?= time() ?>">

    <script src="./views/js/common.js?t=<?= Option::EM_VERSION_TIMESTAMP ?>"></script>

    <script>
        $(function(){
            var Accordion = function(el, multiple) {
                this.el = el || {};
                this.multiple = multiple || false;

                // Variables privadas
                var links = this.el.find('.link');
                // Evento
                links.on('click', {el: this.el, multiple: this.multiple}, this.dropdown)
            }

            Accordion.prototype.dropdown = function(e) {
                var $el = e.data.el;
                $this = $(this),
                    $next = $this.next();

                $this.find('.admin-arrow').toggleClass('active')

                $next.slideToggle();
                $this.parent().toggleClass('open');

                if (!e.data.multiple) {
                    $el.find('.submenu').not($next).slideUp().parent().removeClass('open');
                    $el.find('.submenu').not($next).slideUp().parent().children().children().removeClass('active');
                };
            }

            var accordion = new Accordion($('#accordion'), false);
        })
    </script>
    <?php doAction('adm_head') ?>
</head>
<body id="page-top">
<div id="editor-md-dialog"></div>
<div id="admin-container">
    <!-- 遮罩层 -->
    <div class="overlay"></div>


    <nav class="menu-container" id="left-menu">
        <a class="logo" href="<?= EM_URL ?>admin">
            <?= Option::get('blogname') ?>
        </a>
        <ul id="accordion" class="menu accordion">
            <li class="admin-menu-item" id="menu-dashboard">
                <a href="./" class="menu-link"><i class="fa fa-one fa-dashboard"></i>控制台</a>
            </li>

            <li class="admin-menu-item has-submenu" id="menu-goods">
                <div class="menu-link link">
                    <i class="fa fa-one fa-sitemap"></i><span>商品管理</span><i class="admin-arrow fa fa-angle-right"></i>
                </div>
                <ul class="submenu">
                    <li id="menu-goods-list" class="admin-menu-item"><a href="goods.php" class="menu-link">-&nbsp;&nbsp;商品列表</a></li>
<!--                    <li id="menu-stock-list" class="admin-menu-item"><a href="stock.php" class="menu-link">-&nbsp;&nbsp;库存管理</a></li>-->
                    <li id="menu-sort-list" class="admin-menu-item"><a href="sort.php" class="menu-link">-&nbsp;&nbsp;商品分类</a></li>
                    <li id="menu-sku-list" class="admin-menu-item"><a href="sku.php" class="menu-link">-&nbsp;&nbsp;商品规格</a></li>
                </ul>
            </li>
            <li class="admin-menu-item has-submenu" id="menu-order">
                <div class="menu-link link">
                    <i class="fa fa-one fa-list-ul"></i>订单管理<i class="admin-arrow fa fa-angle-right"></i>
                </div>
                <ul class="submenu">
                    <li id="menu-order-goods" class="admin-menu-item"><a href="order.php" class="menu-link">-&nbsp;&nbsp;商品订单</a></li>
                </ul>
            </li>

            <li class="admin-menu-item has-submenu" id="menu-user">
                <div class="menu-link link">
                    <i class="fa fa-one fa-user"></i>用户管理<i class="admin-arrow fa fa-angle-right"></i>
                </div>
                <ul class="submenu">
                    <li id="menu-user-default" class="admin-menu-item"><a href="user.php" class="menu-link">-&nbsp;&nbsp;用户管理</a></li>
                    <li id="menu-user-member" class="admin-menu-item"><a href="member.php" class="menu-link">-&nbsp;&nbsp;会员等级</a></li>
                </ul>
            </li>
            <li class="admin-menu-item has-submenu" id="menu-blog">
                <div class="menu-link link">
                    <i class="fa fa-one fa-columns"></i>博客管理<i class="admin-arrow fa fa-angle-right"></i>
                </div>
                <ul class="submenu">
                    <li id="menu-blog-list" class="admin-menu-item"><a href="article.php" class="menu-link">-&nbsp;&nbsp;文章列表</a></li>
                    <li id="menu-blog-sort" class="admin-menu-item"><a href="sort.php?type=blog" class="menu-link">-&nbsp;&nbsp;文章分类</a></li>
                    <li id="menu-blog-widgets" class="admin-menu-item"><a href="widgets.php" class="menu-link">-&nbsp;&nbsp;边栏管理</a></li>
                    <li id="menu-blog-link" class="admin-menu-item"><a href="link.php" class="menu-link">-&nbsp;&nbsp;友情链接</a></li>
                </ul>
            </li>
            <li class="admin-menu-item has-submenu" id="menu-appearance">
                <div class="menu-link link">
                    <i class="fa fa-one fa-inbox"></i>外观设置<i class="admin-arrow fa fa-angle-right"></i>
                </div>
                <ul class="submenu">
                    <li id="menu-template" class="admin-menu-item"><a href="template.php" class="menu-link">-&nbsp;&nbsp;模板管理</a></li>
                    <li id="menu-navi" class="admin-menu-item"><a href="navbar.php" class="menu-link">-&nbsp;&nbsp;导航管理</a></li>
                    <li id="menu-page" class="admin-menu-item"><a href="page.php" class="menu-link">-&nbsp;&nbsp;页面管理</a></li>
                </ul>
            </li>

            <li id="menu-plugin" class="admin-menu-item">
                <a href="plugin.php" class="menu-link"><i class="fa fa-one fa-sliders"></i>插件管理</a>
            </li>
            <li  class="admin-menu-item has-submenu" id="menu-system">
                <div class="menu-link link">
                    <i class="fa fa-one fa-cog"></i>系统管理<i class="admin-arrow fa fa-angle-right"></i>
                </div>
                <ul class="submenu">
                    <li id="menu-setting" class="admin-menu-item"><a href="setting.php" class="menu-link">-&nbsp;&nbsp;基础设置</a></li>
                    <li id="menu-shop" class="admin-menu-item"><a href="shop.php" class="menu-link">-&nbsp;&nbsp;商城配置</a></li>
                    <li id="menu-media" class="admin-menu-item"><a href="media.php" class="menu-link">-&nbsp;&nbsp;资源管理</a></li>
                </ul>
            </li>
            <li id="menu-store" class="admin-menu-item">
                <a href="store.php" class="menu-link">
                    <i class="fa fa-one fa-shopping-cart"></i>应用商店
                </a>
            </li>

            <?php if (Register::isRegLocal()) : ?>
                <li id="menu-auth" class="admin-menu-item   ">
                    <a href="auth.php" class="menu-link ">
                        <i class="fa fa-one fa-diamond"></i>正版授权
                    </a>
                </li>
            <?php endif; ?>
            <?php if (!Register::isRegLocal()) : ?>
                <li id="menu-auth" class="admin-menu-item   ">
                    <a href="auth.php" class="menu-link " style="font-weight: bold; color: #c50000;">
                        <i class="fa fa-one fa-diamond" style="font-weight: bold; color: #c50000;"></i>申请正版授权
                    </a>
                </li>
            <?php endif; ?>


            <?php doAction('adm_menu') ?>
        </ul>



    </nav>




    <div id="" class="main">

        <ul class="layui-nav top-nav pc-top-nav" lay-bar="disabled">


            <div class="" style="display: inline-block; line-height: 62px;">
                <span class="layui-breadcrumb" lay-separator=">">
                    <?= $br ?>
                </span>
            </div>
            <div style="float: right;">
                <li class="layui-nav-item" lay-unselect>
                    <a href="<?= EM_URL ?>" target="_blank">网站首页</a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        <img src="<?= User::getAvatar($user_cache[UID]['avatar']) ?>" class="layui-nav-img">
                        <span><?= $user_cache[UID]['name'] ?></span>
                    </a>
                    <dl class="layui-nav-child layui-nav-child-c">
                        <dd><a href="blogger.php">个人信息</a></dd>
                        <dd><a href="javascript:;" class="delete-cache">清除缓存</a></dd>
                        <hr>
                        <dd><a href="account.php?action=logout">退出登录</a></dd>
                    </dl>
                </li>
            </div>

        </ul>




        <menu class="nav top-nav mobile-top-nav" style="padding-left: 0; padding-right: 0;">
            <ul class="layui-nav layui-bg-gray" lay-bar="disabled" style="width: 100%; display: flex;justify-content: space-between;">
                <li class="item nav-item" id="mobile-menu-btn" style="line-height: 62px;">
                    <span style="padding: 10px;"><i class="fa fa-bars" style="font-size: 20px;"></i></span>
                </li>

                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        <img src="<?= User::getAvatar($user_cache[UID]['avatar']) ?>" class="layui-nav-img">
                        <span><?= $user_cache[UID]['name'] ?></span>
                    </a>
                    <dl class="layui-nav-child layui-nav-child-c">
                        <dd><a href="<?= EM_URL ?>">网站首页</a></dd>
                        <dd><a href="blogger.php">个人信息</a></dd>
                        <dd><a href="javascript:;" class="delete-cache">清除缓存</a></dd>
                        <hr>
                        <dd><a href="account.php?action=logout">退出登录</a></dd>
                    </dl>
                </li>


            </ul>

        </menu>

        <script>
            $('#mobile-menu-btn').click(function(){
                $('#left-menu').addClass('show');
                $('.main').addClass('show_menu');
                $('.overlay').addClass('show');
                document.body.style.overflow = 'hidden';
            })
            $('.overlay').click(function(){
                $('#left-menu').removeClass('show');
                $('.main').removeClass('show_menu');
                $('.overlay').removeClass('show');
                document.body.style.overflow = '';
            })

            $('.delete-cache').click(function(){
                layer.load(2);
                $.ajax({
                    type: "POST",
                    url: "index.php?action=delete_cache",
                    data: { type: 'cache' },
                    dataType: "json",
                    success: function (e) {
                        layer.alert('缓存删除成功')
                    },
                    error: function (xhr) {
                        layer.msg(JSON.parse(xhr.responseText).msg);
                    },
                    complete: function(xhr, textStatus) {
                        layer.closeAll('loading');
                    }
                });
            })

        </script>

        <div id="admin-content">

