diff --git a/src/hooks/useClassMonitor.ts b/src/hooks/useClassMonitor.ts index cdba6ac..c90cd36 100644 --- a/src/hooks/useClassMonitor.ts +++ b/src/hooks/useClassMonitor.ts @@ -346,6 +346,19 @@ const startClassMonitor = (msg: anyObj) => { monitorTimer = setInterval(() => reportMonitorSnapshot(sessionId), MONITOR_SNAPSHOT_INTERVAL) } +const getMonitorSessionId = (data: anyObj) => { + const sessionId = + data?.sessionId || + data?.monitorSessionId || + data?.classMonitorSessionId || + data?.monitorInfo?.sessionId || + data?.classMonitor?.sessionId + + return typeof sessionId === 'string' || typeof sessionId === 'number' + ? String(sessionId).trim() + : '' +} + export const handleClassMonitorMessage = (data: anyObj) => { const monitorType = resolveMonitorWsType(data) monitorLog('handle monitor ws message', { monitorType, data }) @@ -372,7 +385,8 @@ export const handleClassMonitorMessage = (data: anyObj) => { } export const syncClassMonitorState = (state: unknown) => { - const nextState = Number(state) + const stateInfo = state && typeof state === 'object' ? (state as anyObj) : {} + const nextState = Number(stateInfo.monitorState ?? state) if (nextState !== 0 && nextState !== 1) return if (nextState === 0) { @@ -380,5 +394,15 @@ export const syncClassMonitorState = (state: unknown) => { return } - monitorState = 1 + const sessionId = getMonitorSessionId(stateInfo) + if (!sessionId) { + monitorWarn('sync monitor state ignored because sessionId is empty', stateInfo) + monitorState = 1 + return + } + + startClassMonitor({ + ...stateInfo, + sessionId, + }) } diff --git a/src/page/system/homework copy/do-work/components/Question.vue b/src/page/system/homework copy/do-work/components/Question.vue new file mode 100644 index 0000000..da68443 --- /dev/null +++ b/src/page/system/homework copy/do-work/components/Question.vue @@ -0,0 +1,645 @@ + + + diff --git a/src/page/system/homework copy/do-work/index.vue b/src/page/system/homework copy/do-work/index.vue new file mode 100644 index 0000000..c95028e --- /dev/null +++ b/src/page/system/homework copy/do-work/index.vue @@ -0,0 +1,584 @@ + + + diff --git a/src/page/system/homework copy/history/index.vue b/src/page/system/homework copy/history/index.vue new file mode 100644 index 0000000..00459a0 --- /dev/null +++ b/src/page/system/homework copy/history/index.vue @@ -0,0 +1,473 @@ + + + diff --git a/src/page/system/homework copy/index.vue b/src/page/system/homework copy/index.vue new file mode 100644 index 0000000..308c949 --- /dev/null +++ b/src/page/system/homework copy/index.vue @@ -0,0 +1,506 @@ + + + diff --git a/src/page/system/homework copy/reports/components/Analyse.vue b/src/page/system/homework copy/reports/components/Analyse.vue new file mode 100644 index 0000000..76d1933 --- /dev/null +++ b/src/page/system/homework copy/reports/components/Analyse.vue @@ -0,0 +1,261 @@ + + + diff --git a/src/page/system/homework copy/reports/components/Detail.vue b/src/page/system/homework copy/reports/components/Detail.vue new file mode 100644 index 0000000..3833003 --- /dev/null +++ b/src/page/system/homework copy/reports/components/Detail.vue @@ -0,0 +1,116 @@ + + + diff --git a/src/page/system/homework copy/reports/components/EchartsBar.vue b/src/page/system/homework copy/reports/components/EchartsBar.vue new file mode 100644 index 0000000..650c967 --- /dev/null +++ b/src/page/system/homework copy/reports/components/EchartsBar.vue @@ -0,0 +1,129 @@ + + + diff --git a/src/page/system/homework copy/reports/components/EchartsPie.vue b/src/page/system/homework copy/reports/components/EchartsPie.vue new file mode 100644 index 0000000..e48f7d3 --- /dev/null +++ b/src/page/system/homework copy/reports/components/EchartsPie.vue @@ -0,0 +1,101 @@ + + + diff --git a/src/page/system/homework copy/reports/components/Knowledge.vue b/src/page/system/homework copy/reports/components/Knowledge.vue new file mode 100644 index 0000000..74c06c5 --- /dev/null +++ b/src/page/system/homework copy/reports/components/Knowledge.vue @@ -0,0 +1,180 @@ + + + diff --git a/src/page/system/homework copy/reports/components/hooks.ts b/src/page/system/homework copy/reports/components/hooks.ts new file mode 100644 index 0000000..7347455 --- /dev/null +++ b/src/page/system/homework copy/reports/components/hooks.ts @@ -0,0 +1,6 @@ +export const colorConfig = { + primary: '#2D39BC', + success: '#2F8A5B', + error: '#B22731', + warning: '#CC8A33', +} diff --git a/src/page/system/homework copy/reports/index.vue b/src/page/system/homework copy/reports/index.vue new file mode 100644 index 0000000..b2cb8cd --- /dev/null +++ b/src/page/system/homework copy/reports/index.vue @@ -0,0 +1,117 @@ + + + diff --git a/src/page/system/homework copy/statistics/SingleAnalysis.vue b/src/page/system/homework copy/statistics/SingleAnalysis.vue new file mode 100644 index 0000000..79041c1 --- /dev/null +++ b/src/page/system/homework copy/statistics/SingleAnalysis.vue @@ -0,0 +1,463 @@ + + + diff --git a/src/page/system/homework copy/statistics/Whole.vue b/src/page/system/homework copy/statistics/Whole.vue new file mode 100644 index 0000000..07b84fd --- /dev/null +++ b/src/page/system/homework copy/statistics/Whole.vue @@ -0,0 +1,148 @@ + + + diff --git a/src/page/system/homework copy/statistics/index.vue b/src/page/system/homework copy/statistics/index.vue new file mode 100644 index 0000000..005965f --- /dev/null +++ b/src/page/system/homework copy/statistics/index.vue @@ -0,0 +1,171 @@ + + + diff --git a/src/page/system/homework copy/temporary/index.vue b/src/page/system/homework copy/temporary/index.vue new file mode 100644 index 0000000..116b3bd --- /dev/null +++ b/src/page/system/homework copy/temporary/index.vue @@ -0,0 +1,278 @@ + + + diff --git a/src/page/system/homework copy/temporary/singleDetail.vue b/src/page/system/homework copy/temporary/singleDetail.vue new file mode 100644 index 0000000..e83157f --- /dev/null +++ b/src/page/system/homework copy/temporary/singleDetail.vue @@ -0,0 +1,314 @@ + + + diff --git a/src/page/system/homework copy/wrong/index.vue b/src/page/system/homework copy/wrong/index.vue new file mode 100644 index 0000000..99b2fbc --- /dev/null +++ b/src/page/system/homework copy/wrong/index.vue @@ -0,0 +1,557 @@ + + + diff --git a/src/stores/user.ts b/src/stores/user.ts index 696b90b..f7c72a7 100644 --- a/src/stores/user.ts +++ b/src/stores/user.ts @@ -118,7 +118,7 @@ export const userStore = defineStore('user', () => { } if (hasMonitorState) { - syncClassMonitorState(info.monitorState) + syncClassMonitorState(info) } if (typeof info.schoolClass === 'string') {