From 8fdfc723e8642b02105ab27778539e2d4bb3df90 Mon Sep 17 00:00:00 2001 From: liuwei Date: Tue, 1 Apr 2025 17:09:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=88=97=E8=A1=A8=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=98=BE=E7=A4=BA=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/dashboard/templates/message_list.html | 29 ++++++++++++++++++--- db/message_storage.py | 2 +- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/admin/dashboard/templates/message_list.html b/admin/dashboard/templates/message_list.html index 75f51da..ba54263 100644 --- a/admin/dashboard/templates/message_list.html +++ b/admin/dashboard/templates/message_list.html @@ -82,7 +82,9 @@
【图片消息】
- + + +
@@ -133,7 +135,8 @@ - + + @@ -146,7 +149,8 @@ - + + {% endblock %} @@ -332,6 +336,25 @@ 49: '链接消息' }; return typeMap[type] || `未知类型(${type})`; + }, + getImageUrl(imagePath) { + // 如果路径为空,返回空字符串 + if (!imagePath) return ''; + + // 提取文件名 + const fileName = imagePath.split('\\').pop().split('/').pop(); + + // 检查路径中是否包含static/images + if (imagePath.includes('static/images') || imagePath.includes('static\\images')) { + // 提取static/images后面的部分 + const parts = imagePath.split(/static[\/\\]images[\/\\]/); + if (parts.length > 1) { + return `/static/images/${parts[1]}`; + } + } + + // 如果不包含static/images,则直接使用文件名 + return `/static/images/${fileName}`; } }, watch: { diff --git a/db/message_storage.py b/db/message_storage.py index fe115a2..1b4825b 100644 --- a/db/message_storage.py +++ b/db/message_storage.py @@ -129,7 +129,7 @@ class MessageStorageDB(BaseDBOperator): sql_count = "SELECT COUNT(*) as total FROM messages WHERE 1=1 " sql_data = """ SELECT id, group_id, timestamp, sender, content, message_type, - attachment_url, message_id, message_xml, message_thumb + attachment_url, message_id, message_xml, message_thumb, image_path FROM messages WHERE 1=1 """