refactor: ♻️ 登录页面样式调整

This commit is contained in:
ray
2024-11-01 15:34:01 +08:00
parent 7f8f69f00e
commit 32010211e6

View File

@@ -2,16 +2,6 @@
<div class="login"> <div class="login">
<!-- 登录页头部 --> <!-- 登录页头部 -->
<div class="login-header"> <div class="login-header">
<div class="flex-y-center">
<el-image :src="logo" class="logo" />
<span class="title">
{{ defaultSettings.title }}
</span>
<el-tag size="small" type="success">
{{ defaultSettings.version }}
</el-tag>
</div>
<div class="flex-y-center"> <div class="flex-y-center">
<el-switch <el-switch
v-model="isDark" v-model="isDark"
@@ -32,7 +22,7 @@
<div class="login-form"> <div class="login-form">
<el-form ref="loginFormRef" :model="loginData" :rules="loginRules"> <el-form ref="loginFormRef" :model="loginData" :rules="loginRules">
<div class="form-title"> <div class="form-title">
{{ $t("login.login") }} <h2>{{ defaultSettings.title }}</h2>
<el-dropdown style="position: absolute; right: 0"> <el-dropdown style="position: absolute; right: 0">
<div class="cursor-pointer"> <div class="cursor-pointer">
<el-icon> <el-icon>
@@ -41,6 +31,13 @@
</div> </div>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item>
版本号
<el-tag type="success">
{{ defaultSettings.version }}
</el-tag>
</el-dropdown-item>
<el-dropdown-item <el-dropdown-item
@click="setLoginCredentials('root', '123456')" @click="setLoginCredentials('root', '123456')"
> >
@@ -160,7 +157,7 @@
</div> </div>
</div> </div>
<!-- --> <!-- 登录页底部 -->
<div class="login-footer"> <div class="login-footer">
<el-text size="small"> <el-text size="small">
Copyright © 2021 - 2024 youlai.tech All Rights Reserved. Copyright © 2021 - 2024 youlai.tech All Rights Reserved.
@@ -245,7 +242,7 @@ const loginRules = computed(() => {
}; };
}); });
/** 获取验证码 */ // 获取验证码
function getCaptcha() { function getCaptcha() {
AuthAPI.getCaptcha().then((data) => { AuthAPI.getCaptcha().then((data) => {
loginData.value.captchaKey = data.captchaKey; loginData.value.captchaKey = data.captchaKey;
@@ -253,7 +250,7 @@ function getCaptcha() {
}); });
} }
/** 登录表单提交 */ // 登录
async function handleLoginSubmit() { async function handleLoginSubmit() {
loginFormRef.value?.validate((valid: boolean) => { loginFormRef.value?.validate((valid: boolean) => {
if (valid) { if (valid) {
@@ -262,7 +259,8 @@ async function handleLoginSubmit() {
.login(loginData.value) .login(loginData.value)
.then(async () => { .then(async () => {
await userStore.getUserInfo(); await userStore.getUserInfo();
await dictStore.loadDictionaries(); // 需要在路由跳转前加载字典数据,否则会出现字典数据未加载完成导致页面渲染异常 // 需要在路由跳转前加载字典数据,否则会出现字典数据未加载完成导致页面渲染异常
await dictStore.loadDictionaries();
// 跳转到登录前的页面 // 跳转到登录前的页面
const { path, queryParams } = parseRedirect(); const { path, queryParams } = parseRedirect();
router.push({ path: path, query: queryParams }); router.push({ path: path, query: queryParams });
@@ -341,7 +339,7 @@ onMounted(() => {
position: absolute; position: absolute;
top: 0; top: 0;
display: flex; display: flex;
justify-content: space-between; justify-content: right;
width: 100%; width: 100%;
padding: 15px; padding: 15px;
@@ -360,7 +358,7 @@ onMounted(() => {
.login-content { .login-content {
display: flex; display: flex;
width: 850px; width: 960px;
overflow: hidden; overflow: hidden;
background-color: #fff; background-color: #fff;
border-radius: 5px; border-radius: 5px;
@@ -370,6 +368,7 @@ onMounted(() => {
flex-direction: column; flex-direction: column;
max-width: 100%; max-width: 100%;
height: 100vh; height: 100vh;
padding: 0 30px;
border-radius: 0; border-radius: 0;
box-shadow: none; box-shadow: none;
} }
@@ -404,8 +403,7 @@ onMounted(() => {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 20px 0; padding: 0 0 20px;
font-size: 20px;
text-align: center; text-align: center;
} }