From 7c3dac4212ebfccf0e6377c6b519c78d1efd6341 Mon Sep 17 00:00:00 2001 From: wenyuan <49969025+wenyuanw@users.noreply.github.com> Date: Tue, 10 Jun 2025 17:57:10 +0800 Subject: [PATCH] feat(projects): add configurable user name watermark option --- src/App.vue | 9 ++++++++- src/layouts/modules/theme-drawer/modules/page-fun.vue | 5 ++++- src/locales/langs/en-us.ts | 3 ++- src/locales/langs/zh-cn.ts | 3 ++- src/theme/settings.ts | 3 ++- src/typings/app.d.ts | 3 +++ 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/App.vue b/src/App.vue index e617af50..014a6428 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,6 +4,7 @@ import { NConfigProvider, darkTheme } from 'naive-ui'; import type { WatermarkProps } from 'naive-ui'; import { useAppStore } from './store/modules/app'; import { useThemeStore } from './store/modules/theme'; +import { useAuthStore } from './store/modules/auth'; import { naiveDateLocales, naiveLocales } from './locales/naive'; defineOptions({ @@ -12,6 +13,7 @@ defineOptions({ const appStore = useAppStore(); const themeStore = useThemeStore(); +const authStore = useAuthStore(); const naiveDarkTheme = computed(() => (themeStore.darkMode ? darkTheme : undefined)); @@ -24,8 +26,13 @@ const naiveDateLocale = computed(() => { }); const watermarkProps = computed(() => { + const content = + themeStore.watermark.enableUserName && authStore.userInfo.userName + ? authStore.userInfo.userName + : themeStore.watermark.text; + return { - content: themeStore.watermark.text, + content, cross: true, fullscreen: true, fontSize: 16, diff --git a/src/layouts/modules/theme-drawer/modules/page-fun.vue b/src/layouts/modules/theme-drawer/modules/page-fun.vue index aa0aadab..0b00f2bd 100644 --- a/src/layouts/modules/theme-drawer/modules/page-fun.vue +++ b/src/layouts/modules/theme-drawer/modules/page-fun.vue @@ -117,7 +117,10 @@ const isWrapperScrollMode = computed(() => themeStore.layout.scrollMode === 'wra - + + + +