From 9707ec0c988bf815526ae46a97b68d9a19995f3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E6=A2=A6?= Date: Fri, 15 May 2026 11:48:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=89=93=E5=BC=80=E6=A1=8C=E9=9D=A2?= =?UTF-8?q?=E7=AB=AF=E4=BC=A0token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playground/src/types/global.d.ts | 3 +++ .../src/views/org/classroom-monitor/home.vue | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/playground/src/types/global.d.ts b/playground/src/types/global.d.ts index 2e1348b..d841532 100644 --- a/playground/src/types/global.d.ts +++ b/playground/src/types/global.d.ts @@ -13,12 +13,15 @@ interface Window { classStudentRows?: unknown[], className?: string, classId?: string | number, + /** 管理端当前登录 accessToken,供教师端主进程请求 teacherScreenShare 接口时带 Authorization */ + accessToken?: string | null, ) => Promise /** 打开学员屏幕监控独立窗口(teacher-electron);名称用于窗口标题,班级 id 下发至监控页。 */ openStudentScreenMonitorWindow?: ( classStudentRows?: unknown[], className?: string, classId?: string | number, + accessToken?: string | null, ) => Promise setShareClassStudentsListener?: ( cb: ((rows: unknown[]) => void) | null, diff --git a/playground/src/views/org/classroom-monitor/home.vue b/playground/src/views/org/classroom-monitor/home.vue index 667f08a..4be41f5 100644 --- a/playground/src/views/org/classroom-monitor/home.vue +++ b/playground/src/views/org/classroom-monitor/home.vue @@ -9,12 +9,14 @@ import type { import { computed, onBeforeUnmount, onMounted, reactive, ref } from 'vue' import { useRouter } from 'vue-router' +import { useAccessStore } from '@vben/stores' import { classStudentService } from '../../../api/service/org/class-student' import { classroomMonitorService } from '../../../api/service/org/classroom-monitor' import hud from '../../../utils/hud' const router = useRouter() +const accessStore = useAccessStore() const classLoading = ref(false) const detailLoading = ref(false) @@ -274,7 +276,12 @@ async function openTeacherScreenShareWindow(item: ClassroomItem) { classId: item.id, }) const rows = (page as any)?.data?.rows ?? page?.rows ?? [] - await api.openScreenShareWindow(rows, item.name ?? '', item.id) + const token = accessStore.accessToken?.trim() + if (token) { + await api.openScreenShareWindow(rows, item.name ?? '', item.id, token) + } else { + await api.openScreenShareWindow(rows, item.name ?? '', item.id) + } } catch (error) { console.error(error) throw error @@ -301,7 +308,12 @@ async function openStudentScreenMonitorWindow(item: ClassroomItem) { classId: item.id, }) const rows = (page as any)?.data?.rows ?? page?.rows ?? [] - await openMon(rows, item.name ?? '', item.id) + const token = accessStore.accessToken?.trim() + if (token) { + await openMon(rows, item.name ?? '', item.id, token) + } else { + await openMon(rows, item.name ?? '', item.id) + } } catch (error) { console.error(error) throw error