c-router-emulator/www/index.html

111 lines
2.5 KiB
HTML
Raw Normal View History

2023-09-20 16:00:14 +08:00
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="zifan">
<meta name="keywords" content="物联网">
<title>主页</title>
<style>
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
body {
display: flex;
flex-direction: column;
justify-content: space-between;
}
#top {
height: 50px;
background-color: lightblue;
}
#foot {
height: 40px;
background-color: lightblue;
}
#main {
height: 100%;
display: flex;
flex-direction: row;
background-color: lightcyan;
}
#top {
display: flex;
flex-direction: row;
justify-content: space-between;
justify-items: center;
align-items: center;
padding: 5px;
border-bottom: 1px solid lightgray;
}
#logo>img {
width: 180px;
height: 45px;
}
#foot {
border-top: 1px solid lightgray;
padding: 10px 0;
}
#menu {
width: 300px;
border-right: 1px solid lightgray;
padding: 20px;
}
iframe {
outline: none;
border: none;
}
</style>
</head>
<body>
<div id="top">
<div id="logo">
<img src="/logo.png">
</div>
<div id="user_info"><span id="userName"></span>
<span class="logout" onclick="logout()">[登出]</span>
</div>
</div>
</div>
<div id="main">
<div id="menu">
<h3>路由配置</h3>
</div>
<div id="content" style="width: 100%;">
<iframe name="content_frame" width="100%" height="100%"></iframe>
</div>
</div>
<div id="foot" style="text-align: center;">
<b>版本所有@FLY-NOOB</b>
</div>
<script>
window.onload = function () {
if (localStorage.getItem("login_user") == null) {
open("/login.html", "_self");
} else {
let login_user_str = localStorage.getItem("login_user");
let login_user = JSON.parse(login_user_str);
userName.innerText = login_user.nickname;
}
}
function logout() {
localStorage.clear();
open("/login.html", "_self");
}
</script>
</body>
</html>