feat(projects): add full screen watermark. close#571 (#573)

This commit is contained in:
paynezhuang 2024-07-29 23:04:26 +08:00 committed by GitHub
parent 4dde4c22b1
commit ea8aa6c4e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 54 additions and 0 deletions

View File

@ -21,6 +21,22 @@ const naiveLocale = computed(() => {
const naiveDateLocale = computed(() => { const naiveDateLocale = computed(() => {
return naiveDateLocales[appStore.locale]; return naiveDateLocales[appStore.locale];
}); });
const watermarkProps = computed(() => {
return {
content: themeStore.watermark.text,
cross: true,
fullscreen: true,
fontSize: 16,
lineHeight: 16,
width: 384,
height: 384,
xOffset: 12,
yOffset: 60,
rotate: -15,
zIndex: 9999
};
});
</script> </script>
<template> <template>
@ -33,6 +49,7 @@ const naiveDateLocale = computed(() => {
> >
<AppProvider> <AppProvider>
<RouterView class="bg-layout" /> <RouterView class="bg-layout" />
<NWatermark v-if="themeStore.watermark.visible" v-bind="watermarkProps" />
</AppProvider> </AppProvider>
</NConfigProvider> </NConfigProvider>
</template> </template>

View File

@ -101,6 +101,19 @@ const isWrapperScrollMode = computed(() => themeStore.layout.scrollMode === 'wra
> >
<NSwitch v-model:value="themeStore.footer.right" /> <NSwitch v-model:value="themeStore.footer.right" />
</SettingItem> </SettingItem>
<SettingItem key="8" :label="$t('theme.watermark.visible')">
<NSwitch v-model:value="themeStore.watermark.visible" />
</SettingItem>
<SettingItem v-if="themeStore.watermark.visible" key="8-1" :label="$t('theme.watermark.text')">
<NInput
v-model:value="themeStore.watermark.text"
autosize
type="text"
size="small"
class="w-120px"
placeholder="SoybeanAdmin"
/>
</SettingItem>
</TransitionGroup> </TransitionGroup>
</template> </template>

View File

@ -135,6 +135,10 @@ const local: App.I18n.Schema = {
height: 'Footer Height', height: 'Footer Height',
right: 'Right Footer' right: 'Right Footer'
}, },
watermark: {
visible: 'Watermark Full Screen Visible',
text: 'Watermark Text'
},
themeDrawerTitle: 'Theme Configuration', themeDrawerTitle: 'Theme Configuration',
pageFunTitle: 'Page Function', pageFunTitle: 'Page Function',
configOperation: { configOperation: {

View File

@ -135,6 +135,10 @@ const local: App.I18n.Schema = {
height: '底部高度', height: '底部高度',
right: '底部局右' right: '底部局右'
}, },
watermark: {
visible: '显示全屏水印',
text: '水印文本'
},
themeDrawerTitle: '主题配置', themeDrawerTitle: '主题配置',
pageFunTitle: '页面功能', pageFunTitle: '页面功能',
configOperation: { configOperation: {

View File

@ -49,6 +49,10 @@ export const themeSettings: App.Theme.ThemeSetting = {
height: 48, height: 48,
right: true right: true
}, },
watermark: {
visible: false,
text: 'SoybeanAdmin'
},
tokens: { tokens: {
light: { light: {
colors: { colors: {

11
src/typings/app.d.ts vendored
View File

@ -95,6 +95,13 @@ declare namespace App {
/** Whether float the footer to the right when the layout is 'horizontal-mix' */ /** Whether float the footer to the right when the layout is 'horizontal-mix' */
right: boolean; right: boolean;
}; };
/** Watermark */
watermark: {
/** Whether to show the watermark */
visible: boolean;
/** Watermark text */
text: string;
};
/** define some theme settings tokens, will transform to css variables */ /** define some theme settings tokens, will transform to css variables */
tokens: { tokens: {
light: ThemeSettingToken; light: ThemeSettingToken;
@ -375,6 +382,10 @@ declare namespace App {
height: string; height: string;
right: string; right: string;
}; };
watermark: {
visible: string;
text: string;
};
themeDrawerTitle: string; themeDrawerTitle: string;
pageFunTitle: string; pageFunTitle: string;
configOperation: { configOperation: {

View File

@ -84,6 +84,7 @@ declare module 'vue' {
NThing: typeof import('naive-ui')['NThing'] NThing: typeof import('naive-ui')['NThing']
NTooltip: typeof import('naive-ui')['NTooltip'] NTooltip: typeof import('naive-ui')['NTooltip']
NTree: typeof import('naive-ui')['NTree'] NTree: typeof import('naive-ui')['NTree']
NWatermark: typeof import('naive-ui')['NWatermark']
PinToggler: typeof import('./../components/common/pin-toggler.vue')['default'] PinToggler: typeof import('./../components/common/pin-toggler.vue')['default']
ReloadButton: typeof import('./../components/common/reload-button.vue')['default'] ReloadButton: typeof import('./../components/common/reload-button.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']