FalconSSO/FAuth/Views/Shared/_Layout.cshtml

120 lines
4.9 KiB
Plaintext
Raw Normal View History

@using Microsoft.Extensions.Options
@inject IOptions<CookieKeyDefine> CKD
<!DOCTYPE html>
2020-03-30 10:12:52 +08:00
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - FAuth</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
2020-05-09 11:44:07 +08:00
<a class="navbar-brand" asp-controller="Home" asp-action="Index">FAuth统一认证登录平台SSO</a>
2020-03-30 10:12:52 +08:00
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
2020-05-09 11:44:07 +08:00
<a class="nav-link text-dark" fajax-updata="main" asp-controller="App" asp-action="Index">应用管理</a>
2020-03-30 10:12:52 +08:00
</li>
<li class="nav-item">
2020-05-09 11:44:07 +08:00
<a class="nav-link text-dark" fajax-updata="main" asp-controller="RoleGroup" asp-action="Index">角色组管理</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" fajax-updata="main" asp-controller="Role" asp-action="Index">角色管理</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" fajax-updata="main" asp-controller="User" asp-action="Index">用户管理</a>
2020-03-30 10:12:52 +08:00
</li>
<li class="nav-item">
<a class="nav-link text-dark" target="_blank" href="/api">接口文档</a>
</li>
2020-03-30 10:12:52 +08:00
</ul>
</div>
<div id="userBar">
<div id="login">
<a asp-controller="user" asp-action="login" fajax-updata="main">登录</a>
</div>
<div id="logout">
<span>欢迎: <span id="userName"></span></span>
<a asp-controller="user" asp-action="ResetPassword" fajax-updata="main">修改密码</a>
<a href="#" id="logOut">退出</a>
</div>
</div>
2020-03-30 10:12:52 +08:00
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="border-top footer text-muted">
<div class="container">
2020-05-09 11:44:07 +08:00
&copy; 2020 - FAuth - <a target="_blank" href="http://39.105.71.191/Falcon/FalconSSO/issues">技术支持</a>
2020-03-30 10:12:52 +08:00
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/vue/vue.min.js"></script>
<script src="~/lib/jquery.cookie/jquery.cookie-1.4.1.min.js"></script>
2020-05-08 20:00:38 +08:00
<script src="~/lib/jquery.unobtrusive-ajax/jquery.unobtrusive-ajax.min.js"></script>
2020-03-30 10:12:52 +08:00
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
<script type="text/javascript">
//设置用户key
myJs.userKey = "@CKD.Value.UserKey";
//刷新用户条
function RefreshUserBar() {
var ticket =myJs.getTicket();
if (!ticket) {
$("#logout").hide();
$("#login").show();
}
if (ticket) {
var url = "/api/User/GetUserByTicket";
var data = { ticket: ticket };
myJs.get(url, data, function (d) {
$("#userName").html(d.Name);
$("#logout").show();
$("#login").hide();
}, function (c,i,m) {
$("#logout").hide();
$("#login").show();
myJs.msg(m);
myJs.removeTicket();
});
}
}
function logOut() {
var ticket = myJs.getTicket();
var url = "/api/User/Logout";
var data = { ticket: ticket };
myJs.post(url, data, function (d) {
myJs.removeTicket(ticket);
RefreshUserBar();
}, function (s,i,m) {
myJs.msg(m);
});
}
$(function () {
RefreshUserBar();
$("#logOut").click(function () {
logOut();
return false;
});
});
</script>
2020-05-09 11:44:07 +08:00
@RenderSection("Scripts",required: false)
2020-03-30 10:12:52 +08:00
</body>
</html>