mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-09-21 01:10:39 +08:00
管理员和用户后台框架完成;用户登录功能完成
This commit is contained in:
19
bookshelfplus-frontend/views/dashboard/admin/manage.html
Normal file
19
bookshelfplus-frontend/views/dashboard/admin/manage.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<%- include("../component/header.html"); %>
|
||||
<%- include("../component/header-admin.html"); %>
|
||||
</head>
|
||||
<body>
|
||||
<%- include("../component/navbar.html"); %>
|
||||
<main class="main">
|
||||
<h1><%= title %></h1>
|
||||
<div id="container">
|
||||
<div>
|
||||
<%= typeof title !=='undefined' ? page : "出错啦"; %>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<%- include("../component/footer-admin.html"); %>
|
||||
</body>
|
||||
</html>
|
@@ -25,7 +25,7 @@
|
||||
window.location.href = "/";
|
||||
}
|
||||
|
||||
getRequest("/user/getUserStatus", { token: localStorage.getItem("token") })
|
||||
postRequest("/user/getUserStatus", { token: localStorage.getItem("token") })
|
||||
.then(function (responseData) {
|
||||
var axiosData = responseData.data;
|
||||
var status = axiosData.status;
|
||||
|
@@ -1,22 +1,24 @@
|
||||
<div class="navbar">
|
||||
<div class="navbar-grid">
|
||||
<div class="grid-item"></div>
|
||||
<div class="grid-item">
|
||||
<nobr>
|
||||
<h1 onclick="location.href='/'" style="cursor: pointer;">书栖网</h1>
|
||||
</nobr>
|
||||
</div>
|
||||
<div class="grid-item exnarrowHide" style="text-align: right; color: white;">
|
||||
<a href="/">首页</a>
|
||||
<a href="/admin/manage">管理</a>
|
||||
<a style="color: grey;" href="javascript:logout();">退出登录</a>
|
||||
<div class="grid-item" style="grid-column-start: span 2;">
|
||||
<h1 style="display: inline; vertical-align: middle; margin-right: 20px; cursor: pointer;"
|
||||
onclick="location.href='/';">
|
||||
书栖网
|
||||
</h1>
|
||||
<% links.forEach(item=> { %>
|
||||
<a href="<%= item.url %>" style="vertical-align: middle;">
|
||||
<%= item.name %>
|
||||
</a>
|
||||
<% }); %>
|
||||
<a href="javascript:logout();" style="color: grey; vertical-align: middle; float: right;">退出登录</a>
|
||||
</div>
|
||||
<div class="grid-item"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function logout() {
|
||||
getRequest("/user/logout", { token: localStorage.getItem("token") })
|
||||
postRequest("/user/logout", { token: localStorage.getItem("token") })
|
||||
.then(function (response) {
|
||||
var axiosData = response.data;
|
||||
var status = axiosData.status;
|
||||
@@ -24,12 +26,10 @@
|
||||
|
||||
if (status === "success") {
|
||||
console.log(data);
|
||||
if(data) {
|
||||
if (data) {
|
||||
localStorage.clear("token");
|
||||
localStorage.clear("is_admin");
|
||||
// alert("退出登录成功");
|
||||
// window.location.href = "/";
|
||||
location.reload();
|
||||
location.href = "/login";
|
||||
} else {
|
||||
alert("退出登录失败");
|
||||
}
|
||||
|
19
bookshelfplus-frontend/views/dashboard/user/manage.html
Normal file
19
bookshelfplus-frontend/views/dashboard/user/manage.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<%- include("../component/header.html"); %>
|
||||
<%- include("../component/header-user.html"); %>
|
||||
</head>
|
||||
<body>
|
||||
<%- include("../component/navbar.html"); %>
|
||||
<main class="main">
|
||||
<h1><%= title %></h1>
|
||||
<div id="container">
|
||||
<div>
|
||||
<%= typeof title !=='undefined' ? page : "出错啦"; %>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<%- include("../component/footer-user.html"); %>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user