{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>后台管理</title>
    <link rel="stylesheet" href="{% static '/lib/layui/css/layui.css' %}">
    <link rel="stylesheet" href="{% static '/lib/css/reset.css' %}">
    <link rel="stylesheet" href="{% static '/lib/font/fontIcon/iconfont.css' %}">
    <!-- <link rel="stylesheet" href="{% static '/lib/font-awesome/4.5.0/css/font-awesome.css' %}"> -->
    <link rel="stylesheet" href="{% static '/css/home.css' %}">
    <style>
            @charset "utf-8";
            /* 以下实际使用若已初始化可删除 .nav height父级需逐级设置为100%*/
    
            body,
            html {
                height: 100%;
                background: #E2E2E2
            }
    
            body,
            ul {
                margin: 0;
                padding: 0
            }
    
            body {
                font: 14px "微软雅黑", "宋体", "Arial Narrow", HELVETICA;
                -webkit-text-size-adjust: 100%;
            }
    
            li {
                list-style: none
            }
    
            a {
                text-decoration: none;
            }
    
            /* 以上实际使用若已初始化可删除 */
    
            /* nav */
    
            .nav {
                width: 220px;
                height: 100%;
                background: #263238;
                transition: all .3s;
            }
    
            .nav a {
                display: block;
                overflow: hidden;
                padding-left: 20px;
                line-height: 46px;
                height: 46px;
                max-height: 46px;
                color: #ABB1B7;
                transition: all .3s;
            }
    
            .nav a span {
                margin-left: 30px;
            }
    
            .nav-item {
                position: relative;
            }
    
            .nav-item.nav-show {
                border-bottom: none;
            }
            .nav-item.nav-show.active{
                background: yellow
            }
    
            .nav-item ul {
                display: none;
                background: rgba(0, 0, 0, .1);
            }
    
            .nav-item.nav-show ul .active {
                /* display: block; */
                background: yellow
            }
    
            .nav-item>a:before {
                content: "";
                position: absolute;
                left: 0px;
                width: 2px;
                height: 46px;
                background: #34A0CE;
                opacity: 0;
                transition: all .3s;
            }
    
            .nav .nav-icon {
                font-size: 20px;
                position: absolute;
                margin-left: -1px;
            }
    
            /* 此处修改导航图标 可自定义iconfont 替换*/
    
            .icon_1::after {
                content: "\e62b";
            }
    
            .icon_2::after {
                content: "\e669";
            }
    
            .icon_3::after {
                content: "\e61d";
            }
    
            /*---------------------*/
    
            .nav-more {
                float: right;
                margin-right: 20px;
                font-size: 12px;
                transition: transform .3s;
            }
    
            /* 此处为导航右侧箭头 如果自定义iconfont 也需要替换*/
    
            .nav-more::after {
                content: "\e621";
            }
    
            /*---------------------*/
    
            .nav-show .nav-more {
                transform: rotate(90deg);
            }
    
            .nav-show,
            .nav-item>a:hover {
                color: #FFF;
                background: rgba(0, 0, 0, .1);
            }
    
            .nav-show>a:before,
            .nav-item>a:hover:before {
                opacity: 1;
            }
    
            .nav-item li:hover a {
                color: #FFF;
                background: rgba(0, 0, 0, .1);
            }
    
            /* nav-mini */
    
            .nav-mini.nav {
                width: 60px;
            }
    
            .nav-mini.nav .nav-icon {
                /* margin-left:-2px; */
            }
    
            .nav-mini.nav .nav-item>a span {
                display: none;
            }
    
            .nav-mini.nav .nav-more {
                margin-right: -20px;
            }
    
            .nav-mini.nav .nav-item ul {
                position: absolute;
                top: 0px;
                left: 60px;
                width: 180px;
                z-index: 99;
                background: #3C474C;
                overflow: hidden;
            }
    
            .nav-mini.nav .nav-item:hover {
                background: rgba(255, 255, 255, .1);
            }
    
            .nav-mini.nav .nav-item:hover .nav-item a {
                color: #FFF;
            }
    
            .nav-mini.nav .nav-item:hover a:before {
                opacity: 1;
            }
    
            .nav-mini.nav .nav-item:hover ul {
                display: block;
            }
        </style>
</head>

<body>
    <!-- 头部 -->
    <div class="header" id="navbar">
        <div class="logo">休闲农业旅游网</div>
        <div class="navigation">
            <ul class="layui-nav layui-bg-blue">
                <li class="layui-nav-item">
                    <a href="">控制台
                        <!-- <span class="layui-badge">9</span> -->
                    </a>
                </li>
                <li class="layui-nav-item">
                    <a href="">个人中心
                        <!-- <span class="layui-badge-dot"></span> -->
                    </a>
                </li>
                <li class="layui-nav-item" lay-unselect="">
                    <a href="javascript:;">
                        <img src="{% static 'imgs/productImg.jpg'%}" class="layui-nav-img">
                        <span class="currUser" id="">我</span>
                    </a>
                    <dl class="layui-nav-child">
                        <dd>
                            <a href="videoList.html" target="BoardRight">修改信息</a>
                        </dd>
                        <dd>
                            <a href="javascript:;">安全管理</a>
                        </dd>
                        <dd>
                            <a href="javascript:;">退了</a>
                        </dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
    <!-- 下半部 -->
    <div class="main-container" id="main-container">
        <!-- 菜单栏 -->
        <div class="nav">
            <div class="nav-top">
                <div id="mini" style="border-bottom:1px solid rgba(255,255,255,.1)">
                    <img src="{% static 'imgs/dev/icon_110.png'%}">
                    <span>分类</span>
                </div>
            </div>
            <ul id="menu">

            </ul>
        </div>
        <!-- 主题部分 -->
        <div class="main-content">
            <!-- 内容 -->
            <div class="iframeDiv">
                <!-- <iframe name="BoardRight" id="iframe-main" src="map" width="100%" height="800px" frameborder="1"></iframe> -->
            </div>
        </div>
        <!-- banquan -->
        <div class="copyrightBox">
            <div>
                <p>
                    <a class="copyright" rel="nofollow" href="">版权信息</a>
                </p>
            </div>

        </div>
    </div>
    <!-- <a href="javascript:;" onclick="goUp()" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse display">
        <i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
    </a> -->

    <script src="{% static '/lib/js/jquery-2.1.4.min.js'%}"></script>
    <script src="{% static '/lib/layui/layui.js'%}"></script>
    <!-- <script src="{% static '/js/backstageNet/home.js'%}"></script> -->
    <script>
            $(function () {
                var navList = [
                    {
                        "p": "银川市",
                        // "c": ["兴庆区", "金凤区", "西夏区", "中宁县", "灵武市", "贺兰县"]
                    },
                    {
                        "p": "石嘴山市",
                        "c": ["大武口区", "惠农区", "平罗县"]
                    },
                    {
                        "p": "吴忠市",
                        "c": ["利通区", "红寺堡区", "盐池县", "同心县", "青铜峡市"]
                    },
                    {
                        "p": "中卫市",
                        "c": ["沙坡头区", "中宁县", "海原县"]
                    },
                    {
                        "p": "固原市",
                        "c": ["原州区", "泾源县", "西吉县", "隆德县", "彭阳县"]
                    }
                ]
                var navData = '';
                for (let i = 0; i < navList.length; i++) {
                    navData += "<li class='nav-item'><a href='javascript:;'><i class='my-icon nav-icon icon_1'></i><span>" + navList[i].p + "</span>"
                    if(navList[i].c){
                        navData += "<i class='my-icon nav-more'></i></a><ul>";
                        for (let w = 0; w < navList[i].c.length; w++) {
                            navData += "<li><a href='javascript:;'><span>" + navList[i].c[w] + "</span></a></li>";
                            if(w == navList[i].c.length-1){
                                navData += "</ul>"
                            }
                        }
                    }else{
                        navData += "</a>";
                    }
                    
                    navData += "</li>";
                }
                $('#menu').html(navData)
    
                $(function () {
                    // nav收缩展开
                    $('#menu').on('click', '.nav-item>a', function () {
                        if (!$('.nav').hasClass('nav-mini')) { //不是小图标
                            if ($(this).next().length == 0){ //没有子元素
                                $('.nav-item').removeClass('nav-show');
                                $('.nav-item').children('ul').slideUp(300,function(){
                                        $(this).removeAttr("style");
                                    });
                                $(this).parent('li').addClass('nav-show');
                            }else{
                                if ($(this).next().css('display') == "none") {
                                    //展开未展开
                                    $('.nav-item').children('ul').slideUp(300,function(){
                                        $(this).removeAttr("style");
                                    });
                                    $(this).next('ul').slideDown(300);
                                    $(this).parent('li').addClass('nav-show').siblings('li').removeClass('nav-show');
                                } else {
                                    //收缩已展开
                                    $(this).next('ul').slideUp(300,function(){
                                        $(this).removeAttr("style");
                                    });
                                    $('.nav-item.nav-show').removeClass('nav-show');
                                }
                            }
                            
                        }else{ //小图标样式
                            // $('.nav-item').removeClass('nav-show');
                            // $(this).parent('li').addClass('nav-show');
                            if ($(this).next().length == 0){ //没有子元素
                                $('.nav-item').removeClass('nav-show');
                                $('.nav-item').children('ul').slideUp(300,function(){
                                        $(this).removeAttr("style");
                                    });
                                $(this).parent('li').addClass('nav-show');
                            }
                        }
                    });
                    // 标志点击样式
                    $('#menu').on('click', '.nav-item>ul>li', function () {
                        if (!$('.nav').hasClass('nav-mini')) { //不是小图标

                        }else{
                            $('.nav-item').removeClass('nav-show');
                            $(this).parents('.nav-item').addClass('nav-show');
                        }
                        // $('.nav-item>ul>li').css('background', 'none')
                        $('.nav-item>ul>li').removeClass('active');
                        $(this).addClass('active');
                        // $(this).css('background', 'yellow')
                        //  	$(this).siblings().css('background','none')
                    })
                    //nav-mini切换
                    $('#mini').on('click', function () {
                        if (!$('.nav').hasClass('nav-mini')) { //小图标格式
                            // $('.nav-item.nav-show').removeClass('nav-show');
                            // $('.nav-item').children('ul').removeAttr('style');
                            $('.nav-item>ul').removeAttr("style");
                            $('.nav').addClass('nav-mini');
                        } else {  //大图标格式
                            $('.nav').removeClass('nav-mini');
                        }
                    });
                });
            })
        </script>
    <script>
        layui.use('element', function () {
            var element = layui.element;

            //一些事件监听
            element.on('tab(demo)', function (data) {
                console.log(data);
            });
        });
    </script>
</body>

</html>