feat(project): 移除页脚,增加全局水印

This commit is contained in:
chen.home 2023-03-04 16:24:20 +08:00
parent 564ffd2ddd
commit 8ea29c9d88
5 changed files with 101 additions and 45 deletions

View File

@ -57,7 +57,6 @@
<div <div
class="h-full" class="h-full"
:class="{ :class="{
'p-b-40px': appStore.fixedFooter,
'p-t-122px': appStore.fixedHeader && appStore.showTabs, 'p-t-122px': appStore.fixedHeader && appStore.showTabs,
'p-t-77px': appStore.fixedHeader && !appStore.showTabs, 'p-t-77px': appStore.fixedHeader && !appStore.showTabs,
}" }"
@ -79,14 +78,7 @@
</div> </div>
</n-layout-content> </n-layout-content>
<BackTop /> <BackTop />
<n-layout-footer <Watermark :show-watermark="appStore.showWatermark" />
:position="appStore.fixedFooter ? 'absolute' : 'static'"
bordered
class="flex-center h-40px"
style="margin-top: auto"
>
{{ appStore.footerText }}
</n-layout-footer>
</n-layout> </n-layout>
</n-layout> </n-layout>
</template> </template>
@ -107,6 +99,7 @@ import {
Reload, Reload,
TabBar, TabBar,
BackTop, BackTop,
Watermark,
} from '../components'; } from '../components';
import { useAppStore, useRouteStore } from '@/store'; import { useAppStore, useRouteStore } from '@/store';

View File

@ -0,0 +1,24 @@
<template>
<n-watermark
v-if="props.showWatermark"
content="Ench-Admin"
cross
fullscreen
:font-size="16"
:line-height="16"
:width="384"
:height="384"
:x-offset="12"
:y-offset="60"
:rotate="-15"
/>
</template>
<script setup lang="ts">
interface Props {
showWatermark: boolean;
}
const props = withDefaults(defineProps<Props>(), {
showWatermark: false,
});
</script>

View File

@ -1,55 +1,91 @@
<template> <template>
<n-tooltip placement="bottom" trigger="hover"> <n-tooltip
placement="bottom"
trigger="hover"
>
<template #trigger> <template #trigger>
<HeaderButton @click="openSetting"> <HeaderButton @click="openSetting">
<div> <div>
<i-icon-park-outline-setting-two /> <i-icon-park-outline-setting-two />
<n-drawer v-model:show="drawerActive" :width="300"> <n-drawer
v-model:show="drawerActive"
:width="300"
>
<n-drawer-content title="系统设置"> <n-drawer-content title="系统设置">
<n-divider>主题设置</n-divider> <n-divider>主题设置</n-divider>
<n-space vertical> <n-space vertical>
<n-space justify="space-between"> <n-space justify="space-between">
深色模式 深色模式
<n-switch :value="appStore.darkMode" @update:value="appStore.toggleDarkMode()" /> <n-switch
:value="appStore.darkMode"
@update:value="appStore.toggleDarkMode()"
/>
</n-space> </n-space>
<n-space justify="space-between"> <n-space justify="space-between">
色弱模式 色弱模式
<n-switch :value="appStore.colorWeak" @update:value="appStore.toggleColorWeak()" /> <n-switch
:value="appStore.colorWeak"
@update:value="appStore.toggleColorWeak()"
/>
</n-space> </n-space>
<n-space justify="space-between"> <n-space justify="space-between">
灰色模式 灰色模式
<n-switch :value="appStore.grayMode" @update:value="appStore.toggleGrayMode()" /> <n-switch
:value="appStore.grayMode"
@update:value="appStore.toggleGrayMode()"
/>
</n-space> </n-space>
</n-space> </n-space>
<n-divider>界面显示</n-divider> <n-divider>界面显示</n-divider>
<n-space vertical> <n-space vertical>
<n-space justify="space-between"> <n-space justify="space-between">
LOGO显示 LOGO显示
<n-switch :value="appStore.showLogo" @update:value="appStore.toggleShowLogo()" /> <n-switch
:value="appStore.showLogo"
@update:value="appStore.toggleShowLogo()"
/>
</n-space> </n-space>
<n-space justify="space-between"> <n-space justify="space-between">
多页签 多页签
<n-switch :value="appStore.showTabs" @update:value="appStore.toggleShowTabs()" /> <n-switch
:value="appStore.showTabs"
@update:value="appStore.toggleShowTabs()"
/>
</n-space> </n-space>
<n-space justify="space-between"> <n-space justify="space-between">
面包屑 面包屑
<n-switch :value="appStore.showBreadcrumb" @update:value="appStore.toggleShowBreadcrumb()" /> <n-switch
:value="appStore.showBreadcrumb"
@update:value="appStore.toggleShowBreadcrumb()"
/>
</n-space> </n-space>
<n-space justify="space-between"> <n-space justify="space-between">
固定头部和多页签 固定头部和多页签
<n-switch :value="appStore.fixedHeader" @update:value="appStore.toggleFixedHeader()" /> <n-switch
</n-space> :value="appStore.fixedHeader"
<n-space justify="space-between"> @update:value="appStore.toggleFixedHeader()"
固定底部 />
<n-switch :value="appStore.fixedFooter" @update:value="appStore.toggleFixedFooter()" />
</n-space> </n-space>
<n-space justify="space-between"> <n-space justify="space-between">
侧边栏反转色 侧边栏反转色
<n-switch :value="appStore.invertedSider" @update:value="appStore.toggleInvertedSider()" /> <n-switch
:value="appStore.invertedSider"
@update:value="appStore.toggleInvertedSider()"
/>
</n-space> </n-space>
<n-space justify="space-between"> <n-space justify="space-between">
头部反转色 头部反转色
<n-switch :value="appStore.invertedHeader" @update:value="appStore.toggleInvertedHeader()" /> <n-switch
:value="appStore.invertedHeader"
@update:value="appStore.toggleInvertedHeader()"
/>
</n-space>
<n-space justify="space-between">
水印
<n-switch
:value="appStore.showWatermark"
@update:value="appStore.toggleShowWatermark()"
/>
</n-space> </n-space>
</n-space> </n-space>
</n-drawer-content> </n-drawer-content>
@ -69,7 +105,7 @@ const appStore = useAppStore();
const drawerActive = ref(false); const drawerActive = ref(false);
const openSetting = () => { const openSetting = () => {
drawerActive.value = !drawerActive.value; drawerActive.value = !drawerActive.value;
}; };
</script> </script>

