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