File tree Expand file tree Collapse file tree 6 files changed +21
-5
lines changed
layouts/modules/theme-drawer/modules Expand file tree Collapse file tree 6 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { NConfigProvider, darkTheme } from 'naive-ui';
44import type { WatermarkProps } from ' naive-ui' ;
55import { useAppStore } from ' ./store/modules/app' ;
66import { useThemeStore } from ' ./store/modules/theme' ;
7+ import { useAuthStore } from ' ./store/modules/auth' ;
78import { naiveDateLocales , naiveLocales } from ' ./locales/naive' ;
89
910defineOptions ({
@@ -12,6 +13,7 @@ defineOptions({
1213
1314const appStore = useAppStore ();
1415const themeStore = useThemeStore ();
16+ const authStore = useAuthStore ();
1517
1618const naiveDarkTheme = computed (() => (themeStore .darkMode ? darkTheme : undefined ));
1719
@@ -24,8 +26,13 @@ const naiveDateLocale = computed(() => {
2426});
2527
2628const watermarkProps = computed <WatermarkProps >(() => {
29+ const content =
30+ themeStore .watermark .enableUserName && authStore .userInfo .userName
31+ ? authStore .userInfo .userName
32+ : themeStore .watermark .text ;
33+
2734 return {
28- content: themeStore . watermark . text ,
35+ content ,
2936 cross: true ,
3037 fullscreen: true ,
3138 fontSize: 16 ,
Original file line number Diff line number Diff line change @@ -117,7 +117,10 @@ const isWrapperScrollMode = computed(() => themeStore.layout.scrollMode === 'wra
117117 <SettingItem key =" 8" :label =" $t('theme.watermark.visible')" >
118118 <NSwitch v-model:value =" themeStore.watermark.visible" />
119119 </SettingItem >
120- <SettingItem v-if =" themeStore.watermark.visible" key =" 8-1" :label =" $t('theme.watermark.text')" >
120+ <SettingItem v-if =" themeStore.watermark.visible" key =" 8-1" :label =" $t('theme.watermark.enableUserName')" >
121+ <NSwitch v-model:value =" themeStore.watermark.enableUserName" />
122+ </SettingItem >
123+ <SettingItem v-if =" themeStore.watermark.visible" key =" 8-2" :label =" $t('theme.watermark.text')" >
121124 <NInput
122125 v-model:value =" themeStore.watermark.text"
123126 autosize
Original file line number Diff line number Diff line change @@ -143,7 +143,8 @@ const local: App.I18n.Schema = {
143143 } ,
144144 watermark : {
145145 visible : 'Watermark Full Screen Visible' ,
146- text : 'Watermark Text'
146+ text : 'Watermark Text' ,
147+ enableUserName : 'Enable User Name Watermark'
147148 } ,
148149 themeDrawerTitle : 'Theme Configuration' ,
149150 pageFunTitle : 'Page Function' ,
Original file line number Diff line number Diff line change @@ -143,7 +143,8 @@ const local: App.I18n.Schema = {
143143 } ,
144144 watermark : {
145145 visible : '显示全屏水印' ,
146- text : '水印文本'
146+ text : '水印文本' ,
147+ enableUserName : '启用用户名水印'
147148 } ,
148149 themeDrawerTitle : '主题配置' ,
149150 pageFunTitle : '页面功能' ,
Original file line number Diff line number Diff line change @@ -58,7 +58,8 @@ export const themeSettings: App.Theme.ThemeSetting = {
5858 } ,
5959 watermark : {
6060 visible : false ,
61- text : 'SoybeanAdmin'
61+ text : 'SoybeanAdmin' ,
62+ enableUserName : false
6263 } ,
6364 tokens : {
6465 light : {
Original file line number Diff line number Diff line change @@ -112,6 +112,8 @@ declare namespace App {
112112 visible : boolean ;
113113 /** Watermark text */
114114 text : string ;
115+ /** Whether to use user name as watermark text */
116+ enableUserName : boolean ;
115117 } ;
116118 /** define some theme settings tokens, will transform to css variables */
117119 tokens : {
@@ -408,6 +410,7 @@ declare namespace App {
408410 watermark : {
409411 visible : string ;
410412 text : string ;
413+ enableUserName : string ;
411414 } ;
412415 themeDrawerTitle : string ;
413416 pageFunTitle : string ;
You can’t perform that action at this time.
0 commit comments