From b8fe29d5ba98b7606f9da10bbfdbd0f602b65ebd Mon Sep 17 00:00:00 2001 From: Leo <98382335+gaoziman@users.noreply.github.com> Date: Fri, 10 Oct 2025 21:08:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E7=94=A8=E6=88=B7=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2UI=E5=92=8C=E4=BA=A4=E4=BA=92=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化登录页面布局和表单样式,提升视觉层次感 - 简化注册页面代码逻辑,移除冗余字段和验证 - 重构个人中心页面,改进信息展示和编辑功能 - 统一表单组件样式规范,增强品牌一致性 - 完善移动端适配,优化小屏幕下的用户体验 - 优化按钮和输入框交互反馈,提升可用性 --- src/pages/User/Center.css | 200 +++++++++++++++++++++++++++++------- src/pages/User/Center.tsx | 57 +++++----- src/pages/User/Login.css | 192 +++++++++++++--------------------- src/pages/User/Login.tsx | 37 +------ src/pages/User/Register.css | 162 +++++++++++++---------------- src/pages/User/Register.tsx | 49 ++------- 6 files changed, 355 insertions(+), 342 deletions(-) diff --git a/src/pages/User/Center.css b/src/pages/User/Center.css index 1b8e0be..5b38b35 100644 --- a/src/pages/User/Center.css +++ b/src/pages/User/Center.css @@ -6,75 +6,149 @@ } .page-header { - background: linear-gradient(135deg, #d4a574 0%, #c8a060 100%); - padding: 60px 0; - color: #ffffff; + background: linear-gradient(135deg, #fafaf8 0%, #f5f0e8 50%, #fafaf8 100%); + padding: 80px 0 40px; + position: relative; + overflow: hidden; } -.user-profile { - text-align: center; +/* 装饰性背景圆圈 */ +.page-header::before { + content: ''; + position: absolute; + top: -30%; + right: 5%; + width: 400px; + height: 400px; + background: radial-gradient(circle, rgba(200, 54, 61, 0.06) 0%, transparent 70%); + border-radius: 50%; + pointer-events: none; } -.user-profile h2 { +.page-header::after { + content: ''; + position: absolute; + bottom: -30%; + left: 5%; + width: 350px; + height: 350px; + background: radial-gradient(circle, rgba(212, 165, 116, 0.06) 0%, transparent 70%); + border-radius: 50%; + pointer-events: none; +} + +.user-profile-card { + background: #ffffff; + border-radius: 16px; + box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08); + padding: 40px; + border: 1px solid rgba(232, 227, 219, 0.6); + position: relative; + z-index: 1; +} + +.user-profile-header { + display: flex; + align-items: center; + gap: 24px; + margin-bottom: 32px; + padding-bottom: 32px; + border-bottom: 1px solid #f0f0f0; +} + +.user-avatar-wrapper { + position: relative; +} + +.user-avatar-wrapper .ant-avatar { + border: 4px solid #f5f0e8; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); +} + +.user-info-content { + flex: 1; +} + +.user-info-content h2 { font-size: 24px; - font-weight: 600; - color: #ffffff; - margin: 16px 0 8px; + font-weight: 700; + color: #2c2c2c; + margin: 0 0 8px 0; + font-family: 'Noto Serif SC', 'Songti SC', serif; } .user-email { font-size: 14px; - color: rgba(255, 255, 255, 0.8); - margin-bottom: 20px; + color: #999999; + margin: 0; + display: flex; + align-items: center; + gap: 8px; } .user-actions { display: flex; gap: 12px; - justify-content: center; + margin-left: auto; } -.user-actions button { - border-radius: 20px; - background: rgba(255, 255, 255, 0.2); - border: 1px solid rgba(255, 255, 255, 0.3); - color: #ffffff; - backdrop-filter: blur(10px); +.user-actions .ant-btn { + border-radius: 8px; + font-weight: 500; + height: 38px; + padding: 0 20px; } -.user-actions button:hover { - background: rgba(255, 255, 255, 0.3); - border-color: rgba(255, 255, 255, 0.4); - color: #ffffff; +.user-actions .ant-btn-default { + border-color: #d9d9d9; + color: #666666; +} + +.user-actions .ant-btn-default:hover { + border-color: #c8363d; + color: #c8363d; } .user-stats { display: grid; - grid-template-columns: repeat(2, 1fr); + grid-template-columns: repeat(3, 1fr); gap: 24px; - background: rgba(255, 255, 255, 0.15); - padding: 32px; - border-radius: 12px; - backdrop-filter: blur(10px); } -.user-stats .ant-statistic { +.stat-item { text-align: center; + padding: 24px; + background: linear-gradient(135deg, #fafaf8 0%, #f5f0e8 100%); + border-radius: 12px; + transition: all 0.3s ease; + border: 1px solid transparent; } -.user-stats .ant-statistic-title { - color: rgba(255, 255, 255, 0.9); - font-size: 14px; +.stat-item:hover { + transform: translateY(-2px); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); + border-color: rgba(200, 54, 61, 0.2); } -.user-stats .ant-statistic-content { - color: #ffffff; +.stat-icon { + font-size: 32px; + color: #c8363d; + margin-bottom: 12px; + display: block; +} + +.stat-value { font-size: 28px; font-weight: 700; + color: #2c2c2c; + margin: 0 0 4px 0; + font-family: 'Noto Serif SC', 'Songti SC', serif; } -.user-stats .anticon { - color: rgba(255, 255, 255, 0.8); +.stat-label { + font-size: 13px; + color: #999999; + margin: 0; } /* 页面内容 */ @@ -151,6 +225,30 @@ /* 响应式 */ @media (max-width: 992px) { + .user-profile-header { + flex-direction: column; + text-align: center; + } + + .user-info-content { + text-align: center; + } + + .user-email { + justify-content: center; + } + + .user-actions { + margin-left: 0; + justify-content: center; + } + + .user-stats { + grid-template-columns: repeat(3, 1fr); + } +} + +@media (max-width: 768px) { .user-stats { grid-template-columns: repeat(2, 1fr); } @@ -158,11 +256,41 @@ @media (max-width: 576px) { .page-header { - padding: 40px 0; + padding: 60px 0 30px; + } + + .user-profile-card { + padding: 24px; + } + + .user-profile-header { + margin-bottom: 24px; + padding-bottom: 24px; + } + + .user-avatar-wrapper .ant-avatar { + width: 80px !important; + height: 80px !important; + } + + .user-info-content h2 { + font-size: 20px; + } + + .user-actions { + width: 100%; + } + + .user-actions .ant-btn { + flex: 1; } .user-stats { grid-template-columns: 1fr; + gap: 16px; + } + + .stat-item { padding: 20px; } diff --git a/src/pages/User/Center.tsx b/src/pages/User/Center.tsx index c3a0bcc..395abf0 100644 --- a/src/pages/User/Center.tsx +++ b/src/pages/User/Center.tsx @@ -3,7 +3,7 @@ */ import React, { useEffect, useState } from 'react' -import { Tabs, Card, Avatar, Button, List, Empty, Tag, Row, Col, Statistic } from 'antd' +import { Tabs, Card, Avatar, Button, List, Empty, Tag, Row, Col } from 'antd' import { UserOutlined, HeartOutlined, @@ -12,6 +12,7 @@ import { EditOutlined, TrophyOutlined, ClockCircleOutlined, + MailOutlined, } from '@ant-design/icons' import { Link, useNavigate } from 'react-router-dom' import { useUserStore } from '@store/useUserStore' @@ -69,33 +70,41 @@ const UserCenter: React.FC = () => {
- - -
+
+
+
} /> +
+

{user.username}

-

{user.email}

-
- - -
+

+ + {user.email} +

- - -
- } - /> - } - /> +
+
- - +
+ +
+
+ +
{user.favorites.length}
+
收藏数
+
+
+ +
0
+
评论数
+
+
+ +
0
+
学习时长(小时)
+
+
+
diff --git a/src/pages/User/Login.css b/src/pages/User/Login.css index 1067a90..726cd83 100644 --- a/src/pages/User/Login.css +++ b/src/pages/User/Login.css @@ -5,33 +5,72 @@ display: flex; align-items: center; justify-content: center; - background: linear-gradient(135deg, #f5f0e8 0%, #ffffff 100%); + background: linear-gradient(135deg, #fafaf8 0%, #f5f0e8 50%, #fafaf8 100%); padding: 40px 20px; + position: relative; + overflow: hidden; +} + +.login-page::before { + content: ''; + position: absolute; + top: -50%; + right: -10%; + width: 500px; + height: 500px; + background: radial-gradient(circle, rgba(200, 54, 61, 0.08) 0%, transparent 70%); + border-radius: 50%; +} + +.login-page::after { + content: ''; + position: absolute; + bottom: -50%; + left: -10%; + width: 400px; + height: 400px; + background: radial-gradient(circle, rgba(212, 165, 116, 0.08) 0%, transparent 70%); + border-radius: 50%; } .login-container { width: 100%; - max-width: 1000px; - display: grid; - grid-template-columns: 1fr 1fr; - gap: 0; - background: #ffffff; - border-radius: 16px; - box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08); - overflow: hidden; + max-width: 420px; + position: relative; + z-index: 1; } .login-card { - padding: 60px 50px; + background: #ffffff; + border-radius: 16px; + box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08); + padding: 48px 40px; + border: 1px solid rgba(232, 227, 219, 0.6); } .login-header { text-align: center; - margin-bottom: 40px; + margin-bottom: 32px; +} + +.logo-badge { + width: 56px; + height: 56px; + background: linear-gradient(135deg, #c8363d 0%, #a82e34 100%); + border-radius: 12px; + display: flex; + align-items: center; + justify-content: center; + color: #ffffff; + font-size: 18px; + font-weight: 600; + font-family: 'Noto Serif SC', 'Songti SC', serif; + margin: 0 auto 20px; + box-shadow: 0 4px 12px rgba(200, 54, 61, 0.3); } .login-header h1 { - font-size: 28px; + font-size: 24px; font-weight: 700; color: #2c2c2c; margin-bottom: 8px; @@ -44,137 +83,48 @@ margin: 0; } -.login-options { - display: flex; - justify-content: flex-end; -} - -.forgot-link { - color: #d4a574; - font-size: 14px; -} - -.forgot-link:hover { - color: #c8a060; -} - -.social-login { - display: flex; - gap: 12px; - margin-bottom: 24px; -} - -.social-btn { - flex: 1; - border-radius: 8px; -} - -.social-btn.wechat { - color: #07c160; - border-color: #07c160; -} - -.social-btn.wechat:hover { - color: #ffffff; - background: #07c160; - border-color: #07c160; -} - -.social-btn.alipay { - color: #1677ff; - border-color: #1677ff; -} - -.social-btn.alipay:hover { - color: #ffffff; - background: #1677ff; - border-color: #1677ff; -} - .register-link { text-align: center; font-size: 14px; color: #666666; + margin-top: 24px; + padding-top: 20px; + border-top: 1px solid #f0f0f0; } .register-link a { - color: #d4a574; + color: #c8363d; font-weight: 500; - margin-left: 8px; + margin-left: 4px; + transition: color 0.3s ease; + cursor: pointer !important; + text-decoration: none; } .register-link a:hover { - color: #c8a060; + color: #a82e34; + text-decoration: underline; + cursor: pointer !important; } -/* 插图区域 */ -.login-illustration { - background: linear-gradient(135deg, #d4a574 0%, #c8a060 100%); - padding: 60px 50px; - display: flex; - align-items: center; - justify-content: center; - color: #ffffff; -} - -.illustration-content { - text-align: center; -} - -.illustration-content h2 { - font-size: 32px; - font-weight: 700; - margin-bottom: 16px; - color: #ffffff; - font-family: 'Noto Serif SC', 'Songti SC', serif; -} - -.illustration-content p { - font-size: 16px; - color: rgba(255, 255, 255, 0.9); - margin-bottom: 40px; -} - -.illustration-image { - width: 100%; - max-width: 300px; - margin: 0 auto; - border-radius: 12px; - overflow: hidden; - box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); -} - -.illustration-image img { - width: 100%; - height: auto; - display: block; +/* 所有链接统一手型光标 */ +.login-card a { + cursor: pointer !important; } /* 响应式 */ -@media (max-width: 992px) { - .login-container { - grid-template-columns: 1fr; - } - - .login-illustration { - display: none; - } - - .login-card { - padding: 40px 30px; - } -} - @media (max-width: 576px) { .login-card { - padding: 30px 20px; + padding: 40px 24px; } .login-header h1 { - font-size: 24px; + font-size: 22px; } - .social-login { - flex-direction: column; + .logo-badge { + width: 48px; + height: 48px; + font-size: 16px; } } diff --git a/src/pages/User/Login.tsx b/src/pages/User/Login.tsx index dd746a3..58fec16 100644 --- a/src/pages/User/Login.tsx +++ b/src/pages/User/Login.tsx @@ -3,8 +3,8 @@ */ import React, { useState } from 'react' -import { Form, Input, Button, message, Divider } from 'antd' -import { UserOutlined, LockOutlined, WechatOutlined, AlipayOutlined } from '@ant-design/icons' +import { Form, Input, Button, message } from 'antd' +import { UserOutlined, LockOutlined } from '@ant-design/icons' import { Link, useNavigate } from 'react-router-dom' import { useUserStore } from '@store/useUserStore' import './Login.css' @@ -32,6 +32,7 @@ const Login: React.FC = () => {
+
非遗

欢迎回来

登录以继续您的非遗文化之旅

@@ -56,14 +57,6 @@ const Login: React.FC = () => { } placeholder="密码" /> - -
- - 忘记密码? - -
-
- - -
-
还没有账号?立即注册
- -
-
-

传承非遗文化

-

探索中华文化瑰宝,传承千年技艺精髓

-
- 传统文化 -
-
-
) diff --git a/src/pages/User/Register.css b/src/pages/User/Register.css index 97e9e4d..27d920f 100644 --- a/src/pages/User/Register.css +++ b/src/pages/User/Register.css @@ -5,33 +5,72 @@ display: flex; align-items: center; justify-content: center; - background: linear-gradient(135deg, #f5f0e8 0%, #ffffff 100%); + background: linear-gradient(135deg, #fafaf8 0%, #f5f0e8 50%, #fafaf8 100%); padding: 40px 20px; + position: relative; + overflow: hidden; +} + +.register-page::before { + content: ''; + position: absolute; + top: -50%; + right: -10%; + width: 500px; + height: 500px; + background: radial-gradient(circle, rgba(200, 54, 61, 0.08) 0%, transparent 70%); + border-radius: 50%; +} + +.register-page::after { + content: ''; + position: absolute; + bottom: -50%; + left: -10%; + width: 400px; + height: 400px; + background: radial-gradient(circle, rgba(212, 165, 116, 0.08) 0%, transparent 70%); + border-radius: 50%; } .register-container { width: 100%; - max-width: 1000px; - display: grid; - grid-template-columns: 1fr 1fr; - gap: 0; - background: #ffffff; - border-radius: 16px; - box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08); - overflow: hidden; + max-width: 460px; + position: relative; + z-index: 1; } .register-card { - padding: 60px 50px; + background: #ffffff; + border-radius: 16px; + box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08); + padding: 48px 40px; + border: 1px solid rgba(232, 227, 219, 0.6); } .register-header { text-align: center; - margin-bottom: 40px; + margin-bottom: 32px; +} + +.logo-badge { + width: 56px; + height: 56px; + background: linear-gradient(135deg, #c8363d 0%, #a82e34 100%); + border-radius: 12px; + display: flex; + align-items: center; + justify-content: center; + color: #ffffff; + font-size: 18px; + font-weight: 600; + font-family: 'Noto Serif SC', 'Songti SC', serif; + margin: 0 auto 20px; + box-shadow: 0 4px 12px rgba(200, 54, 61, 0.3); } .register-header h1 { - font-size: 28px; + font-size: 24px; font-weight: 700; color: #2c2c2c; margin-bottom: 8px; @@ -48,99 +87,44 @@ text-align: center; font-size: 14px; color: #666666; + margin-top: 24px; + padding-top: 20px; + border-top: 1px solid #f0f0f0; } .login-link a { - color: #d4a574; + color: #c8363d; font-weight: 500; - margin-left: 8px; + margin-left: 4px; + transition: color 0.3s ease; + cursor: pointer !important; + text-decoration: none; } .login-link a:hover { - color: #c8a060; + color: #a82e34; + text-decoration: underline; + cursor: pointer !important; } -/* 插图区域 */ -.register-illustration { - background: linear-gradient(135deg, #c8363d 0%, #a82f35 100%); - padding: 60px 50px; - display: flex; - align-items: center; - justify-content: center; - color: #ffffff; -} - -.illustration-content { - text-align: center; -} - -.illustration-content h2 { - font-size: 32px; - font-weight: 700; - margin-bottom: 16px; - color: #ffffff; - font-family: 'Noto Serif SC', 'Songti SC', serif; -} - -.illustration-content > p { - font-size: 16px; - color: rgba(255, 255, 255, 0.9); - margin-bottom: 40px; -} - -.feature-list { - display: flex; - flex-direction: column; - gap: 24px; -} - -.feature-item { - text-align: left; - background: rgba(255, 255, 255, 0.1); - padding: 20px; - border-radius: 12px; - backdrop-filter: blur(10px); -} - -.feature-icon { - font-size: 32px; - margin-bottom: 12px; -} - -.feature-item h3 { - font-size: 18px; - font-weight: 600; - color: #ffffff; - margin-bottom: 8px; -} - -.feature-item p { - font-size: 14px; - color: rgba(255, 255, 255, 0.8); - margin: 0; +/* 协议链接样式 */ +.register-card a { + cursor: pointer !important; } /* 响应式 */ -@media (max-width: 992px) { - .register-container { - grid-template-columns: 1fr; - } - - .register-illustration { - display: none; - } - - .register-card { - padding: 40px 30px; - } -} - @media (max-width: 576px) { .register-card { - padding: 30px 20px; + padding: 40px 24px; } .register-header h1 { - font-size: 24px; + font-size: 22px; + } + + .logo-badge { + width: 48px; + height: 48px; + font-size: 16px; } } diff --git a/src/pages/User/Register.tsx b/src/pages/User/Register.tsx index 9127051..faa464b 100644 --- a/src/pages/User/Register.tsx +++ b/src/pages/User/Register.tsx @@ -4,7 +4,7 @@ import React, { useState } from 'react' import { Form, Input, Button, message, Checkbox } from 'antd' -import { UserOutlined, LockOutlined, MailOutlined, PhoneOutlined } from '@ant-design/icons' +import { UserOutlined, LockOutlined, MailOutlined } from '@ant-design/icons' import { Link, useNavigate } from 'react-router-dom' import { useUserStore } from '@store/useUserStore' import './Register.css' @@ -17,7 +17,6 @@ const Register: React.FC = () => { const onFinish = async (values: { username: string email: string - phone: string password: string agree: boolean }) => { @@ -29,10 +28,11 @@ const Register: React.FC = () => { setLoading(true) try { await register(values.username, values.email, values.password) - message.success('注册成功,欢迎加入非遗文化传承平台') + message.success('注册成功,欢迎加入非遗文化传承平台!') navigate('/') } catch (error) { - message.error('注册失败,请稍后重试') + const err = error as Error + message.error(err.message || '注册失败,请稍后重试') } finally { setLoading(false) } @@ -43,6 +43,7 @@ const Register: React.FC = () => {
+
非遗

加入我们

开启您的非遗文化传承之旅

@@ -74,16 +75,6 @@ const Register: React.FC = () => { } placeholder="邮箱" /> - - } placeholder="手机号" /> - - { + value ? Promise.resolve() : Promise.reject(new Error('请同意用户协议')), + }, + ]} > 我已阅读并同意 @@ -135,30 +132,6 @@ const Register: React.FC = () => { 已有账号?立即登录
- -
-
-

探索非遗之美

-

与千万用户一起,传承中华优秀传统文化

-
-
-
📚
-

在线学习

-

海量非遗课程,随时随地学习

-
-
-
👥
-

名师指导

-

跟随传承人学习传统技艺

-
-
-
🏆
-

获得认证

-

完成学习获得专业证书

-
-
-
-
)