html
<body style="position: relative;">
<div class="load" style="position: absolute;display: none;">
<div class="box">
<span class="iconfont icon-jiazai"></span>
<p>login...</p>
</div>
</div>
<div class="header cleafix">
<div class="title">
<span></span>
<p>欢迎使用鼎鑫出租房管理平台</p>
</div>
<nav>
<ul>
<li>回首页</li>
<li>帮助</li>
<li>关于</li>
</ul>
</nav>
</div>
<main>
<div class="box">
<div class="top">
<span></span>
</div>
<div class="bttom">
<div class="left">
<div class="login-box" style="display: none;">
<h3>已有账号?</h3>
<p>有账号就登录吧,好久不见</p>
<button>登录</button>
</div>
<div class="enter-box">
<h3>还未注册?</h3>
<p>立即注册发现大机会</p>
<button>注册</button>
</div>
</div>
<div class="form-box">
<!-- 登录的from隐藏起来 -->
<div class="form-login">
<h1>用户登录</h1>
<p>UserLogin</p>
<div>
<div class="input-box"><span class="iconfont icon-yonghu"></span>
<input type="text" name="name">
</div>
<p class="nameError" style="width: 350px;">账号不能为空</p>
<div class="input-box"><span class="iconfont icon-mima"></span>
<input type="password" name="paw" id="paw">
</div>
<p class="pawError">密码不能为空</p>
<button onclick="login()">登录</button>
<p>忘记密码?</p>
</div>
</div>
<div class="from-enter" style="display: none;">
<h1>用户注册</h1>
<p>UserEnter</p>
<div class="box">
<div class="input-box">
<span class="iconfont icon-yonghu"
style=" width: 50px;font-size: 24px;color: #e0622c;"></span>
<input type="text" name="name">
</div>
<div class="input-box">
<span class="iconfont icon-mima"
style=" width: 50px;font-size: 24px;color: #e0622c;"></span>
<input type="text" name="paw">
</div>
<div class="input-box All">
<span class="bumen">
部门:
<select name="selectList">
</select>
</span>
<span class="js">角色:
<select name="selectList">
</select></span>
</div>
<p id="ts" style="display: none;">账号是4 - 8个字母数字组成,字母开头</p>
<p class="error" style="display: none;">密码或账号错误</p>
<button onclick="onEnter()">注册</button>
</div>
</div>
</div>
</div>
</div>
</main>
</body>
cs
body {
position: relative;
margin: 0;
padding: 0;
width: 100%;
min-width: 1250px;
background-image: url('/images/cloud.png');
background-repeat: no-repeat;
background-color: #e58535;
}
body p,
body h1 {
margin: 0;
padding: 0;
}
body ul {
margin: 0;
padding: 0;
list-style: none;
}
body .cleafix::after,
body .cleafix::before {
content: '';
display: table;
clear: both;
}
body .load {
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
z-index: 999;
position: relative;
}
body .load > .box {
width: 120px;
height: 120px;
background-color: #4c4b4b;
border-radius: 10px;
color: white;
text-align: center;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}
body .load > .box > span {
width: 40px;
height: 40px;
font-size: 40px;
animation: tein 3s infinite;
display: block;
margin: auto;
position: absolute;
left: 0;
right: 0;
top: 20px;
}
@keyframes tein {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
body .load > .box > p {
position: absolute;
font-size: 20px;
left: 0;
right: 0;
top: 60px;
}
body .header {
line-height: 64px;
background-color: rgba(0, 0, 0, 0.2);
color: white;
font-weight: bolder;
}
body .header .title {
float: left;
}
body .header nav {
float: right;
}
body .header nav > ul > li {
display: inline-block;
padding-right: 25px;
}
body main {
height: calc(100vh - 100px);
width: 100%;
display: grid;
place-items: center;
background-image: url('/images/loginbg4.png');
background-repeat: no-repeat;
background-size: containE;
}
body main > .box > .top {
width: 300px;
height: 70px;
margin: auto;
text-align: center;
margin-bottom: 20px;
background-image: url('/images/logo.png');
background-repeat: no-repeat;
}
body main > .box > .bttom {
height: 380px;
width: 750px;
box-shadow: 2px 2px 10px black;
background-color: white;
position: relative;
}
body main > .box > .bttom .left {
width: 300px;
height: 100%;
background-image: linear-gradient(120deg, #f6d365 0%, #fda085 100%);
background-repeat: no-repeat;
background-size: cover;
float: left;
position: absolute;
text-align: center;
color: white;
}
body main > .box > .bttom .left > .login-box {
position: relative;
}
body main > .box > .bttom .left > .login-box > button {
width: 80px;
height: 40px;
position: absolute;
top: 200px;
left: 0;
right: 0;
margin: auto;
border: 0;
border-radius: 5px;
color: white;
background-color: rgba(229, 133, 53, 0.3);
}
body main > .box > .bttom .left > .enter-box {
position: relative;
}
body main > .box > .bttom .left > .enter-box > button {
width: 80px;
height: 40px;
position: absolute;
top: 200px;
left: 0;
right: 0;
margin: auto;
border: 0;
border-radius: 5px;
color: white;
background-color: rgba(229, 133, 53, 0.3);
}
body main > .box > .bttom .form-box {
position: absolute;
left: 300px;
float: left;
margin-left: 50px;
}
body main > .box > .bttom .form-box h1 {
padding: 30px 0;
display: inline-block;
color: #e58535;
}
body main > .box > .bttom .form-box p {
font-size: 18px;
color: grey;
display: inline-block;
}
body main > .box > .bttom .form-box .form-login > div {
position: relative;
}
body main > .box > .bttom .form-box .form-login > div > p:nth-child(2) {
color: red;
position: absolute;
top: 50px;
display: none;
}
body main > .box > .bttom .form-box .form-login > div > p:nth-child(4) {
color: red;
position: absolute;
top: 120px;
display: none;
}
body main > .box > .bttom .form-box .form-login > div > div,
body main > .box > .bttom .form-box .form-login > div > button {
margin-bottom: 33px;
}
body main > .box > .bttom .form-box .form-login > div > div {
border: 1px #e58535 solid;
background-color: #faf2e5;
}
body main > .box > .bttom .form-box .form-login > div > div > span {
width: 50px;
font-size: 24px;
color: #e0622c;
}
body main > .box > .bttom .form-box .form-login > div > div > input {
width: 250px;
height: 40px;
border: 0;
background-color: #faf2e5;
outline: none;
}
body main > .box > .bttom .form-box .form-login > div > button {
width: 90px;
height: 40px;
border-radius: 3px;
border: 0;
background-color: #e0622c;
color: white;
}
body main > .box > .bttom .form-box .from-enter > .box {
width: 400px;
position: relative;
}
body main > .box > .bttom .form-box .from-enter > .box #ts {
position: absolute;
top: 45px;
width: 340px;
height: 40px;
color: red;
}
body main > .box > .bttom .form-box .from-enter > .box .input-box {
margin-bottom: 30px;
}
body main > .box > .bttom .form-box .from-enter > .box .input-box:nth-child(1),
body main > .box > .bttom .form-box .from-enter > .box .input-box:nth-child(2) {
border: 1px #e58535 solid;
background-color: #faf2e5;
display: inline-block;
}
body main > .box > .bttom .form-box .from-enter > .box .input-box input[type='text'] {
width: 250px;
height: 40px;
border: 0;
background-color: #faf2e5;
outline: none;
}
body main > .box > .bttom .form-box .from-enter > .box .input-box .error {
position: absolute;
top: 125px;
left: -50px;
color: red;
font-size: 14px;
border-radius: 2px;
padding: 2px;
display: none;
}
body main > .box > .bttom .form-box .from-enter > .box .sectionAll > span,
body main > .box > .bttom .form-box .from-enter > .box .roleAll > span {
font-size: 12px;
}
body main > .box > .bttom .form-box .from-enter > .box > button {
width: 90px;
height: 40px;
margin: auto;
border-radius: 3px;
border: 0;
background-color: #e0622c;
color: white;
}
body main > .box > .bttom .form-box .from-enter > .box > p {
position: absolute;
top: 115px;
left: 0;
color: red;
padding: 2px;
border-radius: 1px;
}
/*# sourceMappingURL=./login.css.map */
js
$('.login-box>button').click(function () {
$('.left').animate({
left: '0'
}, function () {
$('.form-login').toggle();
$('.from-enter').toggle();
$('.login-box').toggle();
$('.enter-box').toggle();
})
$('.form-box').animate({
left: '300px'
});
})
$('.enter-box>button').click(function (e) {
$('.left').animate({
left: '450px'
}, function () {
$('.form-login').toggle();
$('.from-enter').toggle();
$('.login-box').toggle();
$('.enter-box').toggle();
})
$('.form-box').animate({
left: '0'
});
//
});