diff --git a/app/Http/Controllers/AdminCommandController.php b/app/Http/Controllers/AdminCommandController.php index e85f8dc..08b9c85 100644 --- a/app/Http/Controllers/AdminCommandController.php +++ b/app/Http/Controllers/AdminCommandController.php @@ -1023,7 +1023,7 @@ class AdminCommandController extends Controller 'message' => "{$admin->username}({$positionName})向你发放了 {$amount} 枚金币!", 'icon' => '💰', 'color' => '#f59e0b', - 'duration' => 8000, + 'duration' => 3000, ], ]; $this->chatState->pushMessage($roomId, $msg); diff --git a/app/Http/Controllers/ChatController.php b/app/Http/Controllers/ChatController.php index 4af1dee..ac71a48 100644 --- a/app/Http/Controllers/ChatController.php +++ b/app/Http/Controllers/ChatController.php @@ -506,7 +506,7 @@ class ChatController extends Controller 'message' => strip_tags($pureContent), 'icon' => '👋', 'color' => '#e11d48', - 'duration' => 8000, + 'duration' => 3000, ]; } @@ -1425,7 +1425,7 @@ class ChatController extends Controller 'message' => ''.ChatContentSanitizer::htmlText($sender->username)." 向你赠送了 {$amount} 枚金币!", 'icon' => '💰', 'color' => '#f59e0b', - 'duration' => 8000, + 'duration' => 3000, ], ]; diff --git a/app/Services/AchievementService.php b/app/Services/AchievementService.php index 2cab196..f349ca9 100644 --- a/app/Services/AchievementService.php +++ b/app/Services/AchievementService.php @@ -428,7 +428,7 @@ class AchievementService 'message' => "{$definition['icon']} {$definition['name']}", 'icon' => '🏅', 'color' => '#ca8a04', - 'duration' => 8000, + 'duration' => 3000, ], 'sent_at' => now()->toDateTimeString(), ]; diff --git a/app/Services/GameBetBroadcastService.php b/app/Services/GameBetBroadcastService.php index 6c01d91..17eff93 100644 --- a/app/Services/GameBetBroadcastService.php +++ b/app/Services/GameBetBroadcastService.php @@ -122,7 +122,7 @@ class GameBetBroadcastService 'message' => $toastMessage, 'icon' => $toastIcon, 'color' => $toastColor, - 'duration' => 8000, + 'duration' => 3000, ]; if ($toastActorUsername !== null) { diff --git a/resources/js/chat-room/chat-events.js b/resources/js/chat-room/chat-events.js index f41ea31..035fa82 100644 --- a/resources/js/chat-room/chat-events.js +++ b/resources/js/chat-room/chat-events.js @@ -472,7 +472,7 @@ export function bindChatEvents() { message: t.message || "", icon: t.icon || "💬", color: t.color || "#336699", - duration: t.duration ?? 8000, + duration: t.duration ?? 3000, }); } }); diff --git a/resources/js/chat-room/red-packet-panel.js b/resources/js/chat-room/red-packet-panel.js index d595e8c..d2af9d4 100644 --- a/resources/js/chat-room/red-packet-panel.js +++ b/resources/js/chat-room/red-packet-panel.js @@ -525,7 +525,7 @@ function handleClaimResponse(response, data, button) { message: `恭喜您抢到了礼包 ${data.amount} ${typeLabel}!`, icon: "🧧", color: redPacketType === "exp" ? "#7c3aed" : "#dc2626", - duration: 8000, + duration: 3000, }); closeRedPacketModal(); diff --git a/resources/js/chat-room/riddle-quiz.js b/resources/js/chat-room/riddle-quiz.js index e99ddc7..963c03e 100644 --- a/resources/js/chat-room/riddle-quiz.js +++ b/resources/js/chat-room/riddle-quiz.js @@ -461,7 +461,7 @@ function handleRiddleGameAnswered(e) { message: `${winnerUsername} 答对了「${answer}」,获得 ${rewardGold}💰 + ${rewardExp}⭐!`, icon: "🎉", color: "#16a34a", - duration: 6000, + duration: 3000, }); } diff --git a/resources/js/chat-room/toast.js b/resources/js/chat-room/toast.js index 29492e0..6a165fe 100644 --- a/resources/js/chat-room/toast.js +++ b/resources/js/chat-room/toast.js @@ -80,7 +80,7 @@ function createChatToast(container) { message, icon = "💬", color = "#336699", - duration = 6000, + duration = 3000, action = null, }) { const card = document.createElement("div"); diff --git a/resources/views/chat/partials/toast-notification.blade.php b/resources/views/chat/partials/toast-notification.blade.php index 24af252..202f9b3 100644 --- a/resources/views/chat/partials/toast-notification.blade.php +++ b/resources/views/chat/partials/toast-notification.blade.php @@ -7,7 +7,7 @@ - message: 卡片内容(支持 HTML) - icon: 左侧 Emoji 图标(可选,默认 💬) - color: 强调色 HEX(可选,默认 #336699) - - duration: 自动消失毫秒数(可选,默认 6000;0 = 不自动消失) + - duration: 自动消失毫秒数(可选,默认 3000;0 = 不自动消失) - action: { label, onClick } 可选操作按钮 使用示例: @@ -43,13 +43,14 @@ right: 12px !important; bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important; left: 12px !important; - align-items: stretch; + align-items: flex-end; } #chat-toast-container .chat-toast-card { - width: 100% !important; + width: fit-content !important; min-width: 0 !important; - max-width: none !important; + max-width: min(320px, calc(100vw - 24px)) !important; + overflow-wrap: anywhere; } }