重构用户页面UI和交互体验
- 优化登录页面布局和表单样式,提升视觉层次感 - 简化注册页面代码逻辑,移除冗余字段和验证 - 重构个人中心页面,改进信息展示和编辑功能 - 统一表单组件样式规范,增强品牌一致性 - 完善移动端适配,优化小屏幕下的用户体验 - 优化按钮和输入框交互反馈,提升可用性
This commit is contained in:
parent
8c10fc53e7
commit
b8fe29d5ba
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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 = () => {
|
||||
<div className="user-center-page">
|
||||
<div className="page-header">
|
||||
<div className="container">
|
||||
<Row gutter={[24, 24]}>
|
||||
<Col xs={24} md={8}>
|
||||
<div className="user-profile">
|
||||
<div className="user-profile-card">
|
||||
<div className="user-profile-header">
|
||||
<div className="user-avatar-wrapper">
|
||||
<Avatar size={100} src={user.avatar} icon={<UserOutlined />} />
|
||||
</div>
|
||||
<div className="user-info-content">
|
||||
<h2>{user.username}</h2>
|
||||
<p className="user-email">{user.email}</p>
|
||||
<div className="user-actions">
|
||||
<Button icon={<EditOutlined />}>编辑资料</Button>
|
||||
<Button onClick={handleLogout}>退出登录</Button>
|
||||
</div>
|
||||
<p className="user-email">
|
||||
<MailOutlined />
|
||||
{user.email}
|
||||
</p>
|
||||
</div>
|
||||
</Col>
|
||||
<Col xs={24} md={16}>
|
||||
<div className="user-stats">
|
||||
<Statistic
|
||||
title="收藏数"
|
||||
value={user.favorites.length}
|
||||
prefix={<HeartOutlined />}
|
||||
/>
|
||||
<Statistic
|
||||
title="评论数"
|
||||
value={0}
|
||||
prefix={<CommentOutlined />}
|
||||
/>
|
||||
<div className="user-actions">
|
||||
<Button icon={<EditOutlined />}>编辑资料</Button>
|
||||
</div>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
|
||||
<div className="user-stats">
|
||||
<div className="stat-item">
|
||||
<HeartOutlined className="stat-icon" />
|
||||
<div className="stat-value">{user.favorites.length}</div>
|
||||
<div className="stat-label">收藏数</div>
|
||||
</div>
|
||||
<div className="stat-item">
|
||||
<CommentOutlined className="stat-icon" />
|
||||
<div className="stat-value">0</div>
|
||||
<div className="stat-label">评论数</div>
|
||||
</div>
|
||||
<div className="stat-item">
|
||||
<ClockCircleOutlined className="stat-icon" />
|
||||
<div className="stat-value">0</div>
|
||||
<div className="stat-label">学习时长(小时)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 = () => {
|
||||
<div className="login-container">
|
||||
<div className="login-card">
|
||||
<div className="login-header">
|
||||
<div className="logo-badge">非遗</div>
|
||||
<h1>欢迎回来</h1>
|
||||
<p>登录以继续您的非遗文化之旅</p>
|
||||
</div>
|
||||
@ -56,14 +57,6 @@ const Login: React.FC = () => {
|
||||
<Input.Password prefix={<LockOutlined />} placeholder="密码" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item>
|
||||
<div className="login-options">
|
||||
<Link to="/forgot-password" className="forgot-link">
|
||||
忘记密码?
|
||||
</Link>
|
||||
</div>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item>
|
||||
<Button type="primary" htmlType="submit" block loading={loading}>
|
||||
登录
|
||||
@ -71,34 +64,10 @@ const Login: React.FC = () => {
|
||||
</Form.Item>
|
||||
</Form>
|
||||
|
||||
<Divider plain>其他登录方式</Divider>
|
||||
|
||||
<div className="social-login">
|
||||
<Button icon={<WechatOutlined />} className="social-btn wechat">
|
||||
微信登录
|
||||
</Button>
|
||||
<Button icon={<AlipayOutlined />} className="social-btn alipay">
|
||||
支付宝登录
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="register-link">
|
||||
还没有账号?<Link to="/register">立即注册</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="login-illustration">
|
||||
<div className="illustration-content">
|
||||
<h2>传承非遗文化</h2>
|
||||
<p>探索中华文化瑰宝,传承千年技艺精髓</p>
|
||||
<div className="illustration-image">
|
||||
<img
|
||||
src="https://images.unsplash.com/photo-1547618707-5e8b2c1f0f7c?w=600"
|
||||
alt="传统文化"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 = () => {
|
||||
<div className="register-container">
|
||||
<div className="register-card">
|
||||
<div className="register-header">
|
||||
<div className="logo-badge">非遗</div>
|
||||
<h1>加入我们</h1>
|
||||
<p>开启您的非遗文化传承之旅</p>
|
||||
</div>
|
||||
@ -74,16 +75,6 @@ const Register: React.FC = () => {
|
||||
<Input prefix={<MailOutlined />} placeholder="邮箱" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="phone"
|
||||
rules={[
|
||||
{ required: true, message: '请输入手机号' },
|
||||
{ pattern: /^1[3-9]\d{9}$/, message: '请输入有效的手机号' },
|
||||
]}
|
||||
>
|
||||
<Input prefix={<PhoneOutlined />} placeholder="手机号" />
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
name="password"
|
||||
rules={[
|
||||
@ -115,6 +106,12 @@ const Register: React.FC = () => {
|
||||
<Form.Item
|
||||
name="agree"
|
||||
valuePropName="checked"
|
||||
rules={[
|
||||
{
|
||||
validator: (_, value) =>
|
||||
value ? Promise.resolve() : Promise.reject(new Error('请同意用户协议')),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Checkbox>
|
||||
我已阅读并同意
|
||||
@ -135,30 +132,6 @@ const Register: React.FC = () => {
|
||||
已有账号?<Link to="/login">立即登录</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="register-illustration">
|
||||
<div className="illustration-content">
|
||||
<h2>探索非遗之美</h2>
|
||||
<p>与千万用户一起,传承中华优秀传统文化</p>
|
||||
<div className="feature-list">
|
||||
<div className="feature-item">
|
||||
<div className="feature-icon">📚</div>
|
||||
<h3>在线学习</h3>
|
||||
<p>海量非遗课程,随时随地学习</p>
|
||||
</div>
|
||||
<div className="feature-item">
|
||||
<div className="feature-icon">👥</div>
|
||||
<h3>名师指导</h3>
|
||||
<p>跟随传承人学习传统技艺</p>
|
||||
</div>
|
||||
<div className="feature-item">
|
||||
<div className="feature-icon">🏆</div>
|
||||
<h3>获得认证</h3>
|
||||
<p>完成学习获得专业证书</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user