Files
pt_blacklist/app/templates/admin/report_detail.html
2025-11-24 21:25:38 +08:00

152 lines
8.0 KiB
HTML

{% extends "base.html" %}
{% block title %}举报详情 - #{{ report.id }}{% endblock %}
{% block content %}
<div class="row">
<!-- 左侧信息栏 -->
<div class="col-lg-5">
<div class="card shadow-sm mb-4">
<div class="card-header"><h4 class="mb-0">举报详情 #{{ report.id }}</h4></div>
<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_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 | translate_reason }}</li>
<li class="list-group-item"><strong>举报人:</strong> {{ report.reporter.username }}</li>
<li class="list-group-item"><strong>状态:</strong> <strong class="text-capitalize">{{ report.status | translate_status }}</strong></li>
<li class="list-group-item"><strong>详细描述:</strong><br><span style="white-space: pre-wrap;">{{ report.description }}</span></li>
</ul>
</div>
</div>
<div class="card shadow-sm mb-4">
<div class="card-header"><h5 class="mb-0">证据链接</h5></div>
<div class="list-group list-group-flush">
{% for evidence in report.evidences %}
<a href="{{ evidence.file_url }}" target="_blank" class="list-group-item list-group-item-action">
{{ evidence.file_url }}
</a>
{% else %}
<div class="list-group-item text-muted">未提供证据链接。</div>
{% endfor %}
</div>
</div>
{% if current_user.role in ['admin', 'trust_user'] %}
<div class="card shadow-sm mb-4">
<div class="card-header"><h5 class="mb-0">{% if current_user.role == 'admin' %}管理员操作{% else %}信任用户操作{% endif %}</h5></div>
<div class="card-body d-grid gap-2">
{% if current_user.role == 'admin' %}
{% if report.status == 'pending' or report.status == 'in_review' %}
<form action="{{ url_for('main.process_report', report_id=report.id) }}" method="POST" class="d-grid">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<input type="hidden" name="action" value="confirm">
<button type="submit" class="btn btn-success">确认违规 (加入黑名单)</button>
</form>
<form action="{{ url_for('main.process_report', report_id=report.id) }}" method="POST" class="d-grid">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<input type="hidden" name="action" value="invalidate">
<button type="submit" class="btn btn-warning">举报无效</button>
</form>
{% elif report.status == 'approved' %}
<button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#revokeModal">
撤销批准并移出黑名单
</button>
{% else %}
<p class="text-muted mb-0">该举报已处理完毕,无更多操作。</p>
{% endif %}
{% else %}
<p class="text-muted mb-0">您可以在下方添加审核建议。</p>
{% endif %}
</div>
</div>
{% endif %}
{% if current_user.role in ['admin'] and related_reports %}
<div class="card shadow-sm mb-4">
<div class="card-header"><h5 class="mb-0">相关举报 (同一邮箱)</h5></div>
<div class="list-group list-group-flush">
{% for r in related_reports %}
<a href="{{ url_for('main.report_detail', report_id=r.id) }}" class="list-group-item list-group-item-action">
<div class="d-flex justify-content-between">
<span><strong>#{{ r.id }}</strong> - {{ r.reason_category | translate_reason }}</span>
<span class="badge bg-secondary">{{ r.status | translate_status }}</span>
</div>
<small class="text-muted">{{ r.created_at.strftime('%Y-%m-%d') }} | 举报人: {{ r.reporter.username }}</small>
</a>
{% endfor %}
</div>
</div>
{% endif %}
</div>
<!-- 右侧评论区 -->
{% if current_user.role in ['admin', 'trust_user'] %}
<div class="col-lg-7">
<div class="card shadow-sm">
<div class="card-header"><h5 class="mb-0">审核与讨论</h5></div>
<div class="card-body" style="max-height: 500px; overflow-y: auto;">
{% for comment in comments %}
<div class="d-flex mb-3">
<div class="flex-shrink-0"><span class="badge rounded-pill bg-secondary">{{ comment.author.username }}</span></div>
<div class="flex-grow-1 ms-3">
<div class="p-2 bg-light rounded">
<p class="small mb-0">{{ comment.body | safe }}</p>
</div>
<small class="text-muted">{{ comment.created_at.strftime('%Y-%m-%d %H:%M') }}</small>
</div>
</div>
{% else %}
<p class="text-muted">暂无审核建议。</p>
{% endfor %}
</div>
{% if report.status == 'pending' or report.status == 'in_review' %}
<div class="card-footer">
<form method="POST">
{{ form.hidden_tag() }}
<div class="input-group">
{{ form.body(class="form-control", placeholder="提交审核建议...") }}
{{ form.submit(class="btn btn-outline-secondary") }}
</div>
</form>
</div>
{% else %}
<div class="card-footer text-center bg-light">
<p class="mb-0 text-muted">举报已处理,评论已关闭。</p>
</div>
{% endif %}
</div>
</div>
{% endif %}
</div>
<!-- 撤销操作的 Modal -->
<div class="modal fade" id="revokeModal" tabindex="-1" aria-labelledby="revokeModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="revokeModalLabel">撤销举报批准</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form action="{{ url_for('main.revoke_report', report_id=report.id) }}" method="POST">
<div class="modal-body">
{{ revoke_form.hidden_tag() }}
<p>你确定要撤销对举报 #{{ report.id }} 的批准吗?这将把相关用户从黑名单中移除。</p>
<div class="mb-3">
{{ revoke_form.reason.label(class="form-label") }}
{{ revoke_form.reason(class="form-control", rows=3) }}
{% for error in revoke_form.reason.errors %}<div class="invalid-feedback d-block">{{ error }}</div>{% endfor %}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
{{ revoke_form.submit(class="btn btn-danger") }}
</div>
</form>
</div>
</div>
</div>
{% endblock %}