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> <script setup>
import { ref, watch } from "vue"; import { ref, onMounted } from "vue";
import Tools from "./components/Tools.vue"; import Tools from "./components/Tools.vue";
import NavMenu from "./components/NavMenu.vue"; import NavMenu from "./components/NavMenu.vue";
import AnnoucementPage from "./pages/AnnouncementPage.vue"; import AnnoucementPage from "./pages/AnnouncementPage.vue";
@ -20,28 +20,45 @@ const handlePageChange = (page) => {
}; };
const mainContainer = ref(null); const mainContainer = ref(null);
const { settings } = useSettings(); const store = useSettings();
const timer = ref(null); 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 => { store.$subscribe((mutation, state) => {
if (val > 0) { //
if (mutation.events.key == 'carouselTime' && state.settings.carouselTime > 0 && state.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])
}, 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 = { const pathMap = {
// 线 // 线
'/3-1': 1, '/3-1': 1,

View File

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

View File

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

View File

@ -8,25 +8,25 @@ import { useSettings } from '../store/settings';
const emit = defineEmits(['change-resolution']) const emit = defineEmits(['change-resolution'])
const store = useSettings(); const { settings, updateSettings } = useSettings();
const settings = ref(store.settings) // store.$subscribe((_, state) => {
store.$subscribe((_, state) => { // settings.value.carousel = state.settings.carousel;
settings.value.carousel = state.settings.carousel; // })
})
const visible = ref(false); const visible = ref(false);
function toHome() { function toHome() {
// document.location.href = '/1-1'
document.location.reload() document.location.reload()
} }
function showDialog() { function showDialog() {
visible.value = true; visible.value = true;
} }
function toggleLunbo() { function toggleLunbo() {
settings.value.carousel = !settings.value.carousel; updateSettings({ type: 'carousel', value: null })
} }
function handleChangeResolution(w, h) { function handleChangeResolution(w, h) {
emit('change-resolution', w, h) emit('change-resolution', w, h);
visible.value = false;
} }
</script> </script>
@ -40,7 +40,7 @@ function handleChangeResolution(w, h) {
</button> </button>
<button style="position: relative;" @click="toggleLunbo"> <button style="position: relative;" @click="toggleLunbo">
<span v-if="settings.carousel" <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> {{ settings.carouselTime }}S</span>
<IconExchange :color="settings.carousel ? '#03356a' : '#50A1EC'" /> <IconExchange :color="settings.carousel ? '#03356a' : '#50A1EC'" />
</button> </button>

View File

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

View File

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