View File

@ -20,19 +20,22 @@ import TabBar from './tab/TabBar.vue';
/* 其他组件 */ /* 其他组件 */
// 返回顶部 // 返回顶部
import BackTop from './common/BackTop.vue'; import BackTop from './common/BackTop.vue';
import Watermark from './common/Watermark.vue';
export { export {
Breadcrumb, Breadcrumb,
CollapaseButton, CollapaseButton,
Menu, Menu,
Logo, Logo,
FullScreen, FullScreen,
DarkMode, DarkMode,
Setting, Setting,
Github, Github,
Notices, Notices,
UserCenter, UserCenter,
Search, Search,
Reload, Reload,
TabBar, TabBar,
BackTop, BackTop,
Watermark,
}; };

View File

@ -15,9 +15,9 @@ interface AppStatus {
showTabs: boolean; showTabs: boolean;
showBreadcrumb: boolean; showBreadcrumb: boolean;
fixedHeader: boolean; fixedHeader: boolean;
fixedFooter: boolean;
invertedSider: boolean; invertedSider: boolean;
invertedHeader: boolean; invertedHeader: boolean;
showWatermark: boolean;
} }
const docEle = document.documentElement; const docEle = document.documentElement;
@ -37,9 +37,9 @@ export const useAppStore = defineStore('app-store', {
showTabs: true, showTabs: true,
showBreadcrumb: true, showBreadcrumb: true,
fixedHeader: false, fixedHeader: false,
fixedFooter: true,
invertedSider: false, invertedSider: false,
invertedHeader: false, invertedHeader: false,
showWatermark: false,
}; };
}, },
actions: { actions: {
@ -119,10 +119,6 @@ export const useAppStore = defineStore('app-store', {
this.fixedHeader = !this.fixedHeader; this.fixedHeader = !this.fixedHeader;
}, },
/* 切换固定底部 */ /* 切换固定底部 */
toggleFixedFooter() {
this.fixedFooter = !this.fixedFooter;
},
/* 切换固定底部 */
toggleInvertedSider() { toggleInvertedSider() {
this.invertedSider = !this.invertedSider; this.invertedSider = !this.invertedSider;
}, },
@ -130,5 +126,9 @@ export const useAppStore = defineStore('app-store', {
toggleInvertedHeader() { toggleInvertedHeader() {
this.invertedHeader = !this.invertedHeader; this.invertedHeader = !this.invertedHeader;
}, },
/* 切换固定底部 */
toggleShowWatermark() {
this.showWatermark = !this.showWatermark;
},
}, },
}); });