• okadmin框架,第二天系统主页



    @{
    Layout = null;
    }
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>员工管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="员工管理系统">
    <meta name="description" content="员工管理系统">
    <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/css/okadmin.css">
    <link rel="stylesheet" href="/lib/loading/okLoading.css" />
    <script type="text/javascript" src="/js/polyfill.min.js"></script>
    <script type="text/javascript" src="/js/okconfig.js"></script>
    <script type="text/javascript" src="/lib/loading/okLoading.js"></script>
    </head>
    <body class="layui-layout-body">
    <!-- 更换主体 Eg:orange_theme|blue_theme -->
    <div class="layui-layout layui-layout-admin okadmin blue_theme">
    <!--头部导航-->
    <div class="layui-header okadmin-header">
    <ul class="layui-nav layui-layout-left">
    <li class="layui-nav-item">
    <a class="ok-menu ok-show-menu" href="javascript:" title="菜单切换">
    <i class="layui-icon layui-icon-shrink-right"></i>
    </a>
    </li>
    </ul>
    <ul class="layui-nav layui-layout-right">
    <li class="layui-nav-item">
    <a class="ok-refresh" href="javascript:" title="刷新">
    <i class="layui-icon layui-icon-refresh-3"></i>
    </a>
    </li>
    <li class="no-line layui-nav-item">
    <a href="javascript:">
    @*<img src="/images/avatar.png" class="layui-nav-img">*@
    @Session["Realname"].ToString()
    </a>
    <dl id="userInfo" class="layui-nav-child">
    @*/Home/Logout*@
    <dd><a href="/Home/Logout" id="logout">退出登录</a></dd>
    </dl>
    </li>
    </ul>
    </div>
    <!--遮罩层-->
    <div class="ok-make"></div>
    <!--左侧导航区域-->
    <div class="layui-side layui-side-menu okadmin-bg-20222A ok-left">
    <div class="layui-side-scroll okadmin-side">
    <div class="user-photo" style="display:none;">
    <a class="img" title="我的头像">
    <img src="/images/avatar.png" class="userAvatar">
    </a>
    <p>你好!<span class="userName">@Session["Realname"].ToString()</span>, 欢迎登录</p>
    </div>
    <!--左侧导航菜单-->

    <ul id="navBar" class="layui-nav okadmin-nav okadmin-bg-20222A layui-nav-tree">

    </ul>

    </div>
    </div>

    <!-- 内容主体区域 -->
    <div class="content-body">
    <div class="layui-tab ok-tab" lay-filter="ok-tab" lay-allowClose="true" lay-unauto>
    <div data-id="left" id="okLeftMove"
    class="ok-icon ok-icon-back okadmin-tabs-control move-left okNavMove"></div>
    <div data-id="right" id="okRightMove"
    class="ok-icon ok-icon-right okadmin-tabs-control move-right okNavMove"></div>
    <div class="layui-icon okadmin-tabs-control ok-right-nav-menu" style="right: 0;">
    <ul class="okadmin-tab">
    <li class="no-line okadmin-tab-item">
    <div class="okadmin-link layui-icon-down" href="javascript:;"></div>
    <dl id="tabAction" class="okadmin-tab-child layui-anim-upbit layui-anim">
    <dd><a data-num="1" href="javascript:">关闭当前标签页</a></dd>
    <dd><a data-num="2" href="javascript:">关闭其他标签页</a></dd>
    <dd><a data-num="3" href="javascript:">关闭所有标签页</a></dd>
    </dl>
    </li>
    </ul>
    </div>
    <ul id="tabTitle" class="layui-tab-title ok-tab-title not-scroll">
    <li class="layui-this" lay-id="1" tab="index">
    <i class="ok-icon">&#xe654;</i>
    <cite is-close=false>欢迎页</cite>
    </li>
    </ul>
    <div id="tabContent" class="layui-tab-content ok-tab-content">
    <div class="layui-tab-item layui-show">
    <iframe src="/Console/Index" frameborder="0" scrolling="yes" width="100%"
    height="100%"></iframe>
    </div>
    </div>
    </div>
    </div>
    <!--底部信息-->
    <div class="layui-footer okadmin-text-center">
    员工管理系统
    </div>
    </div>
    <!--js逻辑-->
    <script src="/lib/layui/layui.js"></script>
    <script src="/js/okadmin.js"></script>
    <script src="~/Scripts/jquery-3.4.1.js"></script>
    </body>
    </html>
    <script type="text/javascript">
    //页面加载请求角色的菜单权限
    $(document).ready(function () {
    $.ajax({
    url: '/Home/RoleMenu',
    type: 'get',
    dataType: 'json',
    success: function (data) {
    var strhtml = "";
    $.each(data, function (index, item) {
    if (item.pid == 0) {
    strhtml += "<li class=\"layui-nav-item layui\">";
    strhtml += "<a href=\"javascript:\" lay-id='" + item.id + "' data-url='" + item.url + "'>";
    strhtml+=item.name;
    strhtml+="</a>";
    strhtml += "</li>";
    }
    });
    $("#navBar").html(strhtml);

    }
    })

    });
    </script>

    后台代码:

    /// <summary>
    /// 角色菜单权限
    /// </summary>
    /// <returns></returns>
    public ActionResult RoleMenu()
    {

    //查询结果映射到实体类RoleMenu中;
    YuanGongDb dbcontext = new YuanGongDb();
    int RID =int.Parse(Session["RID"].ToString());//获取登录的角色ID
    var roleMenu = dbcontext.RoleInMenu.Where(o => o.Rid == RID).ToList();
    var Menu = dbcontext.SysMenu.Where(o => o.pid == 0).ToList();

    var menu1 = Menu.OrderBy(o=>o.sort).ToList();

    var data = roleMenu.Join(Menu, o => o.Mid, p => p.id, (o, p) =>
    new RoleMenu()
    {
    id = p.id,
    name = p.name,
    url = p.url,
    type = p.type,
    pid = p.pid
    }
    ).ToList();


    //var data = (from u in dbcontext.RoleInMenu
    // where u.Rid == RID
    // join p in dbcontext.SysMenu on u.Mid equals p.id
    // select new RoleMenu
    // { id = p.id, name = p.name, url = p.url, type = p.type, pid = p.pid }).ToList();
    return Json(data, JsonRequestBehavior.AllowGet);
    }

  • 相关阅读:
    AES加密
    Axis创建webservice客户端和服务端
    RandomAccessFile操作文件
    使用HttpClient实现文件的上传下载
    System.getProperty()方法可以获取的值
    C#面向对象 基础概念25个
    C#面向对象基础
    JQuery————基础&&基础选择器
    css3实现图片遮罩效果鼠标hover以后出现文字
    JAVASCRIPT——图片滑动效果
  • 原文地址:https://www.cnblogs.com/wugh8726254/p/16297050.html
Copyright © 2020-2023  润新知