@using MySystem.BsModels;
@{
    List<RightDic> RightList = ViewBag.RightList as List<RightDic>;        
    List<RightDic> menus = ViewBag.menus as List<RightDic>;
    string RightInfo = ViewBag.RightInfo as string;
    string SysUserName = ViewBag.SysUserName as string;
    string MyTaskCount = ViewBag.MyTaskCount as string;
    string Role = ViewBag.Role as string;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>客小爽后台管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <script>/^http(s*):\/\//.test(location.href) || alert('请先部署到服务器下再访问');</script>
    <style>
        .layui-form-select dl dd{
            color: #000 !important;
        }
    </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 layui-hide-xs" lay-unselect>
                        <a href="/" target="_blank" title="前台">
                            <i class="layui-icon layui-icon-website"></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>
                    <li class="layui-nav-item" lay-unselect>
                        <div class="layui-form" style="padding-top: 5px;">
                            <select name="menusearch" lay-search lay-filter="SearchMenu">
                                <option value="">搜索快捷菜单</option>
                                @foreach(RightDic sub in menus)
                                {
                                    if (RightInfo.Contains("," + sub.Id + ","))
                                    {
                                        string url = sub.Url;
                                        if (url.Contains("?"))
                                        {
                                            url += "&right=" + sub.Id;
                                        }
                                        else
                                        {
                                            url += "?right=" + sub.Id;
                                        }
                                        <option value="@(url)#@(sub.Name)">@sub.Name</option>
                                    }
                                }
                            </select>
                        </div>
                    </li>
                </ul>
                <ul class="layui-nav layui-layout-left">
                    
                </ul>
                <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
                    <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" lay-unselect>
                        <a href="javascript:;">
                            <cite>@ViewBag.SysRealName</cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd><a lay-href="/Admin/Home/AdminInfo">个人资料</a></dd>
                            <dd><a lay-href="/Admin/Home/LoginPassword">修改密码</a></dd>
                            <hr>
                            <dd style="text-align: center;"><a onclick="quit()">退出</a></dd>
                        </dl>
                    </li>

                    <li class="layui-nav-item layui-hide-xs" lay-unselect>
                        <a href="javascript:;" layadmin-event="about"><i class="layui-icon layui-icon-more-vertical"></i></a>
                    </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="/Admin/Home/Main">
                        <span>客小爽</span>
                    </div>

                    <ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">
                        <li data-name="get" class="layui-nav-item layui-nav-itemed layui-this">
                            <a href="javascript:;" lay-href="/Admin/Home/Main" lay-tips="控制台" lay-direction="2">
                                <i class="layui-icon layui-icon-auz"></i>
                                <cite>控制台</cite>
                            </a>
                        </li>
                        @foreach (RightDic sub1 in RightList.Where(m => m.RightLevel == 1).OrderByDescending(m => m.Sort).ThenBy(m => m.Id).ToList())
                        {
                            if (RightInfo.Contains("," + sub1.Id + ","))
                            {
                                string IdString = sub1.Id + "_";
                                List<RightDic> children1 = RightList.Where(m => m.RightLevel == 2 && m.Id.StartsWith(IdString)).OrderByDescending(m => m.Sort).ThenBy(m => m.Id).ToList();
                                <li data-name="component" class="layui-nav-item">
                                    @if (children1.Count > 0)
                                    {
                                        <a href="javascript:;" lay-tips="@sub1.Name" title="@sub1.Name" lay-direction="2">
                                            <i class="layui-icon @(string.IsNullOrEmpty(sub1.Icon) ? "layui-icon-component" : sub1.Icon)"></i>
                                            <cite>@sub1.Name</cite>
                                        </a>
                                        <dl class="layui-nav-child">
                                            @foreach (RightDic sub2 in children1)
                                            {
                                                if (RightInfo.Contains("," + sub2.Id + ","))
                                                {
                                                    IdString = sub2.Id + "_";
                                                    List<RightDic> children2 = RightList.Where(m => m.RightLevel == 3 && m.Id.StartsWith(IdString)).OrderByDescending(m => m.Sort).ThenBy(m => m.Id).ToList();
                                                    <dd data-name="grid">
                                                        @if (children2.Count > 0)
                                                        {
                                                            <a href="javascript:;" title="@sub2.Name">@sub2.Name</a>
                                                            <dl class="layui-nav-child">
                                                                @foreach (RightDic sub3 in children2)
                                                                {
                                                                    if (RightInfo.Contains("," + sub3.Id + ","))
                                                                    {
                                                                        string url = sub3.Url;
                                                                        if (url.Contains("?"))
                                                                        {
                                                                            url += "&right=" + sub3.Id;
                                                                        }
                                                                        else
                                                                        {
                                                                            url += "?right=" + sub3.Id;
                                                                        }
                                                                        <dd data-name="list"><a lay-href="@url" title="@sub3.Name">@sub3.Name</a></dd>
                                                                    }
                                                                }
                                                            </dl>
                                                        }
                                                        else
                                                        {
                                                            string url = sub2.Url;
                                                            if (url.Contains("?"))
                                                            {
                                                                url += "&right=" + sub2.Id;
                                                            }
                                                            else
                                                            {
                                                                url += "?right=" + sub2.Id;
                                                            }
                                                            <a lay-href="@url" title="@sub2.Name">@sub2.Name</a>
                                                            
                                                        }
                                                    </dd>
                                                }
                                            }
                                        </dl>
                                    }
                                    else
                                    {
                                        string url = sub1.Url;
                                        if (url.Contains("?"))
                                        {
                                            url += "&right=" + sub1.Id;
                                        }
                                        else
                                        {
                                            url += "?right=" + sub1.Id;
                                        }
                                        <a href="javascript:;" lay-href="@url" title="@sub1.Name" lay-tips="@sub1.Name" lay-direction="2">
                                            <i class="layui-icon layui-icon-component"></i>
                                            <cite>@sub1.Name</cite>
                                        </a>
                                    }
                                </li>
                            }
                        }
                        @if (SysUserName == "admin")
                        {
                        <li data-name="component" class="layui-nav-item">
                            <a href="javascript:;" lay-tips="开发" lay-direction="2">
                                <i class="layui-icon layui-icon-component"></i>
                                <cite>开发</cite>
                            </a>
                            <dl class="layui-nav-child">
                                <dd data-name="grid">
                                    <a lay-href="/Admin/SystemSet/Edit">站内设置</a>
                                </dd>
                                <dd data-name="grid">
                                    <a lay-href="/Admin/PublicAccountSet/Edit">第三方配置</a>
                                </dd>
                                <dd data-name="grid">
                                    <a lay-href="/Admin/SysTools/SeeSpLog">查看日志</a>
                                </dd>
                                <dd data-name="grid">
                                    <a lay-href="/Admin/SysTools/RelationForUser">关联上下级</a>
                                </dd>
                                <dd data-name="grid">
                                    <a lay-href="/Admin/SysTools/MakeCoupons">生成机具兑换码</a>
                                </dd>
                                <dd data-name="grid">
                                    <a lay-href="/Admin/SysTools/LisFee">立刷费率</a>
                                </dd>
                                <dd data-name="grid">
                                    <a lay-href="/Admin/SysTools/CheckMachine2">机具补录</a>
                                </dd>
                                <dd data-name="grid">
                                    <a href="javascript:;" title="每月表格">导出每月表格<span class="layui-nav-more"></span></a>
                                    <dl class="layui-nav-child">
                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/Profit" title="分润">分润</a></dd>
                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/Subsidy" title="补贴">补贴</a></dd>
                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/Trade?min=3000000&max=10000000" title="交易额300万-1000万名单">交易额300万-1000万名单</a></dd>
                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/Trade?min=10000000&max=10000000000" title="交易额满1000万名单">交易额满1000万名单</a></dd>
                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/OpenMachine" title="开机排行">开机排行</a></dd>
                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/PullNew" title="有效拉新排行">有效拉新排行</a></dd>
                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/Recommend" title="666推荐王">666推荐王</a></dd>
                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/Double" title="888翻倍奖">888翻倍奖</a></dd>
                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/StoreHouse" title="分仓数据">分仓数据</a></dd>
                                        <dd data-name="list"><a lay-href="/Admin/ExportTable/HelpProfit" title="助利宝分润">助利宝分润</a></dd>
                                    </dl>
                                </dd>
                            </dl>
                        </li>
                        }
                    </ul>
                </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="/Admin/Home/Main" lay-attr="/Admin/Home/Main" 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 src="/Admin/Home/Main" frameborder="0" class="layadmin-iframe"></iframe>
                </div>
            </div>

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

    <script src="/layuiadmin/layui/layui.js"></script>
    <script>
        //任务流程提醒弹窗
        function taskRing() {
            var index = layer.open({
                type: 1
                ,offset: 'rb'
                ,content: '<div style="padding: 20px 100px;">您有新的任务需要处理</div>'
                ,btn: ['去处理', '稍等']
                ,btnAlign: 'c' //按钮居中
                ,shade: 0 //不显示遮罩
                ,yes: function(){
                    layer.close(index);
                    document.getElementById("TaskFlowBtn").click();
                }
            });
        }

        var $;
        layui.config({
            base: '/layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form'], function () {
            $ = layui.$;
            var form = layui.form;
            form.on('select(SearchMenu)', function (data) {
                if(data.value && data.value != '') {
                    var data = data.value.split('#');
                    addTab(data[1], data[0]);
                }
            });
        });

        //添加选项卡
        function addTab(name, url) {
            layui.index.openTabsPage(url, name);
        }

        function showPwd() {
            layer.open({
                type: 2
                , title: '修改登录密码'
                , content: '/Admin/Home/LoginPassword'
                , maxmin: true
                , area: ['400px', '350px']
                , btn: ['确定', '取消']
                , yes: function (index, layero) {
                    var iframeWindow = window['layui-layer-iframe' + index]
                        , submitID = 'LAY-list-front-submit'
                        , submit = layero.find('iframe').contents().find('#' + submitID);

                    //监听提交
                    iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
                        var field = data.field; //获取提交的字段
                        var userdata = "";
                        for (var prop in field) {
                            userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
                        }
                        $.ajax({
                            type: "POST",
                            url: "/Admin/Home/LoginPasswordPost?r=" + Math.random(1),
                            data: userdata,
                            dataType: "text",
                            success: function (data) {
                                if (data == "success") {
                                    layer.msg("修改成功", { time: 2000 }, function () {
                                        layer.close(index); //关闭弹层
                                    });
                                } else {
                                    layer.msg(data);
                                }
                            }
                        });
                    });

                    submit.trigger('click');
                }
                , success: function (layero, index) {

                }
            });
        }

        function showInfo() {
            layer.open({
                type: 2
                , title: '个人资料'
                , content: '/Admin/Home/AdminInfo'
                , maxmin: true
                , area: ['400px', '350px']
                , btn: ['确定', '取消']
                , yes: function (index, layero) {
                    var iframeWindow = window['layui-layer-iframe' + index]
                        , submitID = 'LAY-list-front-submit'
                        , submit = layero.find('iframe').contents().find('#' + submitID);

                    //监听提交
                    iframeWindow.layui.form.on('submit(' + submitID + ')', function (data) {
                        var field = data.field; //获取提交的字段
                        console.log(field);
                        var userdata = "";
                        for (var prop in field) {
                            userdata += prop + "=" + encodeURIComponent(field[prop]) + "&";
                        }
                        $.ajax({
                            type: "POST",
                            url: "/Admin/Home/AdminInfoPost?r=" + Math.random(1),
                            data: userdata,
                            dataType: "text",
                            success: function (data) {
                                if (data == "success") {
                                    layer.msg("修改成功", { time: 2000 }, function () {
                                        layer.close(index); //关闭弹层
                                    });
                                } else {
                                    layer.msg(data);
                                }
                            }
                        });
                    });

                    submit.trigger('click');
                }
                , success: function (layero, index) {

                }
            });
        }

        function quit() {
            layer.confirm('确定要退出吗？', {
                btn: ['确定', '取消']
            }, function () {
                window.location.href = "/Admin/Home/Quit";
            });
        }</script>
</body>
</html>