自习室优化ok

This commit is contained in:
zhutao
2025-11-28 18:01:09 +08:00
parent 57305c5804
commit 54bf2dcee7
38 changed files with 527 additions and 117 deletions

View File

@@ -176,7 +176,13 @@ class TchRoomVM extends ChangeNotifier {
///学生人员变化事件,(如加入、退出、掉线)
void onStudentChange(List<RoomUserDto> list) {
_students = list.where((t) => t.userType != 2).toList();
_students = list.where((t) => t.userType != 2 && t.online == 1).toList();
if (activeSId != 0) {
final it = _students.where((t) => t.userId == activeSId).firstOrNull;
if (it == null) {
activeSId = 0;
}
}
// 如果当前没有学生,则选择第一个
if (activeSId == 0 && _students.isNotEmpty) {
activeSId = _students.first.userId;