feat: 优化代码结构

This commit is contained in:
DengDai
2025-11-24 13:40:58 +08:00
parent aa516a8d71
commit 148fc78014
8 changed files with 69 additions and 261 deletions

View File

@@ -11,7 +11,7 @@
<div class="card-body">
<ul class="list-group list-group-flush">
<li class="list-group-item"><strong>被举报邮箱:</strong> {{ report.reported_email }}</li>
<li class="list-group-item"><strong>被举报用户名:</strong> {{ report.reported_uid or 'N/A' }}</li>
<li class="list-group-item"><strong>被举报用户名:</strong> {{ report.reported_username or 'N/A' }}</li>
<li class="list-group-item"><strong>所属站点:</strong> {{ report.reported_pt_site }}</li>
<li class="list-group-item"><strong>举报理由:</strong> {{ report.reason_category }}</li>
<li class="list-group-item"><strong>举报人:</strong> {{ report.reporter.username }}</li>
@@ -69,7 +69,7 @@
<div class="p-2 bg-light rounded">
<p class="small mb-0">{{ comment.body | safe }}</p>
</div>
<small class="text-muted">{{ comment.timestamp.strftime('%Y-%m-%d %H:%M') }}</small>
<small class="text-muted">{{ comment.created_at.strftime('%Y-%m-%d %H:%M') }}</small>
</div>
</div>
{% else %}

View File

@@ -11,9 +11,9 @@
<div class="card-body">
<p><strong>申诉ID:</strong> #{{ appeal.id }}</p>
<p><strong>申诉人:</strong> {{ appeal.appealer.username }}</p>
<p><strong>状态:</strong>
<span class="badge
{% if 'closed' in appeal.status %} bg-secondary
<p><strong>状态:</strong>
<span class="badge
{% if appeal.status in ['approved', 'rejected'] %} bg-secondary
{% elif 'user' in appeal.status %} bg-warning text-dark
{% else %} bg-info text-dark {% endif %}">
{{ appeal.status }}
@@ -26,7 +26,7 @@
</div>
</div>
{% if current_user.role=='admin' and appeal.status not in ['closed_approved', 'closed_rejected'] %}
{% if current_user.role=='admin' and appeal.status not in ['approved', 'rejected'] %}
<div class="card shadow-sm mb-4">
<div class="card-header"><h5 class="mb-0">管理员操作</h5></div>
<div class="card-body text-center d-grid gap-2">
@@ -64,12 +64,12 @@
{% for message in messages %}
<div class="message mb-3 {% if message.author_id == appeal.appealer_id %}user-message{% else %}admin-message{% endif %}">
<div class="message-header">
{% if message.author_id.role == 'admin' %}
<strong>{{ message.author_id.username }} (管理员)</strong>
<small>{{ message.timestamp.strftime('%Y-%m-%d %H:%M') }}</small>
{% if message.author.role == 'admin' %}
<strong>{{ message.author.username }} (管理员)</strong>
<small>{{ message.created_at.strftime('%Y-%m-%d %H:%M') }}</small>
{% else %}
<strong>{{ message.author_id.username }}</strong>
<small>{{ message.timestamp.strftime('%Y-%m-%d %H:%M') }}</small>
<strong>{{ message.author.username }}</strong>
<small>{{ message.created_at.strftime('%Y-%m-%d %H:%M') }}</small>
{% endif %}
</div>
<div class="message-body">
@@ -79,7 +79,7 @@
{% endfor %}
</div>
{% if appeal.status not in ['closed_approved', 'closed_rejected'] %}
{% if appeal.status not in ['approved', 'rejected'] %}
<div class="card-footer">
<form method="POST">
{{ form.hidden_tag() }}

View File

@@ -21,9 +21,9 @@
{% for error in form.reported_pt_site.errors %}<div class="invalid-feedback d-block">{{ error }}</div>{% endfor %}
</div>
<div class="col-md-6 mb-3">
{{ form.reported_uid.label(class="form-label") }}
{{ form.reported_uid(class="form-control") }}
{% for error in form.reported_uid.errors %}<div class="invalid-feedback d-block">{{ error }}</div>{% endfor %}
{{ form.reported_username.label(class="form-label") }}
{{ form.reported_username(class="form-control") }}
{% for error in form.reported_username.errors %}<div class="invalid-feedback d-block">{{ error }}</div>{% endfor %}
</div>
</div>
<div class="mb-3">