feat: 前端UI/UX全面优化 - CSS变量系统/交互动画/按下反馈/弹窗动画/输入框聚焦增强

This commit is contained in:
lihanqi
2026-02-14 11:56:57 +08:00
parent ca0e2f9370
commit ff960d1724
56 changed files with 476 additions and 1340 deletions

View File

@@ -148,22 +148,8 @@ import { userStore } from '../store/user'
import { lotteryApi } from '../api/index.js'
import { useToast } from 'vue-toastification'
import { useRouter } from 'vue-router'
import { ElCard, ElInput, ElButton, ElCheckbox, ElAlert } from 'element-plus'
import { User, Lock, Iphone, Key } from '@element-plus/icons-vue'
export default {
name: 'Login',
components: {
ElCard,
ElInput,
ElButton,
ElCheckbox,
ElAlert,
User,
Lock,
Iphone,
Key
},
setup() {
const toast = useToast()
const router = useRouter()
@@ -438,10 +424,22 @@ export default {
/* 登录页面容器 */
.login-page-container {
min-height: calc(100vh - 70px);
background: #f0f2f5;
background: var(--color-bg-page, #f0f2f5);
padding: 20px 20px 8px 20px;
}
/* 表单入场动画 */
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* 页面头部 */
.page-header {
background: linear-gradient(135deg, #ff6b6b, #ee5a52);
@@ -450,8 +448,9 @@ export default {
text-align: center;
position: relative;
margin-bottom: 15px;
border-radius: 12px;
border-radius: var(--radius-md, 12px);
box-shadow: 0 4px 20px rgba(238, 90, 82, 0.3);
animation: slideUp 0.5s ease;
}
.page-title {
@@ -464,7 +463,7 @@ export default {
margin: 0 auto 4px;
font-weight: 700;
color: white;
text-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 20px rgba(0,0,0,0.3);
text-shadow: 0 2px 8px rgba(0,0,0,0.3);
letter-spacing: 1px;
text-align: center;
width: 100%;
@@ -475,7 +474,7 @@ export default {
margin: 0;
color: white;
opacity: 0.95;
text-shadow: 0 2px 4px rgba(0,0,0,0.4);
text-shadow: 0 1px 3px rgba(0,0,0,0.2);
text-align: center;
width: 100%;
font-weight: 400;
@@ -492,9 +491,10 @@ export default {
padding: 0;
background: white;
margin: 0 0 20px 0;
border-radius: 16px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
border-radius: var(--radius-lg, 16px);
box-shadow: var(--shadow-lg, 0 8px 30px rgba(0, 0, 0, 0.12));
overflow: hidden;
animation: slideUp 0.5s ease 0.1s both;
}
/* 登录方式切换标签 */
@@ -502,6 +502,7 @@ export default {
display: flex;
border-bottom: 1px solid #f0f0f0;
background: #fafafa;
position: relative;
}
.login-tab {
@@ -509,19 +510,36 @@ export default {
text-align: center;
padding: 18px 0;
font-size: 15px;
color: #888;
color: #999;
cursor: pointer;
transition: all 0.3s ease;
transition: color 0.25s ease, background 0.25s ease;
position: relative;
font-weight: 500;
user-select: none;
}
.login-tab::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 0;
height: 2.5px;
background: var(--color-primary, #e53e3e);
border-radius: 2px;
transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.login-tab.active {
color: #e53e3e;
color: var(--color-primary, #e53e3e);
background: white;
font-weight: 600;
}
.login-tab.active::after {
width: 40px;
}
.login-tab:hover:not(.active) {
color: #666;
@@ -537,26 +555,25 @@ export default {
/* 表单组 */
.form-group {
margin-bottom: 16px;
margin-bottom: 18px;
}
.input-wrapper {
position: relative;
display: flex;
align-items: center;
border: 2px solid #e9ecef;
border: 2px solid var(--color-border, #e9ecef);
border-radius: 6px;
background: #f8f9fa;
transition: all 0.3s ease;
background: var(--color-bg-input, #f8f9fa);
transition: all var(--transition-base, 0.25s ease);
min-height: 56px;
overflow: hidden;
}
.input-wrapper:focus-within {
border-color: #e9ecef;
border-color: var(--color-primary, #e53e3e);
background: white;
box-shadow: none;
outline: none;
box-shadow: 0 0 0 3px var(--color-primary-bg, rgba(229, 62, 62, 0.08));
}
input:focus {
@@ -565,12 +582,12 @@ input:focus {
}
.input-wrapper.error {
border-color: #dc3545;
border-color: var(--color-danger, #dc3545);
background: #fff5f5;
}
.input-wrapper.success {
border-color: #4caf50;
border-color: var(--color-success, #4caf50);
background: #f8fff8;
}
@@ -597,9 +614,10 @@ input:focus {
outline: none;
font-size: 16px;
background: transparent;
color: #212529;
color: var(--color-text-primary, #212529);
box-shadow: none;
-webkit-appearance: none;
appearance: none;
}
.form-input:focus {
@@ -633,11 +651,11 @@ input:-webkit-autofill:active {
/* 内联发送验证码按钮样式 */
.send-code-btn-inline {
background: linear-gradient(135deg, #e53e3e, #ff6b6b);
background: linear-gradient(135deg, var(--color-primary, #e53e3e), var(--color-primary-light, #ff6b6b));
border: none;
border-radius: 12px;
border-radius: var(--radius-md, 12px);
font-weight: 500;
transition: all 0.3s ease;
transition: all var(--transition-base, 0.25s ease);
min-width: 120px;
flex-shrink: 0;
height: auto;
@@ -647,36 +665,37 @@ input:-webkit-autofill:active {
}
.send-code-btn-inline:hover:not(.is-disabled) {
background: linear-gradient(135deg, #d43030, #ff5a5a);
background: linear-gradient(135deg, var(--color-primary-dark, #d43030), #ff5a5a);
transform: translateY(-1px);
box-shadow: 0 4px 15px rgba(229, 62, 62, 0.3);
box-shadow: 0 4px 15px var(--color-primary-shadow, rgba(229, 62, 62, 0.3));
}
.send-code-btn-inline:active:not(.is-disabled) {
transform: translateY(0);
transform: translateY(0) scale(0.98);
}
.send-code-btn-inline.is-disabled {
background: #cccccc !important;
border-color: #cccccc !important;
color: #888 !important;
background: #d9d9d9 !important;
border-color: #d9d9d9 !important;
color: #999 !important;
transform: none !important;
box-shadow: none !important;
}
/* 提示文本 */
.error-text {
color: #ff4444;
color: var(--color-danger, #f56565);
font-size: 12px;
margin-top: 5px;
margin-left: 8px;
margin-top: 6px;
margin-left: 4px;
animation: slideUp 0.2s ease;
}
.tip-text {
color: #888888;
color: var(--color-text-tertiary, #a0aec0);
font-size: 12px;
margin-top: 5px;
margin-left: 8px;
margin-top: 6px;
margin-left: 4px;
}
/* 隐藏浏览器自带的密码控件 */
@@ -692,7 +711,7 @@ input::-webkit-credentials-auto-fill-button {
}
.form-input::placeholder {
color: #9ca3af;
color: var(--color-text-placeholder, #cbd5e0);
}
.password-toggle {
@@ -739,24 +758,25 @@ input::-webkit-credentials-auto-fill-button {
justify-content: center;
font-size: 10px;
color: transparent;
transition: all 0.3s;
transition: all 0.2s;
}
.checkbox-wrapper input:checked + .checkmark {
background: #e53e3e;
border-color: #e53e3e;
background: var(--color-primary, #e53e3e);
border-color: var(--color-primary, #e53e3e);
color: white;
}
/* 忘记密码链接 */
.forgot-password-link {
color: #e53e3e;
color: var(--color-primary, #e53e3e);
text-decoration: none;
font-size: 14px;
transition: all 0.3s;
transition: color var(--transition-fast, 0.15s ease);
}
.forgot-password-link:hover {
color: var(--color-primary-dark, #c53030);
text-decoration: underline;
}
@@ -768,22 +788,23 @@ input::-webkit-credentials-auto-fill-button {
font-size: 16px;
font-weight: 600;
height: 52px;
background: linear-gradient(135deg, #e53e3e, #ff6b6b);
background: linear-gradient(135deg, var(--color-primary, #e53e3e), var(--color-primary-light, #ff6b6b));
border: none;
border-radius: 12px;
box-shadow: 0 4px 20px rgba(229, 62, 62, 0.25);
transition: all 0.3s ease;
border-radius: var(--radius-md, 12px);
box-shadow: 0 4px 20px var(--color-primary-shadow, rgba(229, 62, 62, 0.25));
transition: all var(--transition-base, 0.25s ease);
letter-spacing: 1px;
}
.login-btn:hover:not(:disabled) {
transform: translateY(-1px);
box-shadow: 0 6px 30px rgba(229, 62, 62, 0.35);
background: linear-gradient(135deg, #d43030, #ff5a5a);
transform: translateY(-2px);
box-shadow: 0 8px 25px rgba(229, 62, 62, 0.4);
background: linear-gradient(135deg, var(--color-primary-dark, #d43030), #ff5a5a);
border: none;
}
.login-btn:active:not(:disabled) {
transform: translateY(0);
transform: translateY(0) scale(0.98);
box-shadow: 0 2px 10px rgba(229, 62, 62, 0.3);
}
@@ -791,65 +812,71 @@ input::-webkit-credentials-auto-fill-button {
:deep(.el-input__wrapper) {
padding: 6px 16px;
box-shadow: none !important;
background-color: #f8f9fa;
border: 2px solid #e9ecef;
border-radius: 12px;
transition: all 0.3s ease;
background-color: var(--color-bg-input, #f7fafc);
border: 2px solid var(--color-border, #e2e8f0);
border-radius: var(--radius-md, 12px);
transition: all var(--transition-base, 0.25s ease);
}
:deep(.el-input__wrapper.is-focus) {
background-color: #fff;
border-color: #e53e3e;
box-shadow: 0 0 0 4px rgba(229, 62, 62, 0.1);
border-color: var(--color-primary, #e53e3e);
box-shadow: 0 0 0 3px var(--color-primary-bg, rgba(229, 62, 62, 0.08)) !important;
}
:deep(.el-input__prefix) {
margin-right: 12px;
color: #999;
color: var(--color-text-tertiary, #a0aec0);
transition: color var(--transition-base, 0.25s ease);
}
:deep(.el-input.is-focus .el-input__prefix) {
color: var(--color-primary, #e53e3e);
}
:deep(.el-input__inner) {
height: 44px;
font-size: 15px;
color: #333;
color: var(--color-text-primary, #1a202c);
}
:deep(.el-checkbox__label) {
font-size: 14px;
color: #666;
color: var(--color-text-secondary, #4a5568);
}
:deep(.el-checkbox__inner) {
border-color: #ddd;
transition: all 0.2s ease;
}
:deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
background-color: #e53e3e;
border-color: #e53e3e;
background-color: var(--color-primary, #e53e3e);
border-color: var(--color-primary, #e53e3e);
}
:deep(.el-button.is-disabled) {
background: #cccccc;
border-color: #cccccc;
background: #d9d9d9;
border-color: #d9d9d9;
}
/* 注册链接 */
.register-link {
text-align: center;
font-size: 14px;
color: #666;
color: var(--color-text-secondary, #4a5568);
}
.register-link .link {
color: #e53e3e;
color: var(--color-primary, #e53e3e);
text-decoration: none;
margin-left: 5px;
font-weight: 500;
transition: color var(--transition-fast, 0.15s ease);
}
.register-link .link:hover {
color: var(--color-primary-dark, #c53030);
text-decoration: underline;
}
@@ -862,7 +889,6 @@ input::-webkit-credentials-auto-fill-button {
.login-form {
padding: 22px 20px 18px;
}
}
@media (max-width: 480px) {
@@ -919,6 +945,4 @@ input::-webkit-credentials-auto-fill-button {
gap: 8px;
}
}
/* 桌面端样式 - 这部分已在上面定义,这里移除重复定义 */
</style>