Files
super_video/src/App.vue
T
2026-09-21 10:30:13 +08:00

129 lines
2.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div
class="app-container"
:style="containerStyle"
>
<div
class="app-content overflow-hidden"
:style="scaleStyle"
>
<router-view
v-if="!bootstrapLoading"
v-slot="{ Component }"
>
<KeepAlive :include="['Action', 'Skill']">
<component :is="Component" />
</KeepAlive>
</router-view>
</div>
<div class="rotate-hint">请横屏观看,以获得最佳体验</div>
<LoadingOverlay
:visible="bootstrapLoading"
text="正在加载学习数据..."
/>
</div>
</template>
<script setup lang="ts">
import { useScale } from '@/composables/useScale'
import {
useUserStore,
useVlogStore,
useFilmStore,
useInterviewStore,
useBasicElementsStore,
} from '@/stores'
import { onMounted, ref } from 'vue'
import { syncAllCompletedYibanLessons } from '@/utils/yibanLessonProgress'
import { initializeStorageBackend } from '@/utils/yiban'
import LoadingOverlay from '@/components/Loading/LoadingOverlay.vue'
// 使用等比例缩放hook
const { scaleStyle } = useScale()
const userStore = useUserStore()
const vlogStore = useVlogStore()
const filmStore = useFilmStore()
const interviewStore = useInterviewStore()
const basicElementsStore = useBasicElementsStore()
// 易班数据读取期间的全屏 loading
const bootstrapLoading = ref(true)
onMounted(async () => {
const params = new URLSearchParams(window.location.search)
const courseId = params.get('courseid')
const uid = params.get('uid')
if (courseId || uid) {
userStore.setCourseInfo({
courseId: courseId ?? null,
uid: uid ?? null,
})
}
try {
await initializeStorageBackend()
await Promise.allSettled([
vlogStore.loadVlogStore(),
filmStore.loadFilmStore(),
interviewStore.loadInterviewStore(),
basicElementsStore.loadBasicElementsStore(),
])
} finally {
bootstrapLoading.value = false
}
await syncAllCompletedYibanLessons()
})
// 容器样式
const containerStyle = {
width: '100vw',
height: '100vh',
overflow: 'hidden',
position: 'relative' as const,
background: '#000',
}
</script>
<style scoped>
.rotate-hint {
position: fixed;
inset: 0;
z-index: 200000;
display: none;
align-items: center;
justify-content: center;
padding: 24px;
color: #fff;
font-size: 20px;
line-height: 1.5;
text-align: center;
background: rgba(0, 0, 0, 0.55)
radial-gradient(
circle at center,
rgba(255, 255, 255, 0.1),
rgba(0, 0, 0, 0.6)
);
}
@media (hover: none) and (pointer: coarse) and (orientation: portrait) {
.rotate-hint {
display: flex;
}
}
</style>
<!-- <style>
#app {
font-family:
-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell',
'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style> -->