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';
4
4
import type { WatermarkProps } from ' naive-ui' ;
5
5
import { useAppStore } from ' ./store/modules/app' ;
6
6
import { useThemeStore } from ' ./store/modules/theme' ;
7
+ import { useAuthStore } from ' ./store/modules/auth' ;
7
8
import { naiveDateLocales , naiveLocales } from ' ./locales/naive' ;
8
9
9
10
defineOptions ({
@@ -12,6 +13,7 @@ defineOptions({
12
13
13
14
const appStore = useAppStore ();
14
15
const themeStore = useThemeStore ();
16
+ const authStore = useAuthStore ();
15
17
16
18
const naiveDarkTheme = computed (() => (themeStore .darkMode ? darkTheme : undefined ));
17
19
@@ -24,8 +26,13 @@ const naiveDateLocale = computed(() => {
24
26
});
25
27
26
28
const watermarkProps = computed <WatermarkProps >(() => {
29
+ const content =
30
+ themeStore .watermark .enableUserName && authStore .userInfo .userName
31
+ ? authStore .userInfo .userName
32
+ : themeStore .watermark .text ;
33
+
27
34
return {
28
- content: themeStore . watermark . text ,
35
+ content ,
29
36
cross: true ,
30
37
fullscreen: true ,
31
38
fontSize: 16 ,
Original file line number Diff line number Diff line change @@ -117,7 +117,10 @@ const isWrapperScrollMode = computed(() => themeStore.layout.scrollMode === 'wra
117
117
<SettingItem key =" 8" :label =" $t('theme.watermark.visible')" >
118
118
<NSwitch v-model:value =" themeStore.watermark.visible" />
119
119
</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')" >
121
124
<NInput
122
125
v-model:value =" themeStore.watermark.text"
123
126
autosize
Original file line number Diff line number Diff line change @@ -143,7 +143,8 @@ const local: App.I18n.Schema = {
143
143
} ,
144
144
watermark : {
145
145
visible : 'Watermark Full Screen Visible' ,
146
- text : 'Watermark Text'
146
+ text : 'Watermark Text' ,
147
+ enableUserName : 'Enable User Name Watermark'
147
148
} ,
148
149
themeDrawerTitle : 'Theme Configuration' ,
149
150
pageFunTitle : 'Page Function' ,
Original file line number Diff line number Diff line change @@ -143,7 +143,8 @@ const local: App.I18n.Schema = {
143
143
} ,
144
144
watermark : {
145
145
visible : '显示全屏水印' ,
146
- text : '水印文本'
146
+ text : '水印文本' ,
147
+ enableUserName : '启用用户名水印'
147
148
} ,
148
149
themeDrawerTitle : '主题配置' ,
149
150
pageFunTitle : '页面功能' ,
Original file line number Diff line number Diff line change @@ -58,7 +58,8 @@ export const themeSettings: App.Theme.ThemeSetting = {
58
58
} ,
59
59
watermark : {
60
60
visible : false ,
61
- text : 'SoybeanAdmin'
61
+ text : 'SoybeanAdmin' ,
62
+ enableUserName : false
62
63
} ,
63
64
tokens : {
64
65
light : {
Original file line number Diff line number Diff line change @@ -112,6 +112,8 @@ declare namespace App {
112
112
visible : boolean ;
113
113
/** Watermark text */
114
114
text : string ;
115
+ /** Whether to use user name as watermark text */
116
+ enableUserName : boolean ;
115
117
} ;
116
118
/** define some theme settings tokens, will transform to css variables */
117
119
tokens : {
@@ -408,6 +410,7 @@ declare namespace App {
408
410
watermark : {
409
411
visible : string ;
410
412
text : string ;
413
+ enableUserName : string ;
411
414
} ;
412
415
themeDrawerTitle : string ;
413
416
pageFunTitle : string ;
You can’t perform that action at this time.
0 commit comments