|
@@ -453,8 +453,8 @@ const openWorkModal = (work: WorkItem) => {
|
|
|
// 计算幻灯片尺寸的函数
|
|
|
const calculateSlideSize = () => {
|
|
|
const slideWrapRef = isFullscreen.value ? document.body : viewerCanvasRef.value
|
|
|
- const winWidth = slideWrapRef.clientWidth
|
|
|
- const winHeight = slideWrapRef.clientHeight
|
|
|
+ const winWidth = slideWrapRef?.clientWidth || 0
|
|
|
+ const winHeight = slideWrapRef?.clientHeight || 0
|
|
|
|
|
|
// 根据视口比例计算最佳尺寸
|
|
|
if (winHeight / winWidth === viewportRatio.value) {
|
|
@@ -469,6 +469,7 @@ const calculateSlideSize = () => {
|
|
|
slideWidth.value = winHeight / viewportRatio.value
|
|
|
slideHeight.value = winHeight
|
|
|
}
|
|
|
+
|
|
|
console.log('calculateSlideSize', slideWidth.value, slideHeight.value, viewportRatio.value, canvasScale.value)
|
|
|
}
|
|
|
|
|
@@ -509,13 +510,18 @@ const calculateScale = () => {
|
|
|
const scale = Math.min(scaleX, scaleY) * 0.9
|
|
|
|
|
|
console.log('最终缩放比例:', scale)
|
|
|
- canvasScale.value = isFullscreen.value ? 1 : props.type == '1' ? 0.9 : 0.95
|
|
|
+ canvasScale.value = isFullscreen.value ? 1 : props.type == '1' ? 1 : 1
|
|
|
+ // canvasScale.value = 1
|
|
|
}
|
|
|
else {
|
|
|
console.error('找不到容器元素')
|
|
|
}
|
|
|
// 计算幻灯片尺寸
|
|
|
- calculateSlideSize()
|
|
|
+ nextTick(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ calculateSlideSize()
|
|
|
+ }, 500)
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
// 简化:直接使用放映功能的缩放逻辑
|
|
@@ -641,7 +647,7 @@ const handleFullscreenChange = () => {
|
|
|
nextTick(() => {
|
|
|
setTimeout(() => {
|
|
|
calculateScale()
|
|
|
- }, 500)
|
|
|
+ }, 1000)
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -1370,6 +1376,37 @@ const getCourseDetail = async () => {
|
|
|
}
|
|
|
finally {
|
|
|
isLoading.value = false
|
|
|
+ if (props.type == '2') {
|
|
|
+ console.log('判断是否是学生进入全屏')
|
|
|
+ function panFull() {
|
|
|
+ console.log('判断是否是学生进入全屏111')
|
|
|
+ if (!document.fullscreenElement) {
|
|
|
+ setTimeout(() => {
|
|
|
+ if (!document.fullscreenElement) {
|
|
|
+ if (document.documentElement.requestFullscreen) {
|
|
|
+ document.documentElement.requestFullscreen()
|
|
|
+ }
|
|
|
+ else if (document.documentElement.mozRequestFullScreen) { // Firefox
|
|
|
+ document.documentElement.mozRequestFullScreen()
|
|
|
+ }
|
|
|
+ else if (document.documentElement.webkitRequestFullscreen) { // Chrome, Safari and Opera
|
|
|
+ document.documentElement.webkitRequestFullscreen()
|
|
|
+ }
|
|
|
+ else if (document.documentElement.msRequestFullscreen) { // IE/Edge
|
|
|
+ document.documentElement.msRequestFullscreen()
|
|
|
+ }
|
|
|
+ panFull()
|
|
|
+ }
|
|
|
+ }, 50)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ nextTick(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ // enterFullscreen();
|
|
|
+ panFull()
|
|
|
+ }, 50)
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|