feat:支持屏幕共享
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CI / CI OK (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
This commit is contained in:
parent
e30b57f183
commit
18227e29ad
6
playground/src/types/global.d.ts
vendored
6
playground/src/types/global.d.ts
vendored
@ -4,6 +4,12 @@ interface Window {
|
|||||||
requests: any[]
|
requests: any[]
|
||||||
tokenRefreshing: boolean
|
tokenRefreshing: boolean
|
||||||
unique: number
|
unique: number
|
||||||
|
/** teacher-electron 注入,仅在桌面客户端内嵌题库页时存在 */
|
||||||
|
teacherApi?: {
|
||||||
|
startSfu: () => Promise<{ port: number; already?: boolean }>
|
||||||
|
stopSfu: () => Promise<void>
|
||||||
|
openScreenShareWindow: () => Promise<void>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Option {
|
interface Option {
|
||||||
|
|||||||
@ -166,7 +166,10 @@ async function updateMonitorStatus(status: 0 | 1) {
|
|||||||
const option = status === 1 ? '开启' : '停止'
|
const option = status === 1 ? '开启' : '停止'
|
||||||
controlLoading.value = true
|
controlLoading.value = true
|
||||||
try {
|
try {
|
||||||
await classroomMonitorService.updateMonitorStatus(selectedClass.value.id, status)
|
await classroomMonitorService.updateMonitorStatus(
|
||||||
|
selectedClass.value.id,
|
||||||
|
status,
|
||||||
|
)
|
||||||
hud.success(`${option}监控成功`)
|
hud.success(`${option}监控成功`)
|
||||||
await loadMonitorDetail(selectedClass.value.id)
|
await loadMonitorDetail(selectedClass.value.id)
|
||||||
} finally {
|
} finally {
|
||||||
@ -206,10 +209,13 @@ async function loadSessions() {
|
|||||||
if (!selectedClass.value?.id) return
|
if (!selectedClass.value?.id) return
|
||||||
sessionsLoading.value = true
|
sessionsLoading.value = true
|
||||||
try {
|
try {
|
||||||
const data = await classroomMonitorService.getSessions(selectedClass.value.id, {
|
const data = await classroomMonitorService.getSessions(
|
||||||
current: sessionsPage.current,
|
selectedClass.value.id,
|
||||||
size: sessionsPage.size,
|
{
|
||||||
})
|
current: sessionsPage.current,
|
||||||
|
size: sessionsPage.size,
|
||||||
|
},
|
||||||
|
)
|
||||||
sessionsRows.value = data?.rows ?? []
|
sessionsRows.value = data?.rows ?? []
|
||||||
sessionsPage.total = data?.totalRows ?? 0
|
sessionsPage.total = data?.totalRows ?? 0
|
||||||
} finally {
|
} finally {
|
||||||
@ -244,10 +250,27 @@ function formatTime(time?: number | string) {
|
|||||||
if (!time) return '-'
|
if (!time) return '-'
|
||||||
const timestamp = Number(time)
|
const timestamp = Number(time)
|
||||||
if (Number.isNaN(timestamp)) return String(time)
|
if (Number.isNaN(timestamp)) return String(time)
|
||||||
const date = new Date(String(timestamp).length === 10 ? timestamp * 1000 : timestamp)
|
const date = new Date(
|
||||||
|
String(timestamp).length === 10 ? timestamp * 1000 : timestamp,
|
||||||
|
)
|
||||||
if (Number.isNaN(date.getTime())) return String(time)
|
if (Number.isNaN(date.getTime())) return String(time)
|
||||||
return date.toLocaleString()
|
return date.toLocaleString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** teacher-electron 注入:打开独立屏幕共享窗口 */
|
||||||
|
async function openTeacherScreenShareWindow() {
|
||||||
|
const api = window.teacherApi
|
||||||
|
if (!api?.openScreenShareWindow) {
|
||||||
|
ElMessage.warning('请在教师端桌面客户端中使用「共享屏幕」')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await api.openScreenShareWindow()
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
|
ElMessage.error('打开屏幕共享窗口失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@ -259,9 +282,18 @@ function formatTime(time?: number | string) {
|
|||||||
<div class="page-title">课堂监控</div>
|
<div class="page-title">课堂监控</div>
|
||||||
<div class="page-desc">请选择班级查看当前课堂监控。</div>
|
<div class="page-desc">请选择班级查看当前课堂监控。</div>
|
||||||
</div>
|
</div>
|
||||||
<el-button :loading="classLoading" type="primary" @click="loadClassList">
|
<div class="header-actions">
|
||||||
刷新
|
<el-button type="primary" @click="openTeacherScreenShareWindow">
|
||||||
</el-button>
|
共享屏幕
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
:loading="classLoading"
|
||||||
|
type="primary"
|
||||||
|
@click="loadClassList"
|
||||||
|
>
|
||||||
|
刷新
|
||||||
|
</el-button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -273,9 +305,7 @@ function formatTime(time?: number | string) {
|
|||||||
:type="item.monitorState === 1 ? 'success' : 'info'"
|
:type="item.monitorState === 1 ? 'success' : 'info'"
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
{{
|
{{ item.monitorState === 1 ? '监控开启' : '监控关闭' }}
|
||||||
item.monitorState === 1 ? '监控开启' : '监控关闭'
|
|
||||||
}}
|
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<el-button type="primary" @click="handleViewMonitor(item)">
|
<el-button type="primary" @click="handleViewMonitor(item)">
|
||||||
@ -283,7 +313,10 @@ function formatTime(time?: number | string) {
|
|||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-empty v-if="!classLoading && classList.length === 0" description="暂无班级" />
|
<el-empty
|
||||||
|
v-if="!classLoading && classList.length === 0"
|
||||||
|
description="暂无班级"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
@ -297,6 +330,9 @@ function formatTime(time?: number | string) {
|
|||||||
<div class="header-actions">
|
<div class="header-actions">
|
||||||
<el-button @click="backToClassList">返回班级列表</el-button>
|
<el-button @click="backToClassList">返回班级列表</el-button>
|
||||||
<el-button @click="openHistoryMonitor">历史监控</el-button>
|
<el-button @click="openHistoryMonitor">历史监控</el-button>
|
||||||
|
<el-button type="primary" @click="openTeacherScreenShareWindow">
|
||||||
|
共享屏幕
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
:loading="detailLoading || snapshotLoading"
|
:loading="detailLoading || snapshotLoading"
|
||||||
type="primary"
|
type="primary"
|
||||||
@ -421,7 +457,11 @@ function formatTime(time?: number | string) {
|
|||||||
<el-table-column prop="intervalMs" label="采集间隔(ms)" width="120" />
|
<el-table-column prop="intervalMs" label="采集间隔(ms)" width="120" />
|
||||||
<el-table-column label="操作" width="88" fixed="right">
|
<el-table-column label="操作" width="88" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button type="primary" link @click.stop="onSessionRowClick(row)">
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
@click.stop="onSessionRowClick(row)"
|
||||||
|
>
|
||||||
查看
|
查看
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -476,16 +516,11 @@ function formatTime(time?: number | string) {
|
|||||||
:preview-src-list="studentSnapshotPreviewList"
|
:preview-src-list="studentSnapshotPreviewList"
|
||||||
:src="item.url"
|
:src="item.url"
|
||||||
/>
|
/>
|
||||||
<div class="student-meta">
|
<div class="student-meta">截图时间:{{ formatTime(item.ts) }}</div>
|
||||||
截图时间:{{ formatTime(item.ts) }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-empty
|
<el-empty v-else-if="!studentSnapshotLoading" description="暂无截图" />
|
||||||
v-else-if="!studentSnapshotLoading"
|
|
||||||
description="暂无截图"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
@ -500,21 +535,21 @@ function formatTime(time?: number | string) {
|
|||||||
|
|
||||||
.card-header {
|
.card-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: 16px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-title {
|
.page-title {
|
||||||
color: #1f2937;
|
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
color: #1f2937;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-desc {
|
.page-desc {
|
||||||
margin-top: 6px;
|
margin-top: 6px;
|
||||||
color: #6b7280;
|
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
color: #6b7280;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-actions {
|
.header-actions {
|
||||||
@ -540,16 +575,16 @@ function formatTime(time?: number | string) {
|
|||||||
|
|
||||||
.class-row-info {
|
.class-row-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.class-name {
|
.class-name {
|
||||||
color: #111827;
|
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
color: #111827;
|
||||||
}
|
}
|
||||||
|
|
||||||
.monitor-detail {
|
.monitor-detail {
|
||||||
@ -558,8 +593,8 @@ function formatTime(time?: number | string) {
|
|||||||
|
|
||||||
.status-panel {
|
.status-panel {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
gap: 24px;
|
gap: 24px;
|
||||||
|
align-items: center;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
margin-bottom: 18px;
|
margin-bottom: 18px;
|
||||||
background: #f8fafc;
|
background: #f8fafc;
|
||||||
@ -568,19 +603,19 @@ function formatTime(time?: number | string) {
|
|||||||
|
|
||||||
> div {
|
> div {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
strong {
|
strong {
|
||||||
color: #111827;
|
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
color: #111827;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-label {
|
.status-label {
|
||||||
color: #6b7280;
|
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
color: #6b7280;
|
||||||
}
|
}
|
||||||
|
|
||||||
.snapshot-header {
|
.snapshot-header {
|
||||||
@ -591,21 +626,21 @@ function formatTime(time?: number | string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
color: #111827;
|
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
color: #111827;
|
||||||
}
|
}
|
||||||
|
|
||||||
.snapshot-grid {
|
.snapshot-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
min-height: 220px;
|
|
||||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
|
min-height: 220px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.snapshot-card {
|
.snapshot-card {
|
||||||
cursor: pointer;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
cursor: pointer;
|
||||||
transition:
|
transition:
|
||||||
border-color 0.2s,
|
border-color 0.2s,
|
||||||
box-shadow 0.2s;
|
box-shadow 0.2s;
|
||||||
@ -637,14 +672,14 @@ function formatTime(time?: number | string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.student-name {
|
.student-name {
|
||||||
color: #111827;
|
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
color: #111827;
|
||||||
}
|
}
|
||||||
|
|
||||||
.student-meta {
|
.student-meta {
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
color: #6b7280;
|
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
color: #6b7280;
|
||||||
}
|
}
|
||||||
|
|
||||||
.student-snapshot-dialog {
|
.student-snapshot-dialog {
|
||||||
@ -653,8 +688,8 @@ function formatTime(time?: number | string) {
|
|||||||
|
|
||||||
.student-snapshot-summary {
|
.student-snapshot-summary {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
padding-bottom: 16px;
|
padding-bottom: 16px;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
border-bottom: 1px solid #edf0f5;
|
border-bottom: 1px solid #edf0f5;
|
||||||
@ -681,14 +716,14 @@ function formatTime(time?: number | string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sessions-table {
|
.sessions-table {
|
||||||
cursor: pointer;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sessions-pagination {
|
.sessions-pagination {
|
||||||
margin-top: 16px;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,8 +746,8 @@ function formatTime(time?: number | string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.status-panel {
|
.status-panel {
|
||||||
align-items: flex-start;
|
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -722,8 +757,8 @@ function formatTime(time?: number | string) {
|
|||||||
.card-header,
|
.card-header,
|
||||||
.class-row,
|
.class-row,
|
||||||
.snapshot-header {
|
.snapshot-header {
|
||||||
align-items: stretch;
|
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
align-items: stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-actions {
|
.header-actions {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user