From 5504243bbbb2b830135c877be8fc6499dcb6780e Mon Sep 17 00:00:00 2001 From: lkddi Date: Fri, 27 Feb 2026 11:43:30 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E5=89=8D=E7=AB=AF=20Ajax=20=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E7=BC=BA=E5=B0=91=20Accept=20=E5=A4=B4=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=20404=20=E8=BF=94=E5=9B=9E=20HTML=20=E5=BC=95?= =?UTF-8?q?=E5=8F=91=20JSON.parse=20=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/partials/user-actions.blade.php | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/resources/views/chat/partials/user-actions.blade.php b/resources/views/chat/partials/user-actions.blade.php index b5ba871..8ec48eb 100644 --- a/resources/views/chat/partials/user-actions.blade.php +++ b/resources/views/chat/partials/user-actions.blade.php @@ -93,7 +93,20 @@ /** 获取用户资料 */ async fetchUser(username) { try { - const res = await fetch('/user/' + encodeURIComponent(username)); + const res = await fetch('/user/' + encodeURIComponent(username), { + headers: { + 'Accept': 'application/json', + 'X-Requested-With': 'XMLHttpRequest' + } + }); + + if (!res.ok) { + const errorData = await res.json().catch(() => ({})); + console.error('Failed to fetch user:', errorData.message || res.statusText); + // 如果是 404 或者 500 等错误,直接静默退出或提示 + return; + } + const data = await res.json(); if (data.status === 'success') { this.userInfo = data.data; @@ -103,7 +116,7 @@ this.whisperList = []; } } catch (e) { - console.error(e); + console.error('Error fetching user:', e); } }, @@ -333,7 +346,8 @@
- 🛡️ 管理员视野
+ 🛡️ 管理员视野 +
主要IP: