登录页面适配移动端与桌面,增加Login-responsive.css文件

This commit is contained in:
Argo-Lenovo 2017-03-26 15:09:05 +08:00
parent 75ff6863db
commit a149da26c8
10 changed files with 85 additions and 62 deletions

View File

@ -114,6 +114,9 @@
<Content Include="Content\fileinput.css" />
<Content Include="Content\fileinput.min.css" />
<Content Include="Content\IE8.css" />
<Content Include="Content\images\bg2.jpg" />
<Content Include="Content\images\bg3.png" />
<Content Include="Content\login-responsive.css" />
<Content Include="Content\nprogress.css" />
<Content Include="Content\font-awesome.css" />
<Content Include="Content\font-awesome.min.css" />
@ -147,7 +150,6 @@
<Content Include="Content\images\uploader\default.jpg" />
<Content Include="Content\images\uploader\readme.txt" />
<Content Include="Content\site-responsive.css" />
<Content Include="Content\images\avatar1_small.jpg" />
<Content Include="Content\images\error.png" />
<Content Include="Content\images\nav-expand.png" />
<Content Include="Content\site.css" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -0,0 +1,38 @@
@media (min-width: 375px) {
.form-signin {
width: 320px;
}
}
@media (min-width: 768px) {
body {
background: url('images/bg2.jpg') fixed repeat;
}
.container {
background: url('images/bg3.png') no-repeat;
background-size: contain;
width: 704px;
height: 404px;
margin: 0 auto;
}
.form-signin {
border: none;
background: none;
width: auto;
}
.form-signin .form-signin-heading {
background: none;
margin-top: 10px;
}
.form-signin .input-group {
border: solid 1px #286090;
}
.login-wrap {
margin: 30px 0 0 370px;
}
}

View File

@ -1,68 +1,65 @@
body {
color: #797979;
background: #f1f2f7;
font-family: 'Open Sans', sans-serif;
font-size: 13px;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
}
/*Login*/
.form-signin {
.form-signin {
margin: 0 auto;
background: #fff;
border-radius: 5px;
-webkit-border-radius: 5px;
border: solid 1px #ddd;
}
.form-signin h2.form-signin-heading {
.form-signin .form-signin-heading {
margin: 0;
padding: 20px 15px;
padding: 15px;
text-align: center;
background: #41cac0;
border-radius: 5px 5px 0 0;
-webkit-border-radius: 5px 5px 0 0;
color: #fff;
font-size: 18px;
font-size: 34px;
text-transform: uppercase;
font-weight: 300;
font-family: 'Open Sans', sans-serif;
}
.form-signin div.login-wrap {
.form-signin .login-wrap {
padding: 20px;
}
.form-signin div.login-wrap .login-footer {
.form-signin .login-wrap .login-footer {
padding-bottom: 15px;
}
.form-signin div.login-wrap .login-footer .login-create {
.form-signin .login-wrap .login-footer .login-create {
float: left;
}
.form-signin div.login-wrap .login-footer .login-reset {
.form-signin .login-wrap .login-footer .login-reset {
float: right;
}
.form-signin div.input-group {
.form-signin .input-group {
margin-bottom: 15px;
border-radius: 5px;
-webkit-border-radius: 5px;
border: 1px solid #eaeaea;
border: 1px solid #089dc9;
box-shadow: none;
font-size: 12px;
}
.form-signin div.input-group > span {
.form-signin .input-group > span {
top: 0;
background-color: #5bc0de;
}
.form-signin div.input-group > span, div.input-group > input {
border-color: #5bc0de;
.form-signin .form-control, .form-signin .input-group span {
border: none;
}
.form-signin .has-success .input-group {
border: solid 1px #3c763d;
}
.form-signin .has-error .input-group {
border: solid 1px #a94442;
}
.form-signin .form-control, .form-signin .form-control:focus {
box-shadow: none;
}
.form-signin .btn-login {
@ -86,12 +83,5 @@
.form-signin .checkbox > label {
padding-left: 4px;
}
/*end login*/
@media (min-width: 375px) {
.form-signin {
width: 320px;
}
color: #333;
}

View File

@ -45,27 +45,15 @@ namespace Bootstrap.Admin.Controllers
/// <param name="remember"></param>
/// <returns></returns>
[AllowAnonymous]
public ActionResult Login(string userName, string password, string remember)
{
var model = new LoginModel();
if (string.IsNullOrEmpty(userName)) return View(model);
model.UserName = userName;
if (LgbPrincipal.Authenticate(userName, password) || BootstrapUser.Authenticate(userName, password))
{
FormsAuthentication.RedirectFromLoginPage(userName, remember == "true");
return new EmptyResult();
}
return View(model);
}
/// <summary>
///
/// </summary>
/// <returns></returns>
[AllowAnonymous]
public ActionResult Logout()
public ActionResult Login(LoginModel login)
{
FormsAuthentication.SignOut();
return Redirect(FormsAuthentication.LoginUrl);
if (!string.IsNullOrEmpty(login.UserName) && (LgbPrincipal.Authenticate(login.UserName, login.Password) || BootstrapUser.Authenticate(login.UserName, login.Password)))
{
FormsAuthentication.RedirectFromLoginPage(login.UserName, login.Remember == "true");
return new EmptyResult();
}
return View(login);
}
/// <summary>
///

View File

@ -3,7 +3,7 @@
/// <summary>
///
/// </summary>
public class LoginModel
public class LoginModel : ModelBase
{
/// <summary>
///
@ -20,5 +20,9 @@
///
/// </summary>
public string Password { get; set; }
/// <summary>
///
/// </summary>
public string Remember { get; set; }
}
}

View File

@ -1,10 +1,11 @@
@model LoginModel
@{
ViewBag.Title = "系统登陆";
ViewBag.Title = Model.Title;
Layout = "~/Views/Shared/_Layout.cshtml";
}
@section css {
<link href="~/Content/login.css" rel="stylesheet" />
<link href="~/Content/login-responsive.css" rel="stylesheet" />
}
@section javascript {
<script src="~/Scripts/jquery.validate.js"></script>
@ -13,7 +14,7 @@
}
<div class="container">
<form id="login" class="form-signin" method="post">
<h2 class="form-signin-heading">欢迎登陆本系统</h2>
<h2 class="form-signin-heading">@Model.Title</h2>
<div class="login-wrap">
<div class="form-group">
<div class="input-group">
@ -28,11 +29,11 @@
</div>
</div>
<div class="checkbox">
<input id="remember" name="remember" type="checkbox" value="true" /><label for="remember">记住我</label>
<input id="remember" name="remember" type="checkbox" checked value="true" /><label for="remember">记住我</label>
</div>
<button class="btn btn-lg btn-login btn-block" type="submit">登 陆</button>
<div class="login-footer">
<div class="login-create"><a href="Register">创建一个新账号</a></div>
<div class="login-create"><a href="Register">申请注册</a></div>
<div class="login-reset"><a href="#">忘记密码</a></div>
</div>
</div>

View File

@ -105,7 +105,7 @@
<li><a href="~/Admin/Profiles"><i class=" fa fa-suitcase"></i>个人中心</a></li>
<li><a href="~/Admin/Index"><i class="fa fa-cog"></i>设置</a></li>
<li><a href="~/Admin/Notifications"><i class="fa fa-bell"></i>通知<span id="logoutNoti" class="badge"></span></a></li>
<li><a href="~/Home/Logout"><i class="fa fa-key"></i>注销</a></li>
<li><a href="~/Home/Login"><i class="fa fa-key"></i>注销</a></li>
</ul>
</div>
<ul class="breadcrumb">