<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>个人资料 - QSZ</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
<style>
:root {
--primary-color: #3b82f6;
--secondary-color: #60a5fa;
--text-color: #1f2937;
--bg-color: #f3f4f6;
--white: #ffffff;
--border-color: #e5e7eb;
--success-color: #10b981;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background-color: var(--bg-color);
color: var(--text-color);
line-height: 1.6;
}
.container {
max-width: 1000px;
margin: 2rem auto;
padding: 0 1rem;
}
.profile-header {
background: var(--white);
border-radius: 1rem;
padding: 2rem;
margin-bottom: 2rem;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
display: flex;
align-items: center;
gap: 2rem;
}
.avatar-section {
position: relative;
}
.avatar {
width: 120px;
height: 120px;
border-radius: 50%;
object-fit: cover;
border: 4px solid var(--white);
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.avatar-upload {
position: absolute;
bottom: 0;
right: 0;
background: var(--primary-color);
color: var(--white);
width: 32px;
height: 32px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background-color 0.3s ease;
}
.avatar-upload:hover {
background: var(--secondary-color);
}
.avatar-upload input {
display: none;
}
.profile-info h1 {
font-size: 1.8rem;
margin-bottom: 0.5rem;
}
.profile-info p {
color: #6b7280;
}
.profile-stats {
display: flex;
gap: 2rem;
margin-top: 1rem;
}
.stat-item {
text-align: center;
}
.stat-value {
font-size: 1.2rem;
font-weight: 600;
color: var(--primary-color);
}
.stat-label {
font-size: 0.875rem;
color: #6b7280;
}
.profile-content {
display: grid;
grid-template-columns: 1fr 3fr;
gap: 2rem;
}
.profile-nav {
background: var(--white);
border-radius: 1rem;
padding: 1.5rem;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.nav-item {
display: flex;
align-items: center;
gap: 1rem;
padding: 1rem;
color: var(--text-color);
text-decoration: none;
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.nav-item:hover,
.nav-item.active {
background: var(--bg-color);
color: var(--primary-color);
}
.nav-item i {
width: 20px;
}
.profile-form {
background: var(--white);
border-radius: 1rem;
padding: 2rem;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.form-section {
margin-bottom: 2rem;
}
.form-section h2 {
font-size: 1.2rem;
margin-bottom: 1.5rem;
padding-bottom: 0.5rem;
border-bottom: 1px solid var(--border-color);
}
.form-group {
margin-bottom: 1.5rem;
}
.form-group label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
}
.form-group input,
.form-group textarea {
width: 100%;
padding: 0.75rem 1rem;
border: 1px solid var(--border-color);
border-radius: 0.5rem;
font-size: 1rem;
transition: all 0.3s ease;
}
.form-group input:focus,
.form-group textarea:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-row {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1.5rem;
}
.btn {
padding: 0.75rem 1.5rem;
border: none;
border-radius: 0.5rem;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: background-color 0.3s ease;
}
.btn-primary {
background: var(--primary-color);
color: var(--white);
}
.btn-primary:hover {
background: var(--secondary-color);
}
.btn-outline {
background: transparent;
border: 1px solid var(--border-color);
color: var(--text-color);
}
.btn-outline:hover {
background: var(--bg-color);
}
.form-actions {
display: flex;
justify-content: flex-end;
gap: 1rem;
margin-top: 2rem;
}
.social-links {
display: grid;
gap: 1rem;
}
.social-link {
display: flex;
align-items: center;
gap: 1rem;
padding: 0.75rem 1rem;
border: 1px solid var(--border-color);
border-radius: 0.5rem;
color: var(--text-color);
text-decoration: none;
transition: all 0.3s ease;
}
.social-link:hover {
background: var(--bg-color);
border-color: var(--primary-color);
}
.social-link i {
font-size: 1.25rem;
}
@media (max-width: 768px) {
.profile-content {
grid-template-columns: 1fr;
}
.form-row {
grid-template-columns: 1fr;
}
.profile-header {
flex-direction: column;
text-align: center;
}
.profile-stats {
justify-content: center;
}
}
</style>
</head>
<body>
<div class="container">
<div class="profile-header">
<div class="avatar-section">
<img src="https://via.placeholder.com/120" alt="用户头像" class="avatar">
<label class="avatar-upload">
<i class="fas fa-camera"></i>
<input type="file" accept="image/*">
</label>
</div>
<div class="profile-info">
<h1>北边村的富少</h1>
<p>前端开发工程师</p>
<div class="profile-stats">
<div class="stat-item">
<div class="stat-value">125</div>
<div class="stat-label">文章</div>
</div>
<div class="stat-item">
<div class="stat-value">12.5k</div>
<div class="stat-label">粉丝</div>
</div>
<div class="stat-item">
<div class="stat-value">89</div>
<div class="stat-label">收藏</div>
</div>
</div>
</div>
</div>
<div class="profile-content">
<nav class="profile-nav">
<a href="#" class="nav-item active">
<i class="fas fa-user"></i>
个人资料
</a>
<a href="#" class="nav-item">
<i class="fas fa-lock"></i>
账号安全
</a>
<a href="#" class="nav-item">
<i class="fas fa-bell"></i>
消息通知
</a>
<a href="#" class="nav-item">
<i class="fas fa-palette"></i>
个性化设置
</a>
</nav>
<div class="profile-form">
<form id="profileForm">
<div class="form-section">
<h2>基本信息</h2>
<div class="form-row">
<div class="form-group">
<label for="nickname">昵称</label>
<input type="text" id="nickname" value="北边村的富少">
</div>
<div class="form-group">
<label for="email">邮箱</label>
<input type="email" id="email" value="[email protected]">
</div>
</div>
<div class="form-group">
<label for="bio">个人简介</label>
<textarea id="bio" rows="4">热爱前端开发,分享学习经验和技术心得。</textarea>
</div>
</div>
<div class="form-section">
<h2>社交账号</h2>
<div class="social-links">
<a href="#" class="social-link">
<i class="fab fa-github"></i>
绑定 GitHub 账号
</a>
<a href="#" class="social-link">
<i class="fab fa-weixin"></i>
绑定微信账号
</a>
<a href="#" class="social-link">
<i class="fab fa-qq"></i>
绑定 QQ 账号
</a>
</div>
</div>
<div class="form-section">
<h2>联系方式</h2>
<div class="form-row">
<div class="form-group">
<label for="phone">手机号码</label>
<input type="tel" id="phone" placeholder="请输入手机号码">
</div>
<div class="form-group">
<label for="location">所在地</label>
<input type="text" id="location" placeholder="请输入所在地">
</div>
</div>
</div>
<div class="form-actions">
<button type="button" class="btn btn-outline">取消</button>
<button type="submit" class="btn btn-primary">保存更改</button>
</div>
</form>
</div>
</div>
</div>
<script>
// 头像上传预览
document.querySelector('.avatar-upload input').addEventListener('change', function(e) {
if (e.target.files && e.target.files[0]) {
const reader = new FileReader();
reader.onload = function(e) {
document.querySelector('.avatar').src = e.target.result;
}
reader.readAsDataURL(e.target.files[0]);
}
});
// 表单提交
document.getElementById('profileForm').addEventListener('submit', function(e) {
e.preventDefault();
// 这里添加表单提交逻辑
alert('个人资料更新成功!');
});
</script>
</body>
</html>
标签:个人资料,color,用户,--,background,rem,var,border,页面 From: https://www.cnblogs.com/qsz666/p/18552531