From 391132e1279ddf74b8ca2b8475ceefb3e2f3fb46 Mon Sep 17 00:00:00 2001 From: shawko Date: Sun, 10 May 2026 19:06:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AF=BE=E5=A0=82=E7=9B=91=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playground/src/api/request.ts | 2 +- .../src/api/service/org/classroom-monitor.ts | 57 +++ .../src/views/org/class-student/home.vue | 2 +- .../src/views/org/classroom-monitor/home.vue | 413 ++++++++++++++++++ 4 files changed, 472 insertions(+), 2 deletions(-) create mode 100644 playground/src/api/service/org/classroom-monitor.ts create mode 100644 playground/src/views/org/classroom-monitor/home.vue diff --git a/playground/src/api/request.ts b/playground/src/api/request.ts index 7135466..ba6b3d4 100644 --- a/playground/src/api/request.ts +++ b/playground/src/api/request.ts @@ -111,7 +111,7 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) { defaultResponseInterceptor({ codeField: 'code', dataField: 'data', - successCode: 200, + successCode: (code) => code === 0 || code === 200, }), ) diff --git a/playground/src/api/service/org/classroom-monitor.ts b/playground/src/api/service/org/classroom-monitor.ts new file mode 100644 index 0000000..555e9b9 --- /dev/null +++ b/playground/src/api/service/org/classroom-monitor.ts @@ -0,0 +1,57 @@ +import type { PageResponse } from '#/api/http' + +import { get, post } from '#/api/http' + +export type ClassroomItem = { + id: number | string + name: string +} + +export type ClassMonitorCurrent = { + classId: number | string + intervalMs: number + monitoring: boolean + sessionId: number | string + startTime: string + teacherId: number | string +} + +export type ClassMonitorSnapshot = { + avatar: string + latestTs: number + latestUrl: string + staleSeconds: number + studentId: number | string + studentName: string +} + +class ClassroomMonitorService { + async getClassList() { + return await get>('/org/class/list', { + current: 1, + size: 25, + }) + } + + async getCurrent(classId: number | string) { + return await get('/school/classMonitor/current', { + classId, + }) + } + + async getLatestSnapshots(classId: number | string) { + return await get( + '/school/classMonitor/latestSnapshots', + { classId }, + ) + } + + async updateMonitorStatus(classId: number | string, status: 0 | 1) { + return await post('/school/classMonitor/control', { + classId, + status, + }) + } +} + +export const classroomMonitorService = new ClassroomMonitorService() diff --git a/playground/src/views/org/class-student/home.vue b/playground/src/views/org/class-student/home.vue index 3a3973a..518b267 100644 --- a/playground/src/views/org/class-student/home.vue +++ b/playground/src/views/org/class-student/home.vue @@ -123,7 +123,7 @@ const grid = { { field: 'account', title: '学员账号', - }, + }, { field: 'serialNumber', title: '设备编码', diff --git a/playground/src/views/org/classroom-monitor/home.vue b/playground/src/views/org/classroom-monitor/home.vue new file mode 100644 index 0000000..816b8a5 --- /dev/null +++ b/playground/src/views/org/classroom-monitor/home.vue @@ -0,0 +1,413 @@ + + + + +