fix(teacher): 课程资源为空时禁用展播模式按钮

Made-with: Cursor
This commit is contained in:
zhonghua 2026-03-25 09:59:19 +08:00
parent 3bd5cdfef5
commit 5c9be63347

View File

@ -34,7 +34,12 @@
<StepForwardOutlined /> <StepForwardOutlined />
</a-button> </a-button>
</a-button-group> </a-button-group>
<a-button type="primary" class="broadcast-btn" @click="openBroadcastMode"> <a-button
type="primary"
class="broadcast-btn"
:disabled="!hasCourseResources"
@click="openBroadcastMode"
>
<template #icon> <template #icon>
<ExpandOutlined /> <ExpandOutlined />
</template> </template>
@ -893,8 +898,12 @@ const nextStep = () => {
} }
}; };
// //
const openBroadcastMode = () => { const openBroadcastMode = () => {
if (!hasCourseResources.value) {
message.warning('暂无课程资源,无法进入展播模式');
return;
}
const broadcastUrl = `${window.location.origin}/teacher/broadcast/${lessonId.value}?lessonIndex=${currentLessonIndex.value}&stepIndex=${currentStepIndex.value}`; const broadcastUrl = `${window.location.origin}/teacher/broadcast/${lessonId.value}?lessonIndex=${currentLessonIndex.value}&stepIndex=${currentStepIndex.value}`;
window.open(broadcastUrl, '_blank', 'noopener,noreferrer'); window.open(broadcastUrl, '_blank', 'noopener,noreferrer');
}; };