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 """