登陆页样式修改

雨滴效果自适应
master
toesbieya 6 years ago
parent f19e4de97e
commit 9845a140ef
  1. 44
      vue/src/assets/styles/login.scss
  2. 3
      vue/src/plugin/rain/index.js
  3. 19
      vue/src/views/app/login.vue
  4. 10
      vue/src/views/app/register.vue

@ -9,10 +9,11 @@ $cursor: #fff;
} }
} }
.login-container { .login-page {
height: 100%; display: flex;
width: 100%; flex-direction: column;
overflow: hidden; height: 100vh;
overflow: auto;
canvas { canvas {
position: absolute; position: absolute;
@ -22,10 +23,21 @@ $cursor: #fff;
background: #2d3a4b; background: #2d3a4b;
} }
.login-form { .login-container {
width: 520px; flex: 1;
padding: 0 35px; padding: 32px 0;
margin: 160px auto; text-align: center;
width: 384px;
margin: 0 auto;
.title {
padding-top: 120px;
margin-bottom: 40px;
cursor: pointer;
font-size: 26px;
color: #eee;
font-weight: bold;
position: relative;
} }
.svg-container { .svg-container {
@ -36,18 +48,6 @@ $cursor: #fff;
display: inline-block; display: inline-block;
} }
.title-container {
position: relative;
.title {
font-size: 26px;
color: #eee;
margin: 0 auto 40px auto;
text-align: center;
font-weight: bold;
}
}
.show-pwd { .show-pwd {
position: absolute; position: absolute;
right: 10px; right: 10px;
@ -83,7 +83,7 @@ $cursor: #fff;
.el-form-item { .el-form-item {
border: 1px solid rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.1);
background: rgba(0, 0, 0, 0.1); background: rgba(0, 0, 0, 0.1);
border-radius: 5px; margin-bottom: 30px;
color: #454545; }
} }
} }

@ -9,6 +9,7 @@ export default class Rain {
this.stopSign = false this.stopSign = false
this.canvas = canvas this.canvas = canvas
this.ctx = canvas.getContext('2d') this.ctx = canvas.getContext('2d')
this.resize = this.resize.bind(this)
this.start() this.start()
} }
@ -49,11 +50,13 @@ export default class Rain {
} }
start() { start() {
window.addEventListener('resize', this.resize)
this.resize() this.resize()
this.loop() this.loop()
} }
stop() { stop() {
window.removeEventListener('resize', this.resize)
this.stopSign = true this.stopSign = true
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height) this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)
} }

@ -1,10 +1,9 @@
<template> <template>
<div class="login-container"> <div class="login-page">
<canvas id="login-background"/> <canvas id="login-background"/>
<el-form ref="form" :model="form" :rules="rules" autocomplete="on" class="login-form" label-position="left"> <div class="login-container">
<div class="title-container"> <div class="title">进销存管理系统</div>
<h3 class="title">进销存管理系统</h3> <el-form ref="form" :model="form" :rules="rules" autocomplete="on" label-position="left">
</div>
<el-form-item prop="username"> <el-form-item prop="username">
<span class="svg-container"> <span class="svg-container">
<svg-icon icon="user"/> <svg-icon icon="user"/>
@ -52,6 +51,7 @@
</div> </div>
</el-form> </el-form>
</div> </div>
</div>
</template> </template>
<script> <script>
@ -100,7 +100,8 @@
success() { success() {
elSuccess('登陆成功') elSuccess('登陆成功')
let redirect = this.$route.query.redirect || '/' let redirect = this.$route.query.redirect || '/'
window.location.href = '/#' + redirect //0.5s
setTimeout(() => window.location.href = '/#' + redirect, 500)
}, },
capsLockTip({keyCode}) { capsLockTip({keyCode}) {
if (keyCode === 20) this.capsTooltip = !this.capsTooltip if (keyCode === 20) this.capsTooltip = !this.capsTooltip
@ -116,11 +117,13 @@
if (loginBackgroundAnimate) { if (loginBackgroundAnimate) {
import('@/plugin/rain') import('@/plugin/rain')
.then(_ => { .then(_ => {
this.rain = new _.default({ this.rain = new _.default(
{
rainDropCount: 500, rainDropCount: 500,
rainColor: 'rgba(150,180,255,0.8)', rainColor: 'rgba(150,180,255,0.8)',
backgroundColor: '#2d3a4b' backgroundColor: '#2d3a4b'
}, document.getElementById('login-background')) },
document.getElementById('login-background'))
}) })
} }
this.addCapsLockEvent() this.addCapsLockEvent()

@ -1,10 +1,9 @@
<template> <template>
<div class="login-page">
<canvas id="login-background"/>
<div class="login-container"> <div class="login-container">
<canvas/> <div class="title">用户注册</div>
<el-form ref="form" :model="form" :rules="rules" class="login-form" label-position="left"> <el-form ref="form" :model="form" :rules="rules" label-position="left">
<div class="title-container">
<h3 class="title">用户注册</h3>
</div>
<el-form-item prop="username"> <el-form-item prop="username">
<span class="svg-container"> <span class="svg-container">
<svg-icon icon="user"/> <svg-icon icon="user"/>
@ -38,6 +37,7 @@
</div> </div>
</el-form> </el-form>
</div> </div>
</div>
</template> </template>
<script> <script>

Loading…
Cancel
Save