修复:回加好友成功后大卡片自动关闭
quickFriendAction 是 async 函数,await 完成后
检查按钮文字是否为 '✅',1.5 秒后调用 close() 关闭 banner。
This commit is contained in:
@@ -498,7 +498,8 @@
|
|||||||
|
|
||||||
window.addEventListener('chat:kicked', (e) => {
|
window.addEventListener('chat:kicked', (e) => {
|
||||||
if (e.detail.username === window.chatContext.username) {
|
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') }}";
|
window.location.href = "{{ route('rooms.index') }}";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -924,7 +925,13 @@
|
|||||||
buttons: [{
|
buttons: [{
|
||||||
label: '➕ 回加好友',
|
label: '➕ 回加好友',
|
||||||
color: '#10b981',
|
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: '稍后再说',
|
label: '稍后再说',
|
||||||
@@ -1238,7 +1245,8 @@
|
|||||||
contentInput.value = '';
|
contentInput.value = '';
|
||||||
contentInput.focus();
|
contentInput.focus();
|
||||||
} else {
|
} else {
|
||||||
window.chatDialog.alert('发送失败: ' + (data.message || JSON.stringify(data.errors)), '操作失败', '#cc4444');
|
window.chatDialog.alert('发送失败: ' + (data.message || JSON.stringify(data.errors)), '操作失败',
|
||||||
|
'#cc4444');
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
window.chatDialog.alert('网络连接错误,消息发送失败!', '网络错误', '#cc4444');
|
window.chatDialog.alert('网络连接错误,消息发送失败!', '网络错误', '#cc4444');
|
||||||
|
|||||||
Reference in New Issue
Block a user