This commit is contained in:
DESKTOP-FUDKNA8\znjsz 2024-01-26 16:01:56 +08:00
parent 9b3779555c
commit b6b17d1ef0
6 changed files with 51 additions and 33 deletions

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, watch } from "vue";
import { ref, onMounted } from "vue";
import Tools from "./components/Tools.vue";
import NavMenu from "./components/NavMenu.vue";
import AnnoucementPage from "./pages/AnnouncementPage.vue";
@ -20,28 +20,45 @@ const handlePageChange = (page) => {
};
const mainContainer = ref(null);
const { settings } = useSettings();
const store = useSettings();
const timer = ref(null);
watch(() => settings.carousel, val => {
if (val) {
timer.value = setInterval(() => {
handlePageChange(pages[(pages.indexOf(currentPage.value) + 1) % pages.length])
}, settings.carouselTime * 1000);
return;
}
clearInterval(timer.value);
timer.value = null;
})
watch(() => settings.carouselTime, val => {
if (val > 0) {
store.$subscribe((mutation, state) => {
//
if (mutation.events.key == 'carouselTime' && state.settings.carouselTime > 0 && state.settings.carousel) {
if (timer.value) clearInterval(timer.value);
timer.value = setInterval(() => {
handlePageChange(pages[(pages.indexOf(currentPage.value) + 1) % pages.length])
}, val * 1000);
}, state.settings.carouselTime * 1000);
} else if (mutation.events.key == 'carousel') {
//
if (state.settings.carousel) {
timer.value = setInterval(() => {
handlePageChange(pages[(pages.indexOf(currentPage.value) + 1) % pages.length])
}, state.settings.carouselTime * 1000);
} else {
clearInterval(timer.value);
timer.value = null;
}
}
})
//
onMounted(() => {
const settings = store.settings;
if (settings.carousel) {
//
if (timer.value) clearInterval(timer.value);
timer.value = setInterval(() => {
handlePageChange(pages[(pages.indexOf(currentPage.value) + 1) % pages.length])
}, settings.carouselTime * 1000);
}
//
handleResolutionChange(settings.resolution.width, settings.resolution.height);
})
const pathMap = {
// 线
'/3-1': 1,

View File

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

View File

@ -62,9 +62,9 @@ const handleClick = (page) => {
z-index: 10;
}
:fullscreen .nav-menu {
/* :fullscreen .nav-menu {
top: 25%;
}
} */
.flex-list {
display: flex;

View File

@ -8,25 +8,25 @@ import { useSettings } from '../store/settings';
const emit = defineEmits(['change-resolution'])
const store = useSettings();
const settings = ref(store.settings)
store.$subscribe((_, state) => {
settings.value.carousel = state.settings.carousel;
})
const { settings, updateSettings } = useSettings();
// store.$subscribe((_, state) => {
// settings.value.carousel = state.settings.carousel;
// })
const visible = ref(false);
function toHome() {
// document.location.href = '/1-1'
document.location.reload()
}
function showDialog() {
visible.value = true;
}
function toggleLunbo() {
settings.value.carousel = !settings.value.carousel;
updateSettings({ type: 'carousel', value: null })
}
function handleChangeResolution(w, h) {
emit('change-resolution', w, h)
emit('change-resolution', w, h);
visible.value = false;
}
</script>
@ -40,7 +40,7 @@ function handleChangeResolution(w, h) {
</button>
<button style="position: relative;" @click="toggleLunbo">
<span v-if="settings.carousel"
style="color: #fffa; font-family: 'Courier New', Courier, monospace; font-weight:600; font-size: 22px; user-select: none; position: absolute; line-height: 52px; text-align: center;">
style="color: #fffa; font-family: 'Courier New', Courier, monospace; font-weight:600; width: 56px; font-size: 22px; user-select: none; position: absolute; line-height: 52px; text-align: center;">
{{ settings.carouselTime }}S</span>
<IconExchange :color="settings.carousel ? '#03356a' : '#50A1EC'" />
</button>

View File

@ -629,9 +629,9 @@ watch(() => settings.fullscreen, val => {
transform: translateX(-58%);
}
:fullscreen .absolute-full {
/* :fullscreen .absolute-full {
transform: translateX(-80%);
}
} */
.info-1 .info:nth-child(1) {
/* left: 490px;

View File

@ -27,7 +27,8 @@ export const useSettings = defineStore("settings", () => {
watch(
() => settings.value.fullscreen,
(val) => {
const mainContainer = document.getElementById("main-container");
// const mainContainer = document.getElementById("main-container");
const mainContainer = document.documentElement;
if (val) {
mainContainer.requestFullscreen().then(() => {
document.removeEventListener("fullscreenchange", clearFullscreenFlag);