gtsoft-snail-job-admin/src/App.vue

62 lines
1.7 KiB
Vue
Raw Normal View History

2024-03-08 17:59:45 +08:00
<script setup lang="ts">
import { computed } from 'vue';
2024-03-21 10:57:53 +08:00
import { NConfigProvider, darkTheme } from 'naive-ui';
2024-08-09 14:39:33 +08:00
import type { WatermarkProps } from 'naive-ui';
2024-03-08 17:59:45 +08:00
import { useAppStore } from './store/modules/app';
import { useThemeStore } from './store/modules/theme';
2024-03-21 10:57:53 +08:00
import { naiveDateLocales, naiveLocales } from './locales/naive';
import { useAuthStore } from './store/modules/auth';
2024-03-08 17:59:45 +08:00
defineOptions({
name: 'App'
});
const appStore = useAppStore();
const themeStore = useThemeStore();
const { userInfo } = useAuthStore();
2024-03-21 10:57:53 +08:00
const naiveDarkTheme = computed(() => (themeStore.darkMode ? darkTheme : undefined));
const naiveLocale = computed(() => {
return naiveLocales[appStore.locale];
});
const naiveDateLocale = computed(() => {
return naiveDateLocales[appStore.locale];
2024-03-08 17:59:45 +08:00
});
2024-08-09 14:39:33 +08:00
const watermarkProps = computed<WatermarkProps>(() => {
const appTitle = import.meta.env.VITE_APP_TITLE || themeStore.watermark.text;
2024-08-09 14:39:33 +08:00
return {
content: userInfo.userName ? `${userInfo.userName}@${appTitle} ${userInfo.username}` : appTitle,
2024-08-09 14:39:33 +08:00
cross: true,
fullscreen: true,
fontSize: 14,
fontColor: themeStore.darkMode ? 'rgba(200, 200, 200, 0.03)' : 'rgba(200, 200, 200, 0.2)',
lineHeight: 14,
width: 200,
height: 300,
2024-08-09 14:39:33 +08:00
xOffset: 12,
yOffset: 60,
rotate: -18,
2024-08-09 14:39:33 +08:00
zIndex: 9999
};
});
2024-03-08 17:59:45 +08:00
</script>
<template>
2024-03-21 10:57:53 +08:00
<NConfigProvider
:theme="naiveDarkTheme"
:theme-overrides="themeStore.naiveTheme"
:locale="naiveLocale"
:date-locale="naiveDateLocale"
class="h-full"
>
2024-03-08 17:59:45 +08:00
<AppProvider>
<RouterView class="bg-layout" />
2024-08-09 14:39:33 +08:00
<NWatermark v-if="themeStore.watermark?.visible" v-bind="watermarkProps" />
2024-03-08 17:59:45 +08:00
</AppProvider>
2024-03-21 10:57:53 +08:00
</NConfigProvider>
2024-03-08 17:59:45 +08:00
</template>
<style scoped></style>