mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-27 05:36:43 +08:00
feat(projects): add full screen watermark
This commit is contained in:
parent
a9dce21878
commit
38cc2872ea
@ -25,7 +25,9 @@ const props = withDefaults(defineProps<AdminLayoutProps>(), {
|
|||||||
siderCollapsedWidth: 64,
|
siderCollapsedWidth: 64,
|
||||||
footerVisible: true,
|
footerVisible: true,
|
||||||
footerHeight: 48,
|
footerHeight: 48,
|
||||||
rightFooter: false
|
rightFooter: false,
|
||||||
|
watermarkVisible: true,
|
||||||
|
watermarkText: 'SoybeanAdmin'
|
||||||
});
|
});
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
@ -48,6 +50,8 @@ type Slots = {
|
|||||||
sider?: SlotFn;
|
sider?: SlotFn;
|
||||||
/** Footer */
|
/** Footer */
|
||||||
footer?: SlotFn;
|
footer?: SlotFn;
|
||||||
|
/** Watermark */
|
||||||
|
watermark?: SlotFn;
|
||||||
};
|
};
|
||||||
|
|
||||||
const slots = defineSlots<Slots>();
|
const slots = defineSlots<Slots>();
|
||||||
@ -60,6 +64,7 @@ const showTab = computed(() => Boolean(slots.tab) && props.tabVisible);
|
|||||||
const showSider = computed(() => !props.isMobile && Boolean(slots.sider) && props.siderVisible);
|
const showSider = computed(() => !props.isMobile && Boolean(slots.sider) && props.siderVisible);
|
||||||
const showMobileSider = computed(() => props.isMobile && Boolean(slots.sider) && props.siderVisible);
|
const showMobileSider = computed(() => props.isMobile && Boolean(slots.sider) && props.siderVisible);
|
||||||
const showFooter = computed(() => Boolean(slots.footer) && props.footerVisible);
|
const showFooter = computed(() => Boolean(slots.footer) && props.footerVisible);
|
||||||
|
const showWatermark = computed(() => Boolean(slots.watermark) && props.watermarkVisible);
|
||||||
|
|
||||||
// scroll mode
|
// scroll mode
|
||||||
const isWrapperScroll = computed(() => props.scrollMode === 'wrapper');
|
const isWrapperScroll = computed(() => props.scrollMode === 'wrapper');
|
||||||
@ -230,6 +235,11 @@ function handleClickMask() {
|
|||||||
:class="[style['layout-footer-placement']]"
|
:class="[style['layout-footer-placement']]"
|
||||||
></div>
|
></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<!-- Watermark -->
|
||||||
|
<template v-if="showWatermark">
|
||||||
|
<slot name="watermark"></slot>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -132,6 +132,22 @@ export interface AdminLayoutFooterConfig {
|
|||||||
rightFooter?: boolean;
|
rightFooter?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Watermark config */
|
||||||
|
export interface AdminLayoutWatermarkConfig {
|
||||||
|
/**
|
||||||
|
* Whether watermark is visible
|
||||||
|
*
|
||||||
|
* @default: true
|
||||||
|
*/
|
||||||
|
watermarkVisible?: boolean;
|
||||||
|
/**
|
||||||
|
* Watermark text
|
||||||
|
*
|
||||||
|
* @default: SoybeanAdmin
|
||||||
|
*/
|
||||||
|
watermarkText?: string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layout mode
|
* Layout mode
|
||||||
*
|
*
|
||||||
@ -156,7 +172,8 @@ export interface AdminLayoutProps
|
|||||||
AdminLayoutTabConfig,
|
AdminLayoutTabConfig,
|
||||||
AdminLayoutSiderConfig,
|
AdminLayoutSiderConfig,
|
||||||
AdminLayoutContentConfig,
|
AdminLayoutContentConfig,
|
||||||
AdminLayoutFooterConfig {
|
AdminLayoutFooterConfig,
|
||||||
|
AdminLayoutWatermarkConfig {
|
||||||
/**
|
/**
|
||||||
* Layout mode
|
* Layout mode
|
||||||
*
|
*
|
||||||
|
@ -9,6 +9,7 @@ import GlobalSider from '../modules/global-sider/index.vue';
|
|||||||
import GlobalTab from '../modules/global-tab/index.vue';
|
import GlobalTab from '../modules/global-tab/index.vue';
|
||||||
import GlobalContent from '../modules/global-content/index.vue';
|
import GlobalContent from '../modules/global-content/index.vue';
|
||||||
import GlobalFooter from '../modules/global-footer/index.vue';
|
import GlobalFooter from '../modules/global-footer/index.vue';
|
||||||
|
import GlobalWatermark from '../modules/global-watermark/index.vue';
|
||||||
import ThemeDrawer from '../modules/theme-drawer/index.vue';
|
import ThemeDrawer from '../modules/theme-drawer/index.vue';
|
||||||
import { setupMixMenuContext } from '../context';
|
import { setupMixMenuContext } from '../context';
|
||||||
|
|
||||||
@ -67,6 +68,11 @@ const siderWidth = computed(() => getSiderWidth());
|
|||||||
|
|
||||||
const siderCollapsedWidth = computed(() => getSiderCollapsedWidth());
|
const siderCollapsedWidth = computed(() => getSiderCollapsedWidth());
|
||||||
|
|
||||||
|
const watermarkProps = computed(() => {
|
||||||
|
const { text } = themeStore.watermark;
|
||||||
|
return { text };
|
||||||
|
});
|
||||||
|
|
||||||
function getSiderWidth() {
|
function getSiderWidth() {
|
||||||
const { reverseHorizontalMix } = themeStore.layout;
|
const { reverseHorizontalMix } = themeStore.layout;
|
||||||
const { width, mixWidth, mixChildMenuWidth } = themeStore.sider;
|
const { width, mixWidth, mixChildMenuWidth } = themeStore.sider;
|
||||||
@ -122,6 +128,8 @@ function getSiderCollapsedWidth() {
|
|||||||
:footer-height="themeStore.footer.height"
|
:footer-height="themeStore.footer.height"
|
||||||
:fixed-footer="themeStore.footer.fixed"
|
:fixed-footer="themeStore.footer.fixed"
|
||||||
:right-footer="themeStore.footer.right"
|
:right-footer="themeStore.footer.right"
|
||||||
|
:watermark-visible="themeStore.watermark.visible"
|
||||||
|
:watermark-text="themeStore.watermark.text"
|
||||||
>
|
>
|
||||||
<template #header>
|
<template #header>
|
||||||
<GlobalHeader v-bind="headerProps" />
|
<GlobalHeader v-bind="headerProps" />
|
||||||
@ -138,6 +146,9 @@ function getSiderCollapsedWidth() {
|
|||||||
<template #footer>
|
<template #footer>
|
||||||
<GlobalFooter />
|
<GlobalFooter />
|
||||||
</template>
|
</template>
|
||||||
|
<template #watermark>
|
||||||
|
<GlobalWatermark v-bind="watermarkProps" />
|
||||||
|
</template>
|
||||||
</AdminLayout>
|
</AdminLayout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
30
src/layouts/modules/global-watermark/index.vue
Normal file
30
src/layouts/modules/global-watermark/index.vue
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
defineOptions({
|
||||||
|
name: 'GlobalWatermark'
|
||||||
|
});
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
text?: App.Global.WatermarkProps['text'];
|
||||||
|
}
|
||||||
|
|
||||||
|
defineProps<Props>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NWatermark
|
||||||
|
:content="text"
|
||||||
|
cross
|
||||||
|
fullscreen
|
||||||
|
:font-size="16"
|
||||||
|
:line-height="16"
|
||||||
|
:width="384"
|
||||||
|
:height="384"
|
||||||
|
:x-offset="12"
|
||||||
|
:y-offset="60"
|
||||||
|
:rotate="-15"
|
||||||
|
:z-index="9999"
|
||||||
|
class="pointer-events-none"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped></style>
|
@ -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>
|
||||||
|
|
||||||
|
@ -134,6 +134,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: {
|
||||||
|
@ -134,6 +134,10 @@ const local: App.I18n.Schema = {
|
|||||||
height: '底部高度',
|
height: '底部高度',
|
||||||
right: '底部局右'
|
right: '底部局右'
|
||||||
},
|
},
|
||||||
|
watermark: {
|
||||||
|
visible: '显示全屏水印',
|
||||||
|
text: '水印文本'
|
||||||
|
},
|
||||||
themeDrawerTitle: '主题配置',
|
themeDrawerTitle: '主题配置',
|
||||||
pageFunTitle: '页面功能',
|
pageFunTitle: '页面功能',
|
||||||
configOperation: {
|
configOperation: {
|
||||||
|
@ -451,7 +451,7 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
meta: {
|
meta: {
|
||||||
title: 'plugin_pdf',
|
title: 'plugin_pdf',
|
||||||
i18nKey: 'route.plugin_pdf',
|
i18nKey: 'route.plugin_pdf',
|
||||||
icon:'uiw:file-pdf'
|
icon: 'uiw:file-pdf'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -48,6 +48,10 @@ export const themeSettings: App.Theme.ThemeSetting = {
|
|||||||
height: 48,
|
height: 48,
|
||||||
right: true
|
right: true
|
||||||
},
|
},
|
||||||
|
watermark: {
|
||||||
|
visible: true,
|
||||||
|
text: 'SoybeanAdmin'
|
||||||
|
},
|
||||||
tokens: {
|
tokens: {
|
||||||
light: {
|
light: {
|
||||||
colors: {
|
colors: {
|
||||||
|
17
src/typings/app.d.ts
vendored
17
src/typings/app.d.ts
vendored
@ -93,6 +93,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;
|
||||||
@ -169,6 +176,12 @@ declare namespace App {
|
|||||||
showMenu?: boolean;
|
showMenu?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** The global watermark props */
|
||||||
|
interface WatermarkProps {
|
||||||
|
/** Whether to show the watermark */
|
||||||
|
text?: string;
|
||||||
|
}
|
||||||
|
|
||||||
/** The global menu */
|
/** The global menu */
|
||||||
type Menu = {
|
type Menu = {
|
||||||
/**
|
/**
|
||||||
@ -372,6 +385,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: {
|
||||||
|
1
src/typings/components.d.ts
vendored
1
src/typings/components.d.ts
vendored
@ -98,6 +98,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']
|
||||||
|
Loading…
Reference in New Issue
Block a user