Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
129 lines
2.9 KiB
Vue
129 lines
2.9 KiB
Vue
<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> -->
|