重构:将聊天室所有原生弹窗替换为全局弹窗,公告增加发送者与时间

- 将设公告、公屏讲话、全员清屏按钮弹窗改为使用 window.chatDialog 全局弹窗
- 所有弹窗改用 .then() 回调注册事件,避免 async/await 行为不一致问题
- 公告内容末尾追加「——发送者 MM-dd HH:mm」,无需新增数据库字段
- 前端编辑公告时自动剥离末尾元信息,用户仅编辑纯内容
- 修复 red-packet-panel.blade.php 中 3 处原生 alert() 残留
- 修复 shop-panel.blade.php 中购买确认 confirm() 原生弹窗残留
This commit is contained in:
2026-03-12 07:33:32 +08:00
parent f1062b34d2
commit b9c703b755
4 changed files with 93 additions and 79 deletions

View File

@@ -731,7 +731,9 @@ class ChatController extends Controller
'announcement' => 'required|string|max:500',
]);
$room->announcement = $request->input('announcement');
// 将发送者和发送时间追加到公告文本末尾,持久化存储,无需额外字段
$room->announcement = trim($request->input('announcement'))
.' ——'.$user->username.' '.now()->format('m-d H:i');
$room->save();
// 广播公告更新到所有在线用户