diff --git a/app/routers/web.py b/app/routers/web.py index f410d41..7767853 100644 --- a/app/routers/web.py +++ b/app/routers/web.py @@ -199,7 +199,10 @@ def postcard_create( try: return datetime.fromisoformat(s) except ValueError: - return None + try: + return datetime.strptime(s, "%Y-%m-%d") + except ValueError: + return None pc = Postcard( profile_id=profile_id, @@ -274,7 +277,10 @@ def postcard_update( try: return datetime.fromisoformat(s) except ValueError: - return None + try: + return datetime.strptime(s, "%Y-%m-%d") + except ValueError: + return None pc.card_number = card_number pc.status = status diff --git a/app/static/style.css b/app/static/style.css index 3818ec3..83a2d3d 100644 --- a/app/static/style.css +++ b/app/static/style.css @@ -39,7 +39,7 @@ a:hover { text-decoration: underline; } /* Forms */ label { display: block; margin-top: 1rem; font-size: .85rem; font-weight: 500; color: var(--text-muted); } -input[type="text"], input[type="password"], input[type="datetime-local"], select, textarea { +input[type="text"], input[type="password"], input[type="datetime-local"], input[type="date"], select, textarea { width: 100%; padding: .5rem .75rem; margin-top: .25rem; border: 1px solid var(--border); border-radius: 6px; font-size: .95rem; background: #fff; } input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); } @@ -93,7 +93,7 @@ code { background: var(--bg); padding: .15rem .4rem; border-radius: 4px; font-si .postcard-info { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; } /* Badge */ -.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; color: #fff; } +.badge { display: inline-block; padding: .15rem .45rem; border-radius: 999px; font-size: .7rem; font-weight: 600; color: #fff; white-space: nowrap; } .badge-sent { background: var(--sent); } .badge-delivered { background: var(--delivered); } .badge-received { background: var(--received); } diff --git a/app/templates/postcard_detail.html b/app/templates/postcard_detail.html index 10b9ffc..c5ab866 100644 --- a/app/templates/postcard_detail.html +++ b/app/templates/postcard_detail.html @@ -45,11 +45,11 @@ {% if postcard.status in ('sent','delivered') %}
收件人
{{ postcard.recipient_name or '-' }}
国家/地区
{{ postcard.country or '-' }}
-
寄出时间
{{ postcard.send_time.strftime('%Y-%m-%d %H:%M') if postcard.send_time else '-' }}
-
到达时间
{{ postcard.arrival_time.strftime('%Y-%m-%d %H:%M') if postcard.arrival_time else '-' }}
+
寄出时间
{{ postcard.send_time.strftime('%Y-%m-%d') if postcard.send_time else '-' }}
+
到达时间
{{ postcard.arrival_time.strftime('%Y-%m-%d') if postcard.arrival_time else '-' }}
{% else %}
发件人
{{ postcard.sender_name or '-' }}
-
收到时间
{{ postcard.receive_time.strftime('%Y-%m-%d %H:%M') if postcard.receive_time else '-' }}
+
收到时间
{{ postcard.receive_time.strftime('%Y-%m-%d') if postcard.receive_time else '-' }}
{% endif %}
所属 Profile
{{ postcard.profile.nickname }}
diff --git a/app/templates/postcard_form.html b/app/templates/postcard_form.html index b99d999..76d6978 100644 --- a/app/templates/postcard_form.html +++ b/app/templates/postcard_form.html @@ -5,8 +5,8 @@

{{ '编辑' if postcard else '新建' }}明信片

- - + + - + - +
diff --git a/server.log b/server.log index 90b5e6c..5a5e80f 100644 --- a/server.log +++ b/server.log @@ -12,3 +12,43 @@ INFO: 127.0.0.1:65075 - "POST /api/profiles/2/postcards HTTP/1.1" 201 Create INFO: 127.0.0.1:49685 - "GET /api/profiles/2/postcards HTTP/1.1" 200 OK INFO: 127.0.0.1:63149 - "GET /dashboard HTTP/1.1" 303 See Other INFO: 127.0.0.1:63151 - "GET /login HTTP/1.1" 200 OK +INFO: 127.0.0.1:53977 - "GET /login HTTP/1.1" 200 OK +INFO: 127.0.0.1:55341 - "GET /login HTTP/1.1" 200 OK +INFO: 127.0.0.1:55341 - "GET /static/style.css HTTP/1.1" 200 OK +INFO: 127.0.0.1:55341 - "GET /favicon.ico HTTP/1.1" 404 Not Found +INFO: 127.0.0.1:52279 - "GET /login HTTP/1.1" 200 OK +INFO: 127.0.0.1:52279 - "GET /static/style.css HTTP/1.1" 200 OK +INFO: 127.0.0.1:56784 - "POST /login HTTP/1.1" 303 See Other +INFO: 127.0.0.1:56784 - "GET /dashboard HTTP/1.1" 200 OK +INFO: 127.0.0.1:56784 - "GET /static/style.css HTTP/1.1" 304 Not Modified +INFO: 127.0.0.1:53049 - "GET /profiles HTTP/1.1" 200 OK +INFO: 127.0.0.1:53049 - "GET /static/style.css HTTP/1.1" 304 Not Modified +INFO: 127.0.0.1:54774 - "GET /profiles/1/postcards HTTP/1.1" 303 See Other +INFO: 127.0.0.1:54774 - "GET /profiles HTTP/1.1" 200 OK +INFO: 127.0.0.1:54774 - "GET /static/style.css HTTP/1.1" 304 Not Modified +INFO: 127.0.0.1:63885 - "GET /profiles/1/postcards HTTP/1.1" 303 See Other +INFO: 127.0.0.1:63885 - "GET /profiles HTTP/1.1" 200 OK +INFO: 127.0.0.1:57051 - "GET /profiles/2/postcards HTTP/1.1" 200 OK +INFO: 127.0.0.1:57051 - "GET /static/style.css HTTP/1.1" 304 Not Modified +INFO: 127.0.0.1:51260 - "GET /postcards/2 HTTP/1.1" 200 OK +INFO: 127.0.0.1:51260 - "GET /static/style.css HTTP/1.1" 304 Not Modified +INFO: 127.0.0.1:49954 - "GET /profiles/2/postcards/new HTTP/1.1" 200 OK +INFO: 127.0.0.1:49954 - "GET /static/style.css HTTP/1.1" 304 Not Modified +INFO: 127.0.0.1:58443 - "GET /api-keys HTTP/1.1" 200 OK +INFO: 127.0.0.1:58443 - "GET /static/style.css HTTP/1.1" 304 Not Modified +INFO: 127.0.0.1:64813 - "GET /register HTTP/1.1" 200 OK +INFO: 127.0.0.1:63648 - "GET /postcards/2 HTTP/1.1" 303 See Other +INFO: 127.0.0.1:63648 - "GET /login HTTP/1.1" 200 OK +INFO: 127.0.0.1:63648 - "GET /static/style.css HTTP/1.1" 200 OK +INFO: 127.0.0.1:63648 - "GET /favicon.ico HTTP/1.1" 404 Not Found +INFO: 127.0.0.1:58651 - "POST /login HTTP/1.1" 303 See Other +INFO: 127.0.0.1:58651 - "GET /dashboard HTTP/1.1" 200 OK +INFO: 127.0.0.1:58651 - "GET /static/style.css HTTP/1.1" 304 Not Modified +INFO: 127.0.0.1:57344 - "GET /postcards/2 HTTP/1.1" 200 OK +INFO: 127.0.0.1:57344 - "GET /static/style.css HTTP/1.1" 304 Not Modified +INFO: 127.0.0.1:55540 - "GET /postcards/2 HTTP/1.1" 200 OK +INFO: 127.0.0.1:55540 - "GET /static/style.css HTTP/1.1" 200 OK +INFO: 127.0.0.1:57711 - "GET /profiles HTTP/1.1" 200 OK +INFO: 127.0.0.1:57711 - "GET /static/style.css HTTP/1.1" 304 Not Modified +INFO: 127.0.0.1:55656 - "GET /profiles/2/postcards HTTP/1.1" 200 OK +INFO: 127.0.0.1:55656 - "GET /static/style.css HTTP/1.1" 304 Not Modified