2022-09-06 11:52:18 +00:00
|
|
|
<template>
|
2023-10-10 05:41:15 +00:00
|
|
|
<NuxtLayout>
|
2022-09-14 14:26:41 +00:00
|
|
|
<NuxtPage />
|
|
|
|
</NuxtLayout>
|
2022-09-06 11:52:18 +00:00
|
|
|
</template>
|
2022-09-06 13:53:29 +00:00
|
|
|
|
|
|
|
<script>
|
2023-01-30 22:50:55 +00:00
|
|
|
import News from '@/assets/data/news.json';
|
2023-02-28 08:29:30 +00:00
|
|
|
import EventBus from '@/layouts/AppEventBus';
|
2022-09-09 14:35:31 +00:00
|
|
|
|
2022-09-09 10:25:14 +00:00
|
|
|
export default {
|
|
|
|
themeChangeListener: null,
|
|
|
|
newsActivate: null,
|
2023-02-28 08:29:30 +00:00
|
|
|
newsService: null,
|
2023-10-15 04:10:40 +00:00
|
|
|
watch: {
|
|
|
|
$route: {
|
|
|
|
handler(to) {
|
|
|
|
if (to.name === 'index') {
|
|
|
|
this.themeChangeListener({ theme: this.$appState.darkTheme ? 'lara-dark-teal' : 'lara-light-teal', dark: this.$appState.darkTheme });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2022-09-09 10:25:14 +00:00
|
|
|
mounted() {
|
2023-01-30 22:50:55 +00:00
|
|
|
this.newsActivate = () => {
|
|
|
|
this.$appState.announcement = News;
|
|
|
|
const itemString = localStorage.getItem(this.$appState.storageKey);
|
2022-12-08 12:26:57 +00:00
|
|
|
|
2023-01-30 22:50:55 +00:00
|
|
|
if (itemString) {
|
|
|
|
const item = JSON.parse(itemString);
|
2022-12-08 12:26:57 +00:00
|
|
|
|
2023-02-28 08:29:30 +00:00
|
|
|
if (!item.hiddenNews || item.hiddenNews !== News.id) {
|
2022-09-09 10:25:14 +00:00
|
|
|
this.$appState.newsActive = true;
|
2023-02-28 08:29:30 +00:00
|
|
|
} else this.$appState.newsActive = false;
|
|
|
|
} else {
|
2023-01-30 22:50:55 +00:00
|
|
|
this.$appState.newsActive = true;
|
|
|
|
}
|
|
|
|
};
|
2022-09-09 10:25:14 +00:00
|
|
|
|
|
|
|
this.themeChangeListener = (event) => {
|
2023-03-03 07:02:10 +00:00
|
|
|
this.$primevue.changeTheme(this.$appState.theme, event.theme, 'theme-link', () => {
|
|
|
|
this.$appState.theme = event.theme;
|
|
|
|
this.$appState.darkTheme = event.dark;
|
2023-10-13 20:06:19 +00:00
|
|
|
EventBus.emit('theme-change-complete', { theme: event.theme, dark: event.dark });
|
2022-09-09 10:25:14 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
EventBus.on('theme-change', this.themeChangeListener);
|
2023-01-30 22:50:55 +00:00
|
|
|
EventBus.on('news-activate', this.newsActivate);
|
2022-09-09 10:25:14 +00:00
|
|
|
},
|
|
|
|
beforeUnmount() {
|
|
|
|
EventBus.off('theme-change', this.themeChangeListener);
|
2023-01-30 22:50:55 +00:00
|
|
|
EventBus.off('news-activate', this.newsActivate);
|
2022-09-09 10:25:14 +00:00
|
|
|
}
|
2022-09-14 14:26:41 +00:00
|
|
|
};
|
|
|
|
</script>
|
2022-12-09 09:02:20 +00:00
|
|
|
|
2023-09-25 11:09:54 +00:00
|
|
|
<style lang="scss"></style>
|