fix fullscreen

This commit is contained in:
DESKTOP-FUDKNA8\znjsz 2024-01-26 16:35:51 +08:00
parent b6b17d1ef0
commit 259752291c
5 changed files with 46 additions and 41 deletions

View File

@ -1,7 +1,7 @@
<script setup> <script setup>
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import MainPage from "./MainPage.vue"; import MainPage from "./MainPage.vue";
import Slider from "./components/Slider.vue"; // import Slider from "./components/Slider.vue";
import useWebsocket from "./utils/useWebsocket"; import useWebsocket from "./utils/useWebsocket";
import { useWsStore } from "./store"; import { useWsStore } from "./store";
const store = useWsStore(); const store = useWsStore();
@ -40,8 +40,10 @@ useWebsocket(store, urlPath.value);
<style scoped> <style scoped>
#app-container { #app-container {
width: 100vw; /* width: 100vw;
height: 100vh; height: 100vh; */
background: #fff; background: #fff;
height: 100%;
display: inline-block;
} }
</style> </style>

View File

@ -44,19 +44,19 @@ store.$subscribe((mutation, state) => {
}) })
// // //
onMounted(() => { // onMounted(() => {
const settings = store.settings; // const settings = store.settings;
if (settings.carousel) { // if (settings.carousel) {
// // //
if (timer.value) clearInterval(timer.value); // if (timer.value) clearInterval(timer.value);
timer.value = setInterval(() => { // timer.value = setInterval(() => {
handlePageChange(pages[(pages.indexOf(currentPage.value) + 1) % pages.length]) // handlePageChange(pages[(pages.indexOf(currentPage.value) + 1) % pages.length])
}, settings.carouselTime * 1000); // }, settings.carouselTime * 1000);
} // }
// // //
handleResolutionChange(settings.resolution.width, settings.resolution.height); // handleResolutionChange(settings.resolution.width, settings.resolution.height);
}) // })
const pathMap = { const pathMap = {
@ -78,9 +78,11 @@ const pathMap = {
} }
function handleResolutionChange(width, height) { function handleResolutionChange(width, height) {
console.log('document.documentElement', document.documentElement)
if (mainContainer.value) { if (mainContainer.value) {
// mainContainer.value.style.width = `${width}px`; // mainContainer.value.style.width = `${width}px`;
// mainContainer.value.style.height = `${height}px`; // mainContainer.value.style.height = `${height}px`;
// changeScale(mainContainer.value, width, height)
changeScale(mainContainer.value, width, height) changeScale(mainContainer.value, width, height)
} }
} }
@ -128,10 +130,6 @@ function resetScale(elm) {
position: relative; position: relative;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
/**
background: url('https://img1.baidu.com/it/u=2052683582,2603151390&fm=253&fmt=auto&app=120&f=JPEG?w=1422&h=800')
100% / 100% no-repeat;
*/
background: url(./assets/bg.png) 100% / cover no-repeat; background: url(./assets/bg.png) 100% / cover no-repeat;
} }

View File

@ -28,8 +28,9 @@ onMounted(() => {
line-height: 1; line-height: 1;
} }
/* :fullscreen .datetime { :fullscreen .datetime {
right: 620px; /* right: 620px;
top: 56px; top: 56px; */
} */ color: red;
}
</style> </style>

View File

@ -53,23 +53,23 @@ function changeScale(elm, width, height) {
elm.style.transform = style.transform; elm.style.transform = style.transform;
elm.style.transformOrigin = style.transformOrigin; elm.style.transformOrigin = style.transformOrigin;
} }
onMounted(() => { // onMounted(() => {
if (document.fullscreenElement && part3d.value) { // if (document.fullscreenElement && part3d.value) {
changeScale(part3d.value, document.documentElement.clientWidth, document.documentElement.clientHeight) // changeScale(part3d.value, document.documentElement.clientWidth, document.documentElement.clientHeight)
} // }
}) // })
watch(() => settings.fullscreen, val => { // watch(() => settings.fullscreen, val => {
if (val) { // if (val) {
// // //
if (part3d.value) { // if (part3d.value) {
changeScale(part3d.value, document.documentElement.clientWidth, document.documentElement.clientHeight) // changeScale(part3d.value, document.documentElement.clientWidth, document.documentElement.clientHeight)
} // }
} else { // } else {
if (part3d.value) { // if (part3d.value) {
changeScale(part3d.value, 1920, 900) // changeScale(part3d.value, 1920, 900)
} // }
} // }
}, { immediate: true }) // }, { immediate: true })
</script> </script>
<template> <template>

View File

@ -3,3 +3,7 @@
margin: 0; margin: 0;
font-family: '黑体', Arial, Helvetica, sans-serif; font-family: '黑体', Arial, Helvetica, sans-serif;
} }
html, body {
height: 100%;
}