feat(展播): 退出时先跳转谢谢观看页再关闭窗口
- 新增 BroadcastThanksView 谢谢观看页 - 展播退出时先跳转谢谢观看页 - 谢谢观看页尝试关闭窗口,无法关闭则停留该页 Made-with: Cursor
This commit is contained in:
parent
67af92ddfd
commit
37d821990f
@ -309,6 +309,12 @@ const routes: RouteRecordRaw[] = [
|
|||||||
component: () => import('@/views/teacher/lessons/LessonRecordsView.vue'),
|
component: () => import('@/views/teacher/lessons/LessonRecordsView.vue'),
|
||||||
meta: { title: '课后记录' },
|
meta: { title: '课后记录' },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'broadcast/thanks',
|
||||||
|
name: 'TeacherBroadcastThanks',
|
||||||
|
component: () => import('@/views/teacher/lessons/BroadcastThanksView.vue'),
|
||||||
|
meta: { title: '谢谢观看' },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'broadcast/:id',
|
path: 'broadcast/:id',
|
||||||
name: 'TeacherBroadcast',
|
name: 'TeacherBroadcast',
|
||||||
|
|||||||
@ -0,0 +1,40 @@
|
|||||||
|
<template>
|
||||||
|
<div class="broadcast-thanks pos-fixed top-0 left-0 w-full h-full z-999">
|
||||||
|
<div class="thanks-content">
|
||||||
|
<h1 class="thanks-title">谢谢观看</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted } from 'vue';
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
// 尝试关闭窗口(由 window.open 打开的标签页可成功关闭)
|
||||||
|
window.close();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.broadcast-thanks {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: #1a1a2e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thanks-content {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thanks-title {
|
||||||
|
font-size: 48px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #fff;
|
||||||
|
margin: 0;
|
||||||
|
letter-spacing: 0.2em;
|
||||||
|
opacity: 0.95;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -280,15 +280,12 @@ const goBackToLesson = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理退出:跳转回上课页面
|
// 处理退出:先跳转谢谢观看页,再由该页尝试关闭;若无法关闭则停留感谢页
|
||||||
const handleExit = () => {
|
const handleExit = () => {
|
||||||
// 优先尝试关闭标签页并聚焦 opener(从上课页新开时)
|
|
||||||
if (window.opener && !window.opener.closed) {
|
if (window.opener && !window.opener.closed) {
|
||||||
window.opener.focus();
|
window.opener.focus();
|
||||||
window.close();
|
|
||||||
} else {
|
|
||||||
goBackToLesson();
|
|
||||||
}
|
}
|
||||||
|
router.replace({ name: 'TeacherBroadcastThanks' });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理环节切换
|
// 处理环节切换
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user