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 @@ + + + + +