<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="../../common.jsp"></jsp:include>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <link href="${resourcePath}/layuiadmin/style/admin.css" rel="stylesheet">
    <meta name="keywords" content="">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="renderer" content="webkit">
    <title>陕西超掌柜科技有限公司</title>

    <script type="text/javascript">
        require("js/main/main.js");
    </script>
    <style type="text/css">
        .layui-nav-child {
            padding: 1px 0;
        }

        .layui-icon.layui-icon-notice {
            font-size: 25px !important;
        }

        .layui-badge-dot {
            width: 13px;
            height: 13px;
            margin-top: -12px !important;
            margin-left: -10px !important;
        }

        .layui-form-label {
            width: 96px;
        }

        .layui-body {
            position: fixed !important;
        }

        .layadmin-iframe {
            background-color: #ffffff;
        }
    </style>

</head>

<body class="layui-layout-body">
<div id="LAY_app">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <!-- 头部区域 -->
            <ul class="layui-nav layui-layout-left">
                <li class="layui-nav-item layadmin-flexible" lay-unselect>
                    <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
                        <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                    </a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;" layadmin-event="refresh" title="刷新">
                        <i class="layui-icon layui-icon-refresh-3"></i>
                    </a>
                </li>
            </ul>
            <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">

                <li class="layui-nav-item" lay-unselect>
                    <a lay-text="消息通知" layadmin-event="message" lay-href="${ctx}/notification/index">
                        <i class="layui-icon layui-icon-notice"></i>
                        <!-- 如果有新消息，则显示小圆点 -->
                        <span class="layui-badge-dot hide"></span>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="theme">
                        <i class="layui-icon layui-icon-theme"></i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="note">
                        <i class="layui-icon layui-icon-note"></i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="fullscreen">
                        <i class="layui-icon layui-icon-screen-full"></i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="openVideo">
                        <i class="layui-icon layui-icon-mute" id="video-icon" style="font-size: 20px"></i>
                        <span class="layui-badge audit-num" id="audit-num"></span>
                    </a>
                    <div class="layui-hide">
                        <audio autoplay id="au" controls>
                            <source src="${resourcePath}/css/2.mp3" type="audio/mpeg">
                        </audio>
                    </div>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        <cite>管理员</cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd layadmin-event="logout" style="text-align: center;"><a>退出</a></dd>
                    </dl>
                </li>

                <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-unselect>
                    <a href="javascript:;" layadmin-event="more"><i class="layui-icon layui-icon-more-vertical"></i></a>
                </li>
            </ul>
        </div>

        <!-- 侧边菜单 -->
        <div class="layui-side layui-side-menu">
            <div class="layui-side-scroll">
                <div class="layui-logo" lay-href="home/console.html">
                    <span>快银管理平台</span>
                </div>

                <div class="layui-side layui-bg-black">
                    <div class="layui-side-scroll" id="leftMenu">
                    </div>
                </div>
            </div>
        </div>

        <!-- 页面标签 -->
        <div class="layadmin-pagetabs" id="LAY_app_tabs">
            <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-down">
                <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;"></a>
                        <dl class="layui-nav-child layui-anim-fadein">
                            <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
                            <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
                            <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
            <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
                <ul class="layui-tab-title" id="LAY_app_tabsheader">
                    <li lay-id="home/console.html" lay-attr="home/console.html" class="layui-this"><i
                            class="layui-icon layui-icon-home"></i></li>
                </ul>
            </div>
        </div>


        <!-- 主体内容 -->
        <div class="layui-body" id="LAY_app_body">
            <div class="layadmin-tabsbody-item layui-show">
                <iframe class="layadmin-iframe" frameborder="0" src="${ctx}/platform/first" title="内页"></iframe>
            </div>
        </div>

        <!-- 辅助元素，一般用于移动设备下遮罩 -->
        <div class="layadmin-body-shade" layadmin-event="shade"></div>
    </div>
</div>
</body>
<script type="text/javascript">

    document.onselectstart = function () {
        return false;
    };

    $(document).ready(function () {
        $.ajax({
            url: ctx + "/notification/countStatus",
            method: 'get',
            dataType: 'JSON',
            contentType: "application/json",
            success: function (count) {
                if (count > 0) {
                    $(".testc").html("<b><scan class=\"layui-badge-dot\" style=\"margin: -19px 18px 0;\"></scan></b>");
                }
            }
        })
        initAuditData();


    });

    function logout() {
        $.ajax({
            url: ctx + "/platform/logout",
            type: 'POST',
            async: false,
            success: function (data) {
                window.location.href = data.url
            },
            error: function (jqXHR, textStatus, errorThrown) {
                console.log(jqXHR.status)
                window.location = $('#logout').val();
            }
        })
    }

    var id = 0;

    function initAuditData() {
        getAuditData();
        setInterval("getAuditData()", 5000);
    }

    function getAuditData() {
        let status = window.localStorage.getItem("status");
        $.ajax({
            url: ctx + "/platform/getAuditData",
            type: 'POST',
            async: false,
            success: function (res) {
                if (res.code == 200) {
                    let data = res.data;
                    let count = 0;
                    if (data.count) {
                        count = data.count;
                    }
                    if (data.id && data.id != 0 && status == 1 && data.count > 0) {
                        play(data.id);
                    } else {
                        pause();
                    }
                    $("#audit-num").html(count);
                }
            }
        })
    }

    function play(nid) {
        if (nid != id) {
            id = nid;
            $("#au")[0].play();
        }
    }

    function pause() {
        $("#au")[0].pause();
    }
</script>

</html>