feat(举手与协作): 顶栏「N 人举手」点开按题分组带错法;看板多一列「在写」点了就能看他的代码;帮完了回看板、还有人就「下一个」

学生那边按钮写「xuyue 在帮你 / 在看你的代码」。顺带修了老师接单后编辑器里留着自己的
草稿或模板、学生的代码插在前面、两边从此不一致的问题。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-13 13:04:57 +08:00
1 parent 573a0f967f
commit 1fcd12f6f4
13 files changed
+621 -178

No files matched your search

@@ -0,0 +1,34 @@
import { useCollabStore } from "shared/store/collab"
/**
* 老师接单 / 主动打开学生的编辑器。两处入口(顶栏举手面板、课堂看板)共用。
*
* 只发消息,不跳页面:房间开好(room_open 到了)才跳到那道题,跳转统一在 CollabHost 里做
* —— 原来是点完就跳,服务端拒了(别的老师先接走、学生刚走)前端也已经跳过去了。
*
* 一个老师同时只在一个房间(服务端也拦)。这里先拦一道:不拦的话等新房间开好跳过去,
* 等于把手上这场协作断掉。返回 false = 没发出去
*/
export function useTeacherHelp() {
const collabStore = useCollabStore()
const message = useMessage()
function busy() {
if (!collabStore.room) return false
message.warning("请先结束当前协作")
return true
}
return {
help(studentId: number) {
if (busy()) return false
collabStore.accept(studentId)
return true
},
peek(studentId: number) {
if (busy()) return false
collabStore.peek(studentId)
return true
},
}
}