功能变化: 登录页样式优化

pull/57/head
李强 2022-05-13 23:30:11 +08:00
parent d4602e41ae
commit 177133726f
3 changed files with 166 additions and 162 deletions

View File

@ -3,33 +3,27 @@
</template> </template>
<script> <script>
import { mapActions, mapState } from 'vuex' import { mapActions } from 'vuex'
import localeMixin from '@/locales/mixin.js' import localeMixin from '@/locales/mixin.js'
import * as api from '@/views/system/login/api' import * as api from '@/views/system/login/api'
export default { export default {
mixins: [localeMixin], mixins: [localeMixin],
computed: {
...mapState('d2admin', {
siteName: (state) => state.settings.siteName, //
siteLogo: (state) =>
state.settings.siteLogo || require('./image/dvadmin.png'), // logo
loginBackground: (state) =>
state.settings.loginBackground || require('./image/bg.jpg'), //
copyright: (state) => state.settings.copyright, //
keepRecord: (state) => state.settings.keepRecord, //
helpUrl: (state) => state.settings.helpUrl, //
privacyUrl: (state) => state.settings.privacyUrl, //
clauseUrl: (state) => state.settings.clauseUrl, //
captchaState: (state) => state.settings.captchaState//
})
},
beforeCreate () { beforeCreate () {
// //
this.$store.dispatch('d2admin/settings/init') this.$store.dispatch('d2admin/settings/init')
}, },
data () { data () {
return { return {
siteName: this.systemConfig('login.site_name'), //
siteLogo: this.systemConfig('login.site_logo') || require('./image/dvadmin.png'), // logo
loginBackground: this.systemConfig('login.login_background') || require('./image/bg.jpg'), //
copyright: this.systemConfig('login.copyright'), //
keepRecord: this.systemConfig('login.keep_record'), //
helpUrl: this.systemConfig('login.help_url'), //
privacyUrl: this.systemConfig('login.privacy_url'), //
clauseUrl: this.systemConfig('login.clause_url'), //
captchaState: this.systemConfig('login.captcha_state'), //
processTitle: process.env.VUE_APP_TITLE || 'D2Admin', processTitle: process.env.VUE_APP_TITLE || 'D2Admin',
backgroundImage: 'url(' + this.loginBackground + ')', backgroundImage: 'url(' + this.loginBackground + ')',
// //
@ -73,8 +67,16 @@ export default {
] ]
} }
}, },
mounted () {}, mounted () {
beforeDestroy () {}, document.onkeydown = () => {
var key = window.event.keyCode
if (key === 13) {
this.submit()
}
}
},
beforeDestroy () {
},
methods: { methods: {
...mapActions('d2admin/account', ['login']), ...mapActions('d2admin/account', ['login']),
/** /**
@ -138,8 +140,8 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
// ---- // ----
.page-login { .page-login {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
@ -153,45 +155,45 @@ export default {
-webkit-background-size: cover; /* 兼容Webkit内核浏览器如Chrome和Safari */ -webkit-background-size: cover; /* 兼容Webkit内核浏览器如Chrome和Safari */
-o-background-size: cover; /* 兼容Opera */ -o-background-size: cover; /* 兼容Opera */
zoom: 1; zoom: 1;
} }
::v-deep .el-card__body { ::v-deep .el-card__body {
height: 100%; height: 100%;
padding: 0; padding: 0;
} }
.card { .card {
height: 100%; height: 100%;
width: 100%; width: 100%;
border-radius: 30px; border-radius: 30px;
padding: 0; padding: 0;
margin-top: 12%; margin-top: 12%;
} }
.right-card { .right-card {
float: right; float: right;
text-align: center; text-align: center;
width: 50%; width: 50%;
height: 100%; height: 100%;
} }
.right-card h1 { .right-card h1 {
color: #098dee; color: #098dee;
margin-bottom: 40px; margin-bottom: 40px;
margin-top: 40px; margin-top: 40px;
} }
.button-login { .button-login {
width: 100%; width: 100%;
margin-top: 30px; margin-top: 30px;
} }
::v-deep .el-input-group__append { ::v-deep .el-input-group__append {
padding: 0; padding: 0;
} }
// footer // footer
.page-login--content-footer { .page-login--content-footer {
margin-top: 10%; margin-top: 10%;
padding: 1em 0; padding: 1em 0;
@ -240,5 +242,5 @@ export default {
margin: 0 1em; margin: 0 1em;
} }
} }
} }
</style> </style>

View File

@ -114,7 +114,7 @@ img {
.page-login--logo{ .page-login--logo{
margin: 0 auto; margin: 0 auto;
top: 10px; top: 10px;
left: 52em; left: 52%;
position: absolute; position: absolute;
} }
/*-- //Reset-Code --*/ /*-- //Reset-Code --*/
@ -231,7 +231,7 @@ img {
color: #444; color: #444;
text-transform: capitalize; text-transform: capitalize;
} }
h1 { .w3_info h1 {
font-size: 36px; font-size: 36px;
font-weight: 600; font-weight: 600;
color: #fff; color: #fff;

View File

@ -1,28 +1,21 @@
<template> <template>
<div <div
class="w3l-signinform" class="w3l-signinform"
:style="{ :style="{background:'url(' +(loginBackground || require('./image/bg.jpg')) +') no-repeat center', backgroundSize: '100% 100%' }"
background:
'url(' +
(loginBackground || require('./image/bg.jpg')) +
') no-repeat center'
}"
> >
<!-- container --> <!-- container -->
<div class="wrapper"> <div class="wrapper">
<!-- main content --> <!-- main content -->
<div class="w3l-form-info"> <div class="w3l-form-info">
<!-- logo --> <!-- logo -->
<img class="page-login--logo" :src="siteLogo" width="300" /> <img class="page-login--logo" :src="siteLogo" width="300"/>
<div class="w3_info"> <div class="w3_info">
<h2 style="text-align: center">{{ siteName || processTitle }}</h2> <h2 style="text-align: center">{{ siteName || processTitle }}</h2>
<el-card shadow="always" class="card"> <el-card shadow="always" class="card">
<el-tabs v-model="activeName"> <el-tabs v-model="activeName">
<el-tab-pane label="账号密码登录" name="first" stretch> <el-tab-pane label="账号密码登录" name="first" stretch>
<span slot="label" <span slot="label"><span style="margin: 30px">账号密码登录</span></span>
><span style="margin: 30px">账号密码登录</span></span <br/>
>
<br />
<el-form <el-form
ref="loginForm" ref="loginForm"
label-position="top" label-position="top"
@ -120,7 +113,7 @@
<el-row :gutter="10" style="margin: -20px 0px -10px 0px"> <el-row :gutter="10" style="margin: -20px 0px -10px 0px">
<el-col v-for="(user, index) in users" :key="index" :span="8"> <el-col v-for="(user, index) in users" :key="index" :span="8">
<div class="page-login--quick-user" @click="handleUserBtnClick(user)"> <div class="page-login--quick-user" @click="handleUserBtnClick(user)">
<d2-icon name="user-circle-o" /> <d2-icon name="user-circle-o"/>
<span>{{ user.name }}</span> <span>{{ user.name }}</span>
</div> </div>
</el-col> </el-col>
@ -139,47 +132,56 @@ export default {
activeName: 'first' activeName: 'first'
} }
}, },
created () {}, created () {
mounted () {}, },
mounted () {
},
methods: {} methods: {}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import './css/style.css'; @import './css/style.css';
.copyrights { .copyrights {
text-indent: -9999px; text-indent: -9999px;
height: 0; height: 0;
line-height: 0; line-height: 0;
font-size: 0; font-size: 0;
overflow: hidden; overflow: hidden;
} }
//
.page-login--quick{ //
.page-login--quick {
margin-top: 20px; margin-top: 20px;
} }
.page-login--quick-user {
.page-login--quick-user {
@extend %flex-center-col; @extend %flex-center-col;
padding: 10px 0px; padding: 10px 0px;
border-radius: 4px; border-radius: 4px;
&:hover { &:hover {
background-color: $color-bg; background-color: $color-bg;
i { i {
color: $color-text-normal; color: $color-text-normal;
} }
span { span {
color: $color-text-normal; color: $color-text-normal;
} }
} }
i { i {
font-size: 36px; font-size: 36px;
color: $color-text-sub; color: $color-text-sub;
} }
span { span {
font-size: 12px; font-size: 12px;
margin-top: 10px; margin-top: 10px;
color: $color-text-sub; color: $color-text-sub;
} }
} }
</style> </style>