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,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() }}