refactor: 登录框样式优化

This commit is contained in:
hxr
2024-01-27 23:56:52 +08:00
parent c65e91d8bb
commit 546416837c

View File

@@ -55,7 +55,6 @@
class="flex-1" class="flex-1"
:placeholder="$t('login.password')" :placeholder="$t('login.password')"
:type="passwordVisible === false ? 'password' : 'input'" :type="passwordVisible === false ? 'password' : 'input'"
size="large"
name="password" name="password"
@keyup="checkCapslock" @keyup="checkCapslock"
@keyup.enter="handleLogin" @keyup.enter="handleLogin"
@@ -70,7 +69,8 @@
</el-tooltip> </el-tooltip>
<!-- 验证码 --> <!-- 验证码 -->
<el-form-item prop="captchaCode"> <el-form-item prop="captchaCode" class="captcha-container">
<div class="input-and-icon">
<span class="p-2"> <span class="p-2">
<svg-icon icon-class="captcha" /> <svg-icon icon-class="captcha" />
</span> </span>
@@ -79,16 +79,17 @@
v-model="loginData.captchaCode" v-model="loginData.captchaCode"
auto-complete="off" auto-complete="off"
:placeholder="$t('login.captchaCode')" :placeholder="$t('login.captchaCode')"
class="w-[60%]" class="flex-1"
@keyup.enter="handleLogin" @keyup.enter="handleLogin"
/> />
</div>
<div class="captcha"> <div class="captcha">
<el-image <el-image
:src="captchaBase64" :src="captchaBase64"
@click="getCaptcha" @click="getCaptcha"
:style="{ height: captchaHeight }" :style="{ height: captchaHeight }"
class="w-[120px] h-[48px] cursor-pointer" class="captcha-image"
> >
<template #error> <template #error>
<div class="image-slot"> <div class="image-slot">
@@ -134,11 +135,7 @@ import { useI18n } from "vue-i18n";
import router from "@/router"; import router from "@/router";
import IconEpSunny from "~icons/ep/sunny"; import IconEpSunny from "~icons/ep/sunny";
import IconEpMoon from "~icons/ep/moon"; import IconEpMoon from "~icons/ep/moon";
import { useSettingsStore } from "@/store/modules/settings"; import { useSettingsStore, useUserStore, useAppStore } from "@/store";
// 状态管理依赖
import { useUserStore } from "@/store/modules/user";
import { useAppStore } from "@/store/modules/app";
// API依赖 // API依赖
import { LocationQuery, LocationQueryValue, useRoute } from "vue-router"; import { LocationQuery, LocationQueryValue, useRoute } from "vue-router";
@@ -316,10 +313,27 @@ onMounted(() => {
.login-form { .login-form {
padding: 30px 10px; padding: 30px 10px;
.captcha-container {
display: flex;
align-items: center;
justify-content: space-between;
.input-and-icon {
display: flex;
flex-grow: 1;
align-items: center;
margin-right: 10px; /* 调整间距 */
}
.captcha { .captcha {
position: absolute; /* 移除绝对定位 */
top: 0; flex-shrink: 0; /* 防止图片压缩 */
right: 0;
.captcha-image {
width: 120px; /* 固定图片宽度 */
height: 30px; /* 固定图片高度 */
cursor: pointer;
}
.image-slot { .image-slot {
display: flex; display: flex;
@@ -337,6 +351,7 @@ onMounted(() => {
} }
} }
} }
}
} }
.el-form-item { .el-form-item {