|
@@ -48,7 +48,27 @@ import playLoadData from './datas/data.json'
|
|
|
export default defineComponent({
|
|
|
name: 'CoursewarePlay',
|
|
|
setup() {
|
|
|
+ /** 设置播放容器 16:9 */
|
|
|
+ const parentContainer = reactive({
|
|
|
+ width: '100vw'
|
|
|
+ })
|
|
|
+ const setContainer = () => {
|
|
|
+ let min = Math.min(screen.width, screen.height)
|
|
|
+ let max = Math.max(screen.width, screen.height)
|
|
|
+ let width = min * (16 / 9)
|
|
|
+ console.log('计算的屏幕宽度', width, max)
|
|
|
+ if (width > max) {
|
|
|
+ parentContainer.width = '100vw'
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ parentContainer.width = width + 'px'
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log('设置宽度', parentContainer.width)
|
|
|
+ }
|
|
|
const handleInit = (type = 0) => {
|
|
|
+ //设置容器16:9
|
|
|
+ setContainer()
|
|
|
// 横屏
|
|
|
postMessage({
|
|
|
api: 'setRequestedOrientation',
|
|
@@ -76,24 +96,6 @@ export default defineComponent({
|
|
|
handleInit(1)
|
|
|
window.removeEventListener('message', iframeHandle)
|
|
|
})
|
|
|
- /** 设置播放容器 16:9 */
|
|
|
- const parentContainer = reactive({
|
|
|
- width: '100vw'
|
|
|
- })
|
|
|
- const setContainer = () => {
|
|
|
- let min = Math.min(screen.width, screen.height)
|
|
|
- let max = Math.max(screen.width, screen.height)
|
|
|
- let width = min * (16 / 9)
|
|
|
- console.log('计算的屏幕宽度', width, max)
|
|
|
- if (width > max){
|
|
|
- parentContainer.width = '100vw'
|
|
|
- return
|
|
|
- } else {
|
|
|
- parentContainer.width = width + 'px'
|
|
|
- }
|
|
|
-
|
|
|
- console.log('设置宽度', parentContainer.width)
|
|
|
- }
|
|
|
|
|
|
const route = useRoute()
|
|
|
const headeRef = ref()
|
|
@@ -241,7 +243,6 @@ export default defineComponent({
|
|
|
}
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
- setContainer()
|
|
|
getDetail()
|
|
|
getCourseSchedule()
|
|
|
window.addEventListener('message', iframeHandle)
|