ABP+AdminLTE+Bootstrap Table权限管理系统第九节--AdminLTE模板页搭建

返回总目录:ABP+AdminLTE+Bootstrap Table权限管理系统一期

AdminLTE

AdminLTE 官网地址:https://adminlte.io/themes/AdminLTE/index2.html

首先去官网下载包下来,然后引入项目.

然后我们在web层添加区域Admin以及Common,关于AdminLTE的地址我们放在Common路劲下面.

在Common下添加LayoutController控制器.

ABP+AdminLTE+Bootstrap Table权限管理系统第九节--AdminLTE模板页搭建

Layout

这里菜单我们先不管,在后面的章节我在加上,首先是_Layout页代码:

 @{
Layout = null;
} @using System.Web.Optimization
@{
List<JCmsErp.Menu.Menus> sidebarMenuDataList = ViewBag.SidebarMenuModel;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>AdminLTE | Dashboard</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script src="~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/jQuery/jQuery-2.1.4.min.js"></script> <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport' />
<!-- Bootstrap 3.3. -->
<script src="~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/bootstrap/js/bootstrap.js"></script>
<link href="~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/bootstrap/css/bootstrap.css" rel="stylesheet" />
<!-- FontAwesome 4.3. -->
<!-- Ionicons 2.0. -->
<link href="~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/dist/css/ionicons.min.css" rel="stylesheet" type="text/css" />
<!-- Theme style -->
<link href="~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" />
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link href="~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css" />
<!-- iCheck -->
<link href="~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/iCheck/flat/blue.css" rel="stylesheet" type="text/css" />
<!-- Morris chart -->
<link href="~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/morris/morris.css" rel="stylesheet" type="text/css" />
<!-- jvectormap -->
<link href="~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/jvectormap/jquery-jvectormap-1.2.2.css" rel="stylesheet" type="text/css" />
<!-- Date Picker -->
<link href="~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/datepicker/datepicker3.css" rel="stylesheet" type="text/css" />
<!-- Daterange picker -->
<link href="~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<!-- bootstrap wysihtml5 - text editor -->
<link href="~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css" /> <!-- ./wrapper -->
<!-- REQUIRED JS SCRIPTS -->
<!-- jQuery 2.2. --> <style type="text/css">
body {
font-family: verdana,helvetica,arial,sans-serif;
padding: !important;
margin: ;
} .content {
min-height:700px; height:auto!important;
}
</style> </head> <body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
@Html.Action("_MainHeader", "Layout", new { area = "Common" })
@Html.Action("_LeftSideMenus", "Layout", new { area = "Common" }) <div class="content-wrapper">
@RenderBody()
</div>
@Html.Action("_MainFooter", "Layout", new { area = "Common" })
<div class="control-sidebar-bg"></div>
</div>
</body>
</html>

这里总的模板页.以后在其他地方引用的话就引用这个页面.

头部页面

接下来是头部页面:

 @{
Layout = null;
} <header class="main-header">
<!-- Logo -->
<a href="@Url.Action("Index", "Home", new { area="Common"})" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>RMS</b></span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>WY</b>RMS</span>
</a>
<!-- Header Navbar -->
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle navigation</span>
</a>
<!-- Navbar Right Menu -->
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- Messages: style can be found in dropdown.less-->
<li class="dropdown messages-menu">
<!-- Menu toggle button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
<span class="label label-success"></span>
</a>
<ul class="dropdown-menu">
<li class="header">You have messages</li>
<li>
<!-- inner menu: contains the messages -->
<ul class="menu">
<li>
<!-- start message -->
<a href="#">
<div class="pull-left">
<!-- User Image -->
<img src="@Url.Content("/Scripts/AdminLTE-2.1./AdminLTE-2.1./dist/img/avatar04.png")" class="img-circle" alt="User Image">
</div>
<!-- Message title and timestamp -->
<h4>
Support Team
<small><i class="fa fa-clock-o"></i> mins</small>
</h4>
<!-- The message -->
<p>Why not buy a new awesome theme?</p>
</a>
</li><!-- end message -->
</ul><!-- /.menu -->
</li>
<li class="footer"><a href="#">See All Messages</a></li>
</ul>
</li><!-- /.messages-menu -->
<!-- Notifications Menu -->
<li class="dropdown notifications-menu">
<!-- Menu toggle button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span class="label label-warning"></span>
</a>
<ul class="dropdown-menu">
<li class="header">You have notifications</li>
<li>
<!-- Inner Menu: contains the notifications -->
<ul class="menu">
<li>
<!-- start notification -->
<a href="#">
<i class="fa fa-users text-aqua"></i> new members joined today
</a>
</li><!-- end notification -->
</ul>
</li>
<li class="footer"><a href="#">View all</a></li>
</ul>
</li>
<!-- Tasks Menu -->
<li class="dropdown tasks-menu">
<!-- Menu Toggle Button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-flag-o"></i>
<span class="label label-danger"></span>
</a>
<ul class="dropdown-menu">
<li class="header">You have tasks</li>
<li>
<!-- Inner menu: contains the tasks -->
<ul class="menu">
<li>
<!-- Task item -->
<a href="#">
<!-- Task title and progress text -->
<h3>
Design some buttons
<small class="pull-right">%</small>
</h3>
<!-- The progress bar -->
<div class="progress xs">
<!-- Change the css width attribute to simulate progress -->
<div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="" aria-valuemin="" aria-valuemax="">
<span class="sr-only">% Complete</span>
</div>
</div>
</a>
</li><!-- end task item -->
</ul>
</li>
<li class="footer">
<a href="#">View all tasks</a>
</li>
</ul>
</li>
<!-- User Account Menu -->
<li class="dropdown user user-menu">
<!-- Menu Toggle Button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<!-- The user image in the navbar-->
<img src="@Url.Content("/Scripts/AdminLTE-2.1./AdminLTE-2.1./dist/img/avatar04.png")" class="user-image" alt="User Image">
<!-- hidden-xs hides the username on small devices so only the image appears. -->
<span class="hidden-xs">管理员</span>
</a>
<ul class="dropdown-menu">
<!-- The user image in the menu -->
<li class="user-header">
<img src="@Url.Content("/Scripts/AdminLTE-2.1./AdminLTE-2.1./dist/img/avatar04.png")" class="img-circle" alt="User Image">
<p>
管理员 - Web Developer
<small>Member since 2015.8.</small>
</p>
</li>
<!-- Menu Body -->
<li class="user-body">
<div class="col-xs-4 text-center">
<a href="#">Followers</a>
</div>
<div class="col-xs-4 text-center">
<a href="#">Sales</a>
</div>
<div class="col-xs-4 text-center">
<a href="#">Friends</a>
</div>
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
<a href="#" class="btn btn-default btn-flat">个人信息</a>
</div>
<div class="pull-right">
<a href="@Url.Action("Logout", "Login", new { Area="Common"})" class="btn btn-default btn-flat">退出</a>
</div>
</li>
</ul>
</li> </ul>
</div>
</nav>
</header>

头部是要是导航栏里面的东西包括用户退出功能也在这里.

菜单

接下来是菜单,菜单我还没有设计数据库,会在接下来的章节说明.先写死:

 @model JCmsErp.Web.Areas.Common.Models.MeunViewModel
@{
Layout = null;
} <aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel (optional) -->
<div class="user-panel">
<div class="pull-left image">
<img src="~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/dist/img/user2-160x160.jpg" class="img-circle" alt="User Image">
</div>
<div class="pull-left info">
<p>Alexander Pierce</p>
<!-- Status -->
<a href="#"><i class="fa fa-circle text-success"></i> Online</a>
</div>
</div>
<!-- search form (Optional) -->
<form action="#" method="get" class="sidebar-form">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<button type="submit" name="search" id="search-btn" class="btn btn-flat">
<i class="fa fa-search"></i>
</button>
</span>
</div>
</form>
<!-- /.search form -->
<!-- Sidebar Menu -->
<ul class="sidebar-menu">
<li class="header">HEADER</li>
<!-- Optionally, you can add icons to the links -->
<li class="active"><a href="/User/Index"><i class="fa fa-link"></i><i class="fa fa-windows"></i> <span>用户管理</span></a></li>
<li><a href="/WorkFlow/Index"><i class="fa fa-link"></i><i class="fa fa-windows"></i> <span>职位管理</span></a></li>
<li><a href="/Member/Role/Index"><i class="fa fa-link"></i><i class="fa fa-windows"></i> <span>角色管理</span></a></li>
<li class="active"><a href="/Home/Userinfo"><i class="fa fa-windows"></i> <span>用户详情</span></a></li>
<li class="active"><a href="/Home/UsersList"><i class="fa fa-windows"></i> <span>角色管理</span></a></li>
<li class="active"><a href="/Home/AbpLanguages"><i class="fa fa-windows"></i> <span>会员管理</span></a></li>
<li><a href="/Home/ReadMail"><i class="fa fa-link"></i> <span>邮件管理</span></a></li>
<li><a href="/Home/UserProfile"><i class="fa fa-link"></i> <span>语言管理</span></a></li>
<li><a href="/Home/ChartJS"><i class="fa fa-link"></i> <span>Chart管理</span></a></li>
<li class="treeview">
<a href="/Home/ChartJS">
<i class="fa fa-link"></i> <span>菜单管理</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
</a>
<ul class="treeview-menu">
<li><a href="/Home/ChartJS">Link in level </a></li>
<li><a href="/Home/ChartJS">Link in level </a></li>
</ul>
</li>
</ul>
<!-- /.sidebar-menu -->
</section>
<!-- /.sidebar -->
</aside>

Foot

最后是Foot:

 @{
Layout = null;
} <footer class="main-footer">
<!-- To the right -->
<div class="pull-right hidden-xs">
Anything you want
</div>
<!-- Default to the left -->
<strong>Copyright &copy; <a href="#">Company</a>.</strong> All rights reserved.
</footer>
<aside class="control-sidebar control-sidebar-dark">
<!-- Create the tabs -->
<ul class="nav nav-tabs nav-justified control-sidebar-tabs">
<li class="active"><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li>
<li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<!-- Home tab content -->
<div class="tab-pane active" id="control-sidebar-home-tab">
<h3 class="control-sidebar-heading">Recent Activity</h3>
<ul class="control-sidebar-menu">
<li>
<a href="javascript:;">
<i class="menu-icon fa fa-birthday-cake bg-red"></i>
<div class="menu-info">
<h4 class="control-sidebar-subheading">Langdon's Birthday</h4>
<p>Will be on April 24th</p>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->
<h3 class="control-sidebar-heading">Tasks Progress</h3>
<ul class="control-sidebar-menu">
<li>
<a href="javascript:;">
<h4 class="control-sidebar-subheading">
Custom Template Design
<span class="pull-right-container">
<span class="label label-danger pull-right">%</span>
</span>
</h4>
<div class="progress progress-xxs">
<div class="progress-bar progress-bar-danger" style="width: 70%"></div>
</div>
</a>
</li>
</ul>
<!-- /.control-sidebar-menu -->
</div>
<!-- /.tab-pane -->
<!-- Stats tab content -->
<div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div>
<!-- /.tab-pane -->
<!-- Settings tab content -->
<div class="tab-pane" id="control-sidebar-settings-tab">
<form method="post">
<h3 class="control-sidebar-heading">General Settings</h3>
<div class="form-group">
<label class="control-sidebar-subheading">
Report panel usage
<input type="checkbox" class="pull-right" checked>
</label>
<p>
Some information about this general settings option
</p>
</div>
<!-- /.form-group -->
</form>
</div>
<!-- /.tab-pane -->
</div>
</aside>

效果

就这样我们的模板页就做好了,看效果.

ABP+AdminLTE+Bootstrap Table权限管理系统第九节--AdminLTE模板页搭建

扩展

需要说明一下的是,需要引入bootstrap包和jquery js.至此模板页诞生.

有人说在_Layout页面东西很多js和css过多,我们需要给他减负,这里首先当然想到的是@Styles.Render()和 @Scripts.Render()了, @Scripts.Render是mvc通用,abp继承mvc自然是支持的.

在页面上可以用@Styles.Render("~/Content/css") 来加载css,首先要在App_Start 里面BundleConfig.cs 文件里面 添加要包含的css文件,BundleConfig就是一个微软新加的 一个打包的配置类,用来Add 各种Bundle.

然后再向ScriptBundle添加js,同时引用到模板页上来.看下代码

 using System.Web.Optimization;

 namespace JCmsErp.Web
{
public static class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.IgnoreList.Clear(); //VENDOR RESOURCES //~/Bundles/App/vendor/css
bundles.Add(
new StyleBundle("~/Bundles/App/vendor/css")
.Include("~/Content/themes/base/all.css", new CssRewriteUrlTransform())
.Include("~/Content/bootstrap-cosmo.min.css", new CssRewriteUrlTransform())
.Include("~/Content/toastr.min.css")
.Include("~/Scripts/sweetalert/sweet-alert.css")
.Include("~/Content/flags/famfamfam-flags.css", new CssRewriteUrlTransform())
.Include("~/Content/font-awesome.min.css", new CssRewriteUrlTransform())
.Include("~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/bootstrap/css/bootstrap.css")
.Include("~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/dist/css/ionicons.min.css")
.Include("~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/dist/css/AdminLTE.min.css")
.Include("~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/dist/css/skins/_all-skins.min.css")
.Include("~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/iCheck/flat/blue.css")
.Include("~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/morris/morris.css")
.Include("~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/jvectormap/jquery-jvectormap-1.2.2.css")
.Include("~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/datepicker/datepicker3.css")
.Include("~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/daterangepicker/daterangepicker-bs3.css")
.Include("~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css") ); //~/Bundles/App/vendor/js
bundles.Add(
new ScriptBundle("~/Bundles/App/vendor/js")
.Include(
"~/Abp/Framework/scripts/utils/ie10fix.js",
"~/Scripts/json2.min.js", "~/Scripts/modernizr-2.8.3.js", "~/Scripts/jquery-2.1.4.min.js",
"~/Scripts/jquery-ui-1.11.4.min.js", "~/Scripts/bootstrap.min.js", "~/Scripts/moment-with-locales.min.js",
"~/Scripts/jquery.blockUI.js",
"~/Scripts/toastr.min.js",
"~/Scripts/sweetalert/sweet-alert.min.js",
"~/Scripts/others/spinjs/spin.js",
"~/Scripts/others/spinjs/jquery.spin.js", "~/Scripts/angular.min.js",
"~/Scripts/angular-animate.min.js",
"~/Scripts/angular-sanitize.min.js",
"~/Scripts/angular-ui-router.min.js",
"~/Scripts/angular-ui/ui-bootstrap.min.js",
"~/Scripts/angular-ui/ui-bootstrap-tpls.min.js",
"~/Scripts/angular-ui/ui-utils.min.js", "~/Abp/Framework/scripts/abp.js",
"~/Abp/Framework/scripts/libs/abp.jquery.js",
"~/Abp/Framework/scripts/libs/abp.toastr.js",
"~/Abp/Framework/scripts/libs/abp.blockUI.js",
"~/Abp/Framework/scripts/libs/abp.spin.js",
"~/Abp/Framework/scripts/libs/abp.sweet-alert.js",
"~/Abp/Framework/scripts/libs/abp.moment.js",
"~/Abp/Framework/scripts/libs/angularjs/abp.ng.js",
"~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/bootstrap/js/bootstrap.js",
"~/Scripts/AdminLTE-2.1.1/AdminLTE-2.1.1/plugins/jQuery/jQuery-2.1.4.min.js",
"~/Scripts/AdminLTE-2.3.11/AdminLTE-2.3.11/dist/js/app.min.js"
)
); //APPLICATION RESOURCES //~/Bundles/App/Main/css
bundles.Add(
new StyleBundle("~/Bundles/App/Main/css")
.IncludeDirectory("~/App/Main", "*.css", true)
); //~/Bundles/App/Main/js
bundles.Add(
new ScriptBundle("~/Bundles/App/Main/js")
.IncludeDirectory("~/App/Main", "*.js", true)
);
}
}
}
 @{
Layout = null;
} @using System.Web.Optimization
@{
List<JCmsErp.Menu.Menus> sidebarMenuDataList = ViewBag.SidebarMenuModel;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>AdminLTE | Dashboard</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport' /> @Styles.Render("~/Bundles/App/vendor/css")
<style type="text/css">
body {
font-family: verdana,helvetica,arial,sans-serif;
padding: !important;
margin: ;
}
.content {
min-height:700px; height:auto!important;
}
</style>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
@Html.Action("_MainHeader", "Layout", new { area = "Common" })
@Html.Action("_LeftSideMenus", "Layout", new { area = "Common" })
<div class="content-wrapper">
@RenderBody()
</div>
@Html.Action("_MainFooter", "Layout", new { area = "Common" })
<div class="control-sidebar-bg"></div>
</div>
@Scripts.Render("~/Bundles/App/vendor/js") </body>
</html>

就这样模板页,看上去简洁了很多.至此,模板页.

返回总目录:ABP+AdminLTE+Bootstrap Table权限管理系统一期

上一篇:Winedt打开tex文件报错error reading的解决方案


下一篇:【liunx】使用xshell连接虚拟机上的CentOS 7,使用xhell连接本地虚拟机上的Ubuntu, 获取本地虚拟机中CentOS 7的IP地址,获取本地虚拟机中Ubuntu 的IP地址,Ubuntu开启22端口