Files
LZGZ-Ph-LT/templates/profile.html

87 lines
3.3 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ user.username }} - 泸州高中摄影社论坛{% endblock %}
{% block content %}
<div class="container profile-container">
<!-- Profile Header -->
<div class="profile-header">
<div class="profile-avatar-large">
{{ user.username[0].upper() }}
</div>
<div class="profile-info">
<h1 class="profile-username">{{ user.username }}</h1>
{% if not user.is_approved %}
<div class="badge badge-warning">等待审核</div>
{% endif %}
<div class="profile-stats">
<div class="stat-item">
<span class="stat-number">{{ posts|length }}</span>
<span class="stat-label">作品</span>
</div>
<div class="stat-item">
<a href="{{ url_for('users.followers', username=user.username) }}">
<span class="stat-number">{{ follower_count }}</span>
<span class="stat-label">粉丝</span>
</a>
</div>
<div class="stat-item">
<a href="{{ url_for('users.following', username=user.username) }}">
<span class="stat-number">{{ following_count }}</span>
<span class="stat-label">关注</span>
</a>
</div>
</div>
{% if user.bio %}
<p class="profile-bio">{{ user.bio }}</p>
{% endif %}
<!-- Follow Button -->
{% if current_user.is_authenticated and current_user.id != user.id %}
{% if is_following %}
<form method="POST" action="{{ url_for('users.unfollow', username=user.username) }}"
style="display: inline;">
<button type="submit" class="btn btn-secondary">已关注</button>
</form>
{% else %}
<form method="POST" action="{{ url_for('users.follow', username=user.username) }}" style="display: inline;">
<button type="submit" class="btn btn-primary">关注</button>
</form>
{% endif %}
{% endif %}
</div>
</div>
<!-- User Posts -->
<div class="profile-posts">
<h2 class="section-title">📸 作品集</h2>
{% if posts %}
<div class="posts-grid">
{% for post in posts %}
<div class="post-card">
<a href="{{ url_for('posts.post_detail', post_id=post.id) }}" class="post-image-link">
<img src="{{ url_for('uploaded_file', filename=post.image_path) }}" alt="Post image"
class="post-image" loading="lazy">
{% if not post.is_approved %}
<div class="badge badge-overlay">审核中</div>
{% endif %}
</a>
<div class="post-footer">
<span class="comment-count">💬 {{ post.get_comment_count() }}</span>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="empty-state">
<div class="empty-icon">📷</div>
<p>该用户还没有发布作品</p>
</div>
{% endif %}
</div>
</div>
{% endblock %}