Files
vps_web/templates/forum/profile.html
ddrwode 4210e0d70a 哈哈
2026-02-10 17:54:22 +08:00

235 lines
16 KiB
HTML

<!DOCTYPE html>
<html lang="{{ 'zh-CN' if lang == 'zh' else 'en' }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex,follow">
<title>{{ l('个人中心', 'Profile') }} - {{ l('论坛', 'Forum') }}</title>
<link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='img/site-logo-mark.svg') }}">
<link rel="stylesheet" href="/static/css/style.css">
<link rel="stylesheet" href="/static/css/forum.css">
</head>
<body class="forum-page">
<header class="forum-header">
<div class="forum-header-inner">
<div class="forum-header-left">
<a href="{{ url_for('forum_index') }}" class="forum-logo">
<img src="{{ url_for('static', filename='img/site-logo-mark.svg') }}" alt="{{ l('云价眼 Logo', 'VPS Price Logo') }}">
<span>{{ l('云价眼论坛', 'VPS Price Forum') }}</span>
</a>
<nav class="forum-primary-nav">
<a href="{{ url_for('forum_index') }}">{{ l('最新', 'Latest') }}</a>
<a href="{{ url_for('index') }}">{{ l('价格表', 'Pricing') }}</a>
<a href="{{ url_for('user_profile') }}" class="active">{{ l('个人中心', 'Profile') }}</a>
<a href="{{ url_for('user_notifications') }}" class="nav-link-with-badge">{{ l('通知', 'Notifications') }}{% if notifications_unread_count %}<span class="nav-badge">{{ notifications_unread_count }}</span>{% endif %}</a>
</nav>
</div>
<div class="forum-header-right">
<span class="lang-switch">
<a href="{{ lang_url('zh') }}" class="{{ 'active' if lang == 'zh' else '' }}" title="切换到中文">中文</a>
<span class="lang-sep">|</span>
<a href="{{ lang_url('en') }}" class="{{ 'active' if lang == 'en' else '' }}" title="Switch to English">English</a>
</span>
<span class="forum-user-chip">{{ profile_user.username }}</span>
<a href="{{ url_for('user_logout') }}" class="forum-link">{{ l('退出', 'Logout') }}</a>
</div>
</div>
</header>
<main class="forum-shell">
<section class="profile-layout">
<div class="profile-main">
<article class="topic-post-card profile-summary">
<h1>{{ l('个人中心', 'Profile') }}</h1>
<p class="editor-subtitle">{{ l('管理你的帖子、评论和账号设置。', 'Manage your topics, comments, and account settings.') }}</p>
<div class="profile-stat-grid">
<div><span>{{ l('帖子', 'Posts') }}</span><strong>{{ stats.post_count }}</strong></div>
<div><span>{{ l('评论', 'Comments') }}</span><strong>{{ stats.comment_count }}</strong></div>
<div><span>{{ l('点赞', 'Likes') }}</span><strong>{{ stats.like_count }}</strong></div>
<div><span>{{ l('收藏', 'Bookmarks') }}</span><strong>{{ stats.bookmark_count }}</strong></div>
<div><span>{{ l('举报', 'Reports') }}</span><strong>{{ stats.report_count }}</strong></div>
<div><span>{{ l('待处理举报', 'Pending Reports') }}</span><strong>{{ stats.pending_report_count }}</strong></div>
<div><span>{{ l('通知', 'Notifications') }}</span><strong>{{ stats.notification_count }}</strong></div>
<div><span>{{ l('未读通知', 'Unread') }}</span><strong>{{ stats.unread_notification_count }}</strong></div>
</div>
</article>
<section class="topic-post-card">
<div class="forum-tabs profile-tabs">
<a href="{{ url_for('user_profile', tab='posts') }}" class="{{ 'active' if active_tab == 'posts' else '' }}">{{ l('我的帖子', 'My Posts') }}</a>
<a href="{{ url_for('user_profile', tab='comments') }}" class="{{ 'active' if active_tab == 'comments' else '' }}">{{ l('我的评论', 'My Comments') }}</a>
<a href="{{ url_for('user_profile', tab='likes') }}" class="{{ 'active' if active_tab == 'likes' else '' }}">{{ l('我的点赞', 'My Likes') }}</a>
<a href="{{ url_for('user_profile', tab='bookmarks') }}" class="{{ 'active' if active_tab == 'bookmarks' else '' }}">{{ l('我的收藏', 'My Bookmarks') }}</a>
<a href="{{ url_for('user_profile', tab='settings') }}" class="{{ 'active' if active_tab == 'settings' else '' }}">{{ l('账号设置', 'Settings') }}</a>
</div>
{% if message %}
<p class="form-success">{{ message }}</p>
{% endif %}
{% if error %}
<p class="form-error">{{ error }}</p>
{% endif %}
{% if active_tab == 'posts' %}
{% if my_post_cards %}
<ul class="profile-list">
{% for item in my_post_cards %}
{% set post = item.post %}
<li class="profile-row">
<div class="profile-row-main">
<a href="{{ url_for('forum_post_detail', post_id=post.id) }}" class="topic-title">{{ post.title }}</a>
<div class="topic-meta">
<span class="topic-category">{{ post.category or l('综合讨论', 'General') }}</span>
<span>{{ l('创建:', 'Created: ') }}{{ post.created_at.strftime('%Y-%m-%d %H:%M') if post.created_at else '' }}</span>
<span>{{ l('回复', 'Replies') }} {{ item.reply_count }}</span>
<span>{{ l('浏览', 'Views') }} {{ item.view_count }}</span>
</div>
</div>
<div class="profile-row-actions">
<a href="{{ url_for('forum_post_edit', post_id=post.id) }}">{{ l('编辑', 'Edit') }}</a>
<form method="post" action="{{ url_for('forum_post_delete', post_id=post.id) }}" onsubmit="return confirm('{{ l('确定删除该帖子?', 'Delete this topic?') }}');">
<button type="submit" class="btn-link-delete">{{ l('删除', 'Delete') }}</button>
</form>
</div>
</li>
{% endfor %}
</ul>
{% else %}
<p class="topic-empty">{{ l('你还没有发过帖子,先去', 'You have not posted yet. Go') }} <a href="{{ url_for('forum_post_new') }}">{{ l('发布主题', 'create one') }}</a>{{ l('吧。', '.') }}</p>
{% endif %}
{% elif active_tab == 'comments' %}
{% if my_comment_items %}
<ul class="profile-list">
{% for item in my_comment_items %}
{% set c = item.comment %}
<li class="profile-row">
<div class="profile-row-main">
<a href="{{ url_for('forum_post_detail', post_id=item.post_id) }}" class="topic-title">{{ item.post_title or l('帖子已删除', 'Deleted topic') }}</a>
<div class="topic-meta">
<span>{{ l('评论时间:', 'Commented: ') }}{{ c.created_at.strftime('%Y-%m-%d %H:%M') if c.created_at else '' }}</span>
</div>
<div class="comment-content md-content">{{ c.content|markdown_html }}</div>
</div>
<div class="profile-row-actions">
<a href="{{ url_for('forum_comment_edit', comment_id=c.id) }}">{{ l('编辑', 'Edit') }}</a>
<form method="post" action="{{ url_for('forum_comment_delete', comment_id=c.id) }}" onsubmit="return confirm('{{ l('确定删除这条评论?', 'Delete this comment?') }}');">
<button type="submit" class="btn-link-delete">{{ l('删除', 'Delete') }}</button>
</form>
</div>
</li>
{% endfor %}
</ul>
{% else %}
<p class="topic-empty">{{ l('你还没有评论记录。', 'No comments yet.') }}</p>
{% endif %}
{% elif active_tab == 'likes' %}
{% if my_like_items %}
<ul class="profile-list">
{% for item in my_like_items %}
<li class="profile-row">
<div class="profile-row-main">
<a href="{{ url_for('forum_post_detail', post_id=item.post_id) }}" class="topic-title">{{ item.post_title }}</a>
<div class="topic-meta">
<span class="topic-category">{{ item.post_category or l('综合讨论', 'General') }}</span>
<span>{{ l('帖子创建:', 'Post created: ') }}{{ item.post_created_at.strftime('%Y-%m-%d %H:%M') if item.post_created_at else '' }}</span>
<span>{{ l('点赞时间:', 'Liked at: ') }}{{ item.like.created_at.strftime('%Y-%m-%d %H:%M') if item.like.created_at else '' }}</span>
</div>
</div>
<div class="profile-row-actions">
<form method="post" action="{{ url_for('forum_post_like_toggle', post_id=item.post_id) }}">
<input type="hidden" name="next" value="{{ url_for('user_profile', tab='likes', msg=l('已取消点赞', 'Like removed')) }}">
<button type="submit" class="btn-link-delete">{{ l('取消点赞', 'Remove Like') }}</button>
</form>
</div>
</li>
{% endfor %}
</ul>
{% else %}
<p class="topic-empty">{{ l('你还没有点赞任何帖子。', 'You have not liked any topics yet.') }}</p>
{% endif %}
{% elif active_tab == 'bookmarks' %}
{% if my_bookmark_items %}
<ul class="profile-list">
{% for item in my_bookmark_items %}
<li class="profile-row">
<div class="profile-row-main">
<a href="{{ url_for('forum_post_detail', post_id=item.post_id) }}" class="topic-title">{{ item.post_title }}</a>
<div class="topic-meta">
<span class="topic-category">{{ item.post_category or l('综合讨论', 'General') }}</span>
<span>{{ l('帖子创建:', 'Post created: ') }}{{ item.post_created_at.strftime('%Y-%m-%d %H:%M') if item.post_created_at else '' }}</span>
<span>{{ l('收藏时间:', 'Bookmarked at: ') }}{{ item.bookmark.created_at.strftime('%Y-%m-%d %H:%M') if item.bookmark.created_at else '' }}</span>
</div>
</div>
<div class="profile-row-actions">
<form method="post" action="{{ url_for('forum_post_bookmark_toggle', post_id=item.post_id) }}">
<input type="hidden" name="next" value="{{ url_for('user_profile', tab='bookmarks', msg=l('已取消收藏', 'Bookmark removed')) }}">
<button type="submit" class="btn-link-delete">{{ l('取消收藏', 'Remove Bookmark') }}</button>
</form>
</div>
</li>
{% endfor %}
</ul>
{% else %}
<p class="topic-empty">{{ l('你还没有收藏任何帖子。', 'You have not bookmarked any topics yet.') }}</p>
{% endif %}
{% else %}
<div class="settings-grid">
<form method="post" action="{{ url_for('user_profile', tab='settings') }}" class="post-form">
<input type="hidden" name="action" value="profile">
<h3>{{ l('基础资料', 'Profile Info') }}</h3>
<div class="form-group">
<label for="username">{{ l('用户名', 'Username') }}</label>
<input id="username" name="username" type="text" required minlength="3" maxlength="20" value="{{ profile_user.username }}">
</div>
<div class="form-actions">
<button type="submit" class="forum-btn-primary">{{ l('保存资料', 'Save Profile') }}</button>
</div>
</form>
<form method="post" action="{{ url_for('user_profile', tab='settings') }}" class="post-form">
<input type="hidden" name="action" value="password">
<h3>{{ l('修改密码', 'Change Password') }}</h3>
<div class="form-group">
<label for="current_password">{{ l('当前密码', 'Current Password') }}</label>
<input id="current_password" name="current_password" type="password" required>
</div>
<div class="form-group">
<label for="new_password">{{ l('新密码', 'New Password') }}</label>
<input id="new_password" name="new_password" type="password" required minlength="6">
</div>
<div class="form-group">
<label for="confirm_password">{{ l('确认新密码', 'Confirm New Password') }}</label>
<input id="confirm_password" name="confirm_password" type="password" required minlength="6">
</div>
<div class="form-actions">
<button type="submit" class="forum-btn-primary">{{ l('更新密码', 'Update Password') }}</button>
</div>
</form>
</div>
{% endif %}
</section>
</div>
<aside class="forum-sidebar">
<div class="side-card">
<h3>{{ l('账号信息', 'Account Info') }}</h3>
<ul class="side-list">
<li><span>{{ l('用户名', 'Username') }}</span><strong>{{ profile_user.username }}</strong></li>
<li><span>{{ l('注册时间', 'Joined') }}</span><strong>{{ profile_user.created_at.strftime('%Y-%m-%d') if profile_user.created_at else '—' }}</strong></li>
<li><span>{{ l('最近登录', 'Last Login') }}</span><strong>{{ profile_user.last_login_at.strftime('%Y-%m-%d %H:%M') if profile_user.last_login_at else '—' }}</strong></li>
</ul>
</div>
<div class="side-card">
<h3>{{ l('快捷操作', 'Quick Actions') }}</h3>
<div class="form-actions">
<a href="{{ url_for('forum_post_new') }}" class="forum-btn-primary">{{ l('发布主题', 'New Topic') }}</a>
<a href="{{ url_for('user_notifications') }}" class="forum-btn-muted">{{ l('查看通知', 'View Notifications') }}</a>
<a href="{{ url_for('forum_index') }}" class="forum-btn-muted">{{ l('返回论坛', 'Back to Forum') }}</a>
</div>
</div>
</aside>
</section>
</main>
</body>
</html>