fix(ui): shrink badges, card_number format XX-1234567, date-only fields

This commit is contained in:
2026-07-05 16:26:22 +08:00
parent 4ad37a71f7
commit e66515ce72
4 changed files with 18 additions and 12 deletions

View File

@@ -5,8 +5,8 @@
<h1>{{ '编辑' if postcard else '新建' }}明信片</h1>
</div>
<form method="post" action="{{ '/postcards/%d/edit' % postcard.id if postcard else '/profiles/%d/postcards' % profile.id }}" class="form-card">
<label>编号 *</label>
<input type="text" name="card_number" value="{{ postcard.card_number if postcard else '' }}" required>
<label>编号 * <span style="font-weight:400;color:var(--text-muted);font-size:.8rem">格式AB-1234567</span></label>
<input type="text" name="card_number" value="{{ postcard.card_number if postcard else '' }}" required pattern="[A-Za-z]{2}-\d{7}" title="两个字母 + 短横线 + 7位数字如 AB-1234567">
<label>状态 *</label>
<select name="status" id="status-select" onchange="toggleFields()">
@@ -21,16 +21,16 @@
<label>国家/地区</label>
<input type="text" name="country" value="{{ postcard.country if postcard else '' }}">
<label>寄出时间</label>
<input type="datetime-local" name="send_time" value="{{ postcard.send_time.strftime('%Y-%m-%dT%H:%M') if postcard and postcard.send_time else '' }}">
<input type="date" name="send_time" value="{{ postcard.send_time.strftime('%Y-%m-%d') if postcard and postcard.send_time else '' }}">
<label>到达时间</label>
<input type="datetime-local" name="arrival_time" value="{{ postcard.arrival_time.strftime('%Y-%m-%dT%H:%M') if postcard and postcard.arrival_time else '' }}">
<input type="date" name="arrival_time" value="{{ postcard.arrival_time.strftime('%Y-%m-%d') if postcard and postcard.arrival_time else '' }}">
</div>
<div id="fields-received" style="display:none">
<label>发件人</label>
<input type="text" name="sender_name" value="{{ postcard.sender_name if postcard else '' }}">
<label>收到时间</label>
<input type="datetime-local" name="receive_time" value="{{ postcard.receive_time.strftime('%Y-%m-%dT%H:%M') if postcard and postcard.receive_time else '' }}">
<input type="date" name="receive_time" value="{{ postcard.receive_time.strftime('%Y-%m-%d') if postcard and postcard.receive_time else '' }}">
</div>
<div class="form-actions">