You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
2.5 KiB
52 lines
2.5 KiB
{% extends "base.html" %}
|
|
{% block title %}查看邮件 - 邮件系统{% endblock %}
|
|
{% block content %}
|
|
<div class="main-layout">
|
|
<div class="sidebar">
|
|
<a href="{{ url_for('inbox') }}">📥 收件箱</a>
|
|
<a href="{{ url_for('starred') }}">⭐ 星标邮件</a>
|
|
<a href="{{ url_for('sent') }}">📤 已发送</a>
|
|
<a href="{{ url_for('drafts') }}">📝 草稿箱</a>
|
|
<a href="{{ url_for('contacts') }}">📇 通讯录</a>
|
|
<a href="{{ url_for('compose') }}">✏️ 写邮件</a>
|
|
</div>
|
|
<div class="main-content">
|
|
<div class="card">
|
|
<div style="margin-bottom: 1rem; display: flex; align-items: center; gap: 1rem;">
|
|
<a href="{{ url_for('inbox') }}" class="btn btn-secondary">← 返回</a>
|
|
{% if email.recipient_id == current_user.id %}
|
|
<button id="starBtn" class="star-btn-large {% if email.is_starred %}starred{% endif %}"
|
|
onclick="toggleStar({{ email.id }})" title="{{ '取消星标' if email.is_starred else '添加星标' }}">
|
|
{{ '⭐' if email.is_starred else '☆' }} {{ '已星标' if email.is_starred else '添加星标' }}
|
|
</button>
|
|
{% endif %}
|
|
</div>
|
|
<h2 style="margin-bottom: 0.5rem;">{{ email.subject or '(无主题)' }}</h2>
|
|
<div style="color: #6b7280; margin-bottom: 1rem; font-size: 0.9rem;">
|
|
<div>发件人: {{ email.sender_address }}</div>
|
|
<div>收件人: {{ email.recipient_address }}</div>
|
|
<div>时间: {{ email.created_at.strftime('%Y-%m-%d %H:%M:%S') }}</div>
|
|
</div>
|
|
<hr style="margin: 1rem 0; border: none; border-top: 1px solid #e5e7eb;">
|
|
<div style="white-space: pre-wrap; line-height: 1.6;">{{ email.body }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
function toggleStar(emailId) {
|
|
fetch('/email/' + emailId + '/star', {
|
|
method: 'POST',
|
|
headers: { 'X-Requested-With': 'XMLHttpRequest' }
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
const btn = document.getElementById('starBtn');
|
|
btn.innerHTML = data.is_starred ? '⭐ 已星标' : '☆ 添加星标';
|
|
btn.classList.toggle('starred', data.is_starred);
|
|
btn.title = data.is_starred ? '取消星标' : '添加星标';
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
{% endblock %} |