From 7be2dd256ed45e66eaba971b0edd2ba5f7443388 Mon Sep 17 00:00:00 2001 From: liuwei Date: Wed, 28 May 2025 17:13:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96log=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/dashboard/templates/wx_logs.html | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/admin/dashboard/templates/wx_logs.html b/admin/dashboard/templates/wx_logs.html index 4fb0687..363cbd1 100644 --- a/admin/dashboard/templates/wx_logs.html +++ b/admin/dashboard/templates/wx_logs.html @@ -38,11 +38,13 @@ 自动滚动到底部
+ {% raw %}
{{ formatTimestamp(log.timestamp) }} {{ log.level }} {{ log.message }}
+ {% endraw %}
@@ -101,15 +103,16 @@ this.filteredLogs = this.logContent; } else { const query = this.searchQuery.toLowerCase(); - this.filteredLogs = this.logContent.filter(log => - log.message.toLowerCase().includes(query) || - log.level.toLowerCase().includes(query) || - log.timestamp.toLowerCase().includes(query) + this.filteredLogs = this.logContent.filter(log => + (log.message && log.message.toLowerCase().includes(query)) || + (log.level && log.level.toLowerCase().includes(query)) || + (log.timestamp && log.timestamp.toLowerCase().includes(query)) ); } this.$nextTick(() => this.scrollToBottom()); }, formatTimestamp(timestamp) { + if (!timestamp) return ''; return new Date(timestamp).toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit', second: '2-digit'