From a44a9ce24244747851101d70b56d8eb7634c33e8 Mon Sep 17 00:00:00 2001 From: lkddi Date: Sun, 1 Mar 2026 01:33:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=9B=9E=E5=8A=A0?= =?UTF-8?q?=E5=A5=BD=E5=8F=8B=E6=88=90=E5=8A=9F=E5=90=8E=E5=A4=A7=E5=8D=A1?= =?UTF-8?q?=E7=89=87=E8=87=AA=E5=8A=A8=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit quickFriendAction 是 async 函数,await 完成后 检查按钮文字是否为 '✅',1.5 秒后调用 close() 关闭 banner。 --- resources/views/chat/partials/scripts.blade.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/resources/views/chat/partials/scripts.blade.php b/resources/views/chat/partials/scripts.blade.php index f9cd75a..2b10f78 100644 --- a/resources/views/chat/partials/scripts.blade.php +++ b/resources/views/chat/partials/scripts.blade.php @@ -498,7 +498,8 @@ window.addEventListener('chat:kicked', (e) => { if (e.detail.username === window.chatContext.username) { - window.chatDialog.alert('您已被管理员踢出房间!' + (e.detail.reason ? ' 原因:' + e.detail.reason : ''), '系统通知', '#cc4444'); + window.chatDialog.alert('您已被管理员踢出房间!' + (e.detail.reason ? ' 原因:' + e.detail.reason : ''), '系统通知', + '#cc4444'); window.location.href = "{{ route('rooms.index') }}"; } }); @@ -924,7 +925,13 @@ buttons: [{ label: '➕ 回加好友', color: '#10b981', - onClick: (btn) => quickFriendAction('add', fromUsername, btn), + onClick: async (btn, close) => { + await quickFriendAction('add', fromUsername, btn); + // 成功后(按钮显示 ✅)等 1.5 秒关闭大卡片 + if (btn.textContent.startsWith('✅')) { + setTimeout(close, 1500); + } + }, }, { label: '稍后再说', @@ -1238,7 +1245,8 @@ contentInput.value = ''; contentInput.focus(); } else { - window.chatDialog.alert('发送失败: ' + (data.message || JSON.stringify(data.errors)), '操作失败', '#cc4444'); + window.chatDialog.alert('发送失败: ' + (data.message || JSON.stringify(data.errors)), '操作失败', + '#cc4444'); } } catch (error) { window.chatDialog.alert('网络连接错误,消息发送失败!', '网络错误', '#cc4444');