登录页添加背景控制

master
管理员 3 years ago
parent 715dbef032
commit f2e73e91de

@ -5,7 +5,8 @@
export const useLocalStore = defineStore('localStore', { export const useLocalStore = defineStore('localStore', {
state: () => { state: () => {
return { return {
test: undefined test: undefined,
loginBg:true,
} }
}, },
//计算字段 //计算字段

@ -3,37 +3,19 @@
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form"> <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">后台管理系统</h3> <h3 class="title">后台管理系统</h3>
<el-form-item prop="username"> <el-form-item prop="username">
<el-input <el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
v-model="loginForm.username"
type="text"
size="large"
auto-complete="off"
placeholder="账号"
>
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template> <template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<el-input <el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码"
v-model="loginForm.password" @keyup.enter="handleLogin">
type="password"
size="large"
auto-complete="off"
placeholder="密码"
@keyup.enter="handleLogin"
>
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template> <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item prop="code" v-if="captchaEnabled"> <el-form-item prop="code" v-if="captchaEnabled">
<el-input <el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="验证码" style="width: 63%"
v-model="loginForm.code" @keyup.enter="handleLogin">
size="large"
auto-complete="off"
placeholder="验证码"
style="width: 63%"
@keyup.enter="handleLogin"
>
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template> <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
</el-input> </el-input>
<div class="login-code"> <div class="login-code">
@ -42,13 +24,7 @@
</el-form-item> </el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;"></el-checkbox> <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;"></el-checkbox>
<el-form-item style="width:100%;"> <el-form-item style="width:100%;">
<el-button <el-button :loading="loading" size="large" type="primary" style="width:100%;" @click.prevent="handleLogin">
:loading="loading"
size="large"
type="primary"
style="width:100%;"
@click.prevent="handleLogin"
>
<span v-if="!loading"> </span> <span v-if="!loading"> </span>
<span v-else> ...</span> <span v-else> ...</span>
</el-button> </el-button>
@ -61,7 +37,8 @@
<div class="el-login-footer"> <div class="el-login-footer">
<span>Copyright © 2023 湖南艾维禄科技有限公司 All Rights Reserved.</span> <span>Copyright © 2023 湖南艾维禄科技有限公司 All Rights Reserved.</span>
</div> </div>
<w-bg-1></w-bg-1> <w-bg-1 v-if="localStore.loginBg"></w-bg-1>
<el-switch v-model="localStore.loginBg" class="login-switch" />
</div> </div>
</template> </template>
@ -85,6 +62,7 @@ onMounted(()=>{
const userStore = useUserStore() const userStore = useUserStore()
const router = useRouter(); const router = useRouter();
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const localStore = useLocalStore();
const loginForm = ref({ const loginForm = ref({
username: "admin", username: "admin",
@ -168,9 +146,12 @@ getCookie();
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 100%; height: 100%;
background-image: radial-gradient(#2c77bf, #2564a1);
background-size: cover; background-size: cover;
} }
.title { .title {
margin: 0px auto 30px auto; margin: 0px auto 30px auto;
text-align: center; text-align: center;
@ -181,6 +162,13 @@ getCookie();
letter-spacing: .3rem; letter-spacing: .3rem;
} }
.login-switch {
position: absolute;
z-index: 11;
right: 1rem;
bottom: .5rem;
}
.login-form { .login-form {
position: relative; position: relative;
z-index: 10; z-index: 10;
@ -189,32 +177,39 @@ getCookie();
width: 400px; width: 400px;
padding: 25px 25px 5px 25px; padding: 25px 25px 5px 25px;
box-shadow: 0 0 5rem #0005, 0 0 .5rem #FFF inset; box-shadow: 0 0 5rem #0005, 0 0 .5rem #FFF inset;
.el-input { .el-input {
height: 40px; height: 40px;
input { input {
height: 40px; height: 40px;
} }
} }
.input-icon { .input-icon {
height: 39px; height: 39px;
width: 14px; width: 14px;
margin-left: 0px; margin-left: 0px;
} }
} }
.login-tip { .login-tip {
font-size: 13px; font-size: 13px;
text-align: center; text-align: center;
color: #bfbfbf; color: #bfbfbf;
} }
.login-code { .login-code {
width: 33%; width: 33%;
height: 40px; height: 40px;
float: right; float: right;
img { img {
cursor: pointer; cursor: pointer;
vertical-align: middle; vertical-align: middle;
} }
} }
.el-login-footer { .el-login-footer {
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
@ -222,11 +217,13 @@ getCookie();
bottom: 0; bottom: 0;
width: 100%; width: 100%;
text-align: center; text-align: center;
color: #fff; color: #ddd;
font-family: Arial;
font-size: 12px; font-size: 12px;
letter-spacing: 1px; letter-spacing: 1px;
text-shadow: 1px 1px 0 #0009;
z-index: 10;
} }
.login-code-img { .login-code-img {
height: 40px; height: 40px;
padding-left: 12px; padding-left: 12px;

Loading…
Cancel
Save