mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-09-13 04:01:40 +08:00
后端:用户登录、退出登录、获取用户状态相关功能完成;引入SessionManager;数据库:user_identity改为group;前端:添加登录页面、后台管理页面框架,axios POST请求Content-Type问题修复,引入md5、sha1 js库;小问题调整
This commit is contained in:
43
bookshelfplus-frontend/views/admin/component/navbar.html
Normal file
43
bookshelfplus-frontend/views/admin/component/navbar.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<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>
|
||||
<div class="grid-item"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function logout() {
|
||||
getRequest("/user/logout", {})
|
||||
.then(function (response) {
|
||||
var axiosData = response.data;
|
||||
var status = axiosData.status;
|
||||
var data = axiosData.data;
|
||||
|
||||
if (status === "success") {
|
||||
console.log(data);
|
||||
if(data) {
|
||||
alert("退出登录成功");
|
||||
// window.location.href = "/";
|
||||
location.reload();
|
||||
} else {
|
||||
alert("退出登录失败");
|
||||
}
|
||||
} else {
|
||||
alert(`出错啦!${data.errMsg} (错误码: ${data.errCode}) `);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
alert("退出登录失败");
|
||||
});
|
||||
}
|
||||
</script>
|
Reference in New Issue
Block a user