|
|
@@ -2868,7 +2868,7 @@ const getCourseDetail = async () => {
|
|
|
try {
|
|
|
const res = await api.getCourseDetail(props.courseid as string)
|
|
|
const opRes1 = await api.selectPPTOp({
|
|
|
- id: props.courseid + '-' + props.cid,
|
|
|
+ id: props.courseid, // + '-' + props.cid
|
|
|
type: '1',
|
|
|
index: 0
|
|
|
})
|
|
|
@@ -4468,7 +4468,7 @@ const createWebSocketConnection = async (type = 1) => {
|
|
|
docSocket.value.gc = true
|
|
|
providerSocket.value = new YjsRedisProvider(
|
|
|
api.yweb_socket,
|
|
|
- 'PPT' + props.courseid + props.cid,
|
|
|
+ 'PPT' + props.courseid,
|
|
|
docSocket.value,
|
|
|
{
|
|
|
params: { yauth: authToken.value },
|
|
|
@@ -4619,21 +4619,18 @@ const createWebSocketConnection = async (type = 1) => {
|
|
|
const isReplay = subType === 1
|
|
|
const timerTypes = ['timer_start', 'timer_pause', 'timer_reset', 'timer_stop', 'timer_finish', 'timer_update']
|
|
|
const writingBoardTypes = ['writing_board_update', 'writing_board_close', 'writing_board_blackboard']
|
|
|
- // 按类型去重:同一类消息只保留最后一条(latest 与 slideIndex 是两条独立通道,
|
|
|
- // 一次 syncStep2 重放会同时带上它们,不能只留全局最后一条,否则 sopen 被丢弃,
|
|
|
- // 学生 isFollowModeActive 一直为 false → 之后所有 slideIndex 都被忽略,表现为"不跟随")
|
|
|
- const lastByType = new Map<string, Record<string, any>>()
|
|
|
- for (const obj of validObjs) {
|
|
|
- const key = obj.type === 'slideIndex' ? 'slideIndex' : (obj.type || 'other')
|
|
|
- lastByType.set(key, obj)
|
|
|
- }
|
|
|
- // slideIndex 必须最后执行(依赖 sopen 先打开跟随模式)
|
|
|
- const orderedObjs = [...lastByType.entries()]
|
|
|
- .sort(([a], [b]) => (a === 'slideIndex' ? 1 : 0) - (b === 'slideIndex' ? 1 : 0))
|
|
|
- .map(([, v]) => v)
|
|
|
- for (const obj of orderedObjs) {
|
|
|
- console.log('📨 解析业务消息:', obj)
|
|
|
- getMessages(obj)
|
|
|
+ // 过滤出有效业务消息:不带业务字段的、自己发的、历史重放的 timer_* 全部剔除
|
|
|
+ const validObjs = objs.filter((obj: Record<string, any>) => {
|
|
|
+ if (!obj.type && obj.slideIndex === undefined) return false
|
|
|
+ if (obj.mId && obj.mId === mId.value) return false
|
|
|
+ if (isReplay && typeof obj.type === 'string' && obj.type.startsWith('timer_')) return false
|
|
|
+ return true
|
|
|
+ })
|
|
|
+ // 一次 update 可能带多个 struct(同一 Map 多次 set),只取最后一条处理
|
|
|
+ const lastObj = validObjs[validObjs.length - 1]
|
|
|
+ if (lastObj) {
|
|
|
+ console.log('📨 解析业务消息:', lastObj)
|
|
|
+ getMessages(lastObj)
|
|
|
}
|
|
|
|
|
|
// ★ 消息处理后检查特殊消息数组长度,超出则清理(替代 observe 里的清理逻辑)
|