feat(projects): add full screen watermark. close#571 (#573)
This commit is contained in:
parent
4dde4c22b1
commit
ea8aa6c4e6
17
src/App.vue
17
src/App.vue
@ -21,6 +21,22 @@ const naiveLocale = computed(() => {
|
||||
const naiveDateLocale = computed(() => {
|
||||
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>
|
||||
|
||||
<template>
|
||||
@ -33,6 +49,7 @@ const naiveDateLocale = computed(() => {
|
||||
>
|
||||
<AppProvider>
|
||||
<RouterView class="bg-layout" />
|
||||
<NWatermark v-if="themeStore.watermark.visible" v-bind="watermarkProps" />
|
||||
</AppProvider>
|
||||
</NConfigProvider>
|
||||
</template>
|
||||
|
@ -101,6 +101,19 @@ const isWrapperScrollMode = computed(() => themeStore.layout.scrollMode === 'wra
|
||||
>
|
||||
<NSwitch v-model:value="themeStore.footer.right" />
|
||||
</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>
|
||||
</template>
|
||||
|
||||
|
@ -135,6 +135,10 @@ const local: App.I18n.Schema = {
|
||||
height: 'Footer Height',
|
||||
right: 'Right Footer'
|
||||
},
|
||||
watermark: {
|
||||
visible: 'Watermark Full Screen Visible',
|
||||
text: 'Watermark Text'
|
||||
},
|
||||
themeDrawerTitle: 'Theme Configuration',
|
||||
pageFunTitle: 'Page Function',
|
||||
configOperation: {
|
||||
|
@ -135,6 +135,10 @@ const local: App.I18n.Schema = {
|
||||
height: '底部高度',
|
||||
right: '底部局右'
|
||||
},
|
||||
watermark: {
|
||||
visible: '显示全屏水印',
|
||||
text: '水印文本'
|
||||
},
|
||||
themeDrawerTitle: '主题配置',
|
||||
pageFunTitle: '页面功能',
|
||||
configOperation: {
|
||||
|
@ -49,6 +49,10 @@ export const themeSettings: App.Theme.ThemeSetting = {
|
||||
height: 48,
|
||||
right: true
|
||||
},
|
||||
watermark: {
|
||||
visible: false,
|
||||
text: 'SoybeanAdmin'
|
||||
},
|
||||
tokens: {
|
||||
light: {
|
||||
colors: {
|
||||
|
11
src/typings/app.d.ts
vendored
11
src/typings/app.d.ts
vendored
@ -95,6 +95,13 @@ declare namespace App {
|
||||
/** Whether float the footer to the right when the layout is 'horizontal-mix' */
|
||||
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 */
|
||||
tokens: {
|
||||
light: ThemeSettingToken;
|
||||
@ -375,6 +382,10 @@ declare namespace App {
|
||||
height: string;
|
||||
right: string;
|
||||
};
|
||||
watermark: {
|
||||
visible: string;
|
||||
text: string;
|
||||
};
|
||||
themeDrawerTitle: string;
|
||||
pageFunTitle: string;
|
||||
configOperation: {
|
||||
|
1
src/typings/components.d.ts
vendored
1
src/typings/components.d.ts
vendored
@ -84,6 +84,7 @@ declare module 'vue' {
|
||||
NThing: typeof import('naive-ui')['NThing']
|
||||
NTooltip: typeof import('naive-ui')['NTooltip']
|
||||
NTree: typeof import('naive-ui')['NTree']
|
||||
NWatermark: typeof import('naive-ui')['NWatermark']
|
||||
PinToggler: typeof import('./../components/common/pin-toggler.vue')['default']
|
||||
ReloadButton: typeof import('./../components/common/reload-button.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
|
Loading…
Reference in New Issue
Block a user