加水印

This commit is contained in:
陈红丽 2024-11-21 11:25:50 +08:00
parent 08e7dc4d33
commit 9d0eec83ca
8 changed files with 91 additions and 69 deletions

4
.env
View File

@ -2,10 +2,10 @@
VITE_PORT = 8001
# spa-title
VITE_GLOB_APP_TITLE = AdminPro
VITE_GLOB_APP_TITLE = 云恒WMS
# spa shortname
VITE_GLOB_APP_SHORT_NAME = AdminPro
VITE_GLOB_APP_SHORT_NAME = 云恒WMS
# 生产环境 开启mock
VITE_GLOB_PROD_MOCK = true

View File

@ -1,10 +1,5 @@
<template>
<NConfigProvider
:date-locale="dateZhCN"
:locale="zhCN"
:theme="getDarkTheme"
:theme-overrides="getThemeOverrides"
>
<NConfigProvider :date-locale="dateZhCN" :locale="zhCN" :theme="getDarkTheme" :theme-overrides="getThemeOverrides">
<AppProvider>
<RouterView v-if="!isLock" />
@ -12,6 +7,8 @@
<LockScreen />
</transition>
</AppProvider>
<n-watermark v-if="getIsWaterMark" :content="proName" cross fullscreen :font-size="18" :line-height="16" :font-weight="500"
font-color="rgba(200, 200, 200, 0.40)" :width="284" :height="284" :x-offset="12" :y-offset="60" :rotate="-15" />
</NConfigProvider>
</template>
@ -23,6 +20,7 @@
import { useLockscreenStore } from '@/store/modules/lockscreen';
import { useRoute } from 'vue-router';
import { useDesignSettingStore } from '@/store/modules/designSetting';
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
import { lighten } from '@/utils';
const route = useRoute();
@ -32,6 +30,10 @@
const isLock = computed(() => useLockscreen.isLock);
const lockTime = computed(() => useLockscreen.lockTime);
const proName = import.meta.env.VITE_GLOB_APP_TITLE;
const { getIsWaterMark } = useProjectSetting();
/**
* @type import('naive-ui').GlobalThemeOverrides
*/

View File

@ -26,6 +26,8 @@ export function useProjectSetting() {
const getIsPageAnimate = computed(() => projectStore.isPageAnimate);
const getIsWaterMark = computed(() => projectStore.isWaterMark);
const getPageAnimateType = computed(() => projectStore.pageAnimateType);
const getIsProjectSetting = computed(() => projectStore.isProjectSetting);
@ -42,6 +44,7 @@ export function useProjectSetting() {
getCollapsedNav,
getShowFooter,
getIsPageAnimate,
getIsWaterMark,
getPageAnimateType,
getIsProjectSetting,
};

View File

@ -177,6 +177,15 @@
<n-switch v-model:value="settingStore.multiTabsSetting.show" />
</div>
</div>
<div class="drawer-setting-item">
<div class="drawer-setting-item-title"> 水印 </div>
<div class="drawer-setting-item-action">
<n-switch v-model:value="settingStore.isWaterMark" @change="handleWaterChange" />
</div>
</div>
<!--1.15废弃没啥用占用操作空间-->
<!-- <div class="drawer-setting-item">-->
<!-- <div class="drawer-setting-item-title"> 显示页脚 </div>-->

View File

@ -12,7 +12,7 @@
>
<div v-if="navMode === 'horizontal'" class="logo">
<img alt="" src="~@/assets/images/logo.png" />
<h2 v-show="!collapsed" class="title">NaiveAdmin</h2>
<h2 v-show="!collapsed" class="title">云恒WMS</h2>
</div>
<AsideMenu
v-model:location="getMenuLocation"

View File

@ -7,7 +7,7 @@
v-if="isMixMenuNoneSub"
>
<img src="~@/assets/images/logo.png" alt="" :class="{ 'mr-2': !isCollapsed }" />
<h2 v-show="!isCollapsed" class="mt-0 title">NaiveAdmin</h2>
<h2 v-show="!isCollapsed" class="mt-0 title">云恒WMS</h2>
</div>
</template>

View File

@ -52,6 +52,8 @@ const setting = {
permissionMode: 'BACK',
//是否开启路由动画
isPageAnimate: true,
//是否开启水印
isWaterMark: true,
//路由动画类型 默认消退
pageAnimateType: 'fade',
//显示项目配置

View File

@ -20,6 +20,7 @@ const {
crumbsSetting,
permissionMode,
isPageAnimate,
isWaterMark,
pageAnimateType,
isProjectSetting,
} = projectSetting;
@ -35,6 +36,7 @@ interface ProjectSettingState {
crumbsSetting: IcrumbsSetting; //面包屑
permissionMode: string; //权限模式
isPageAnimate: boolean; //是否开启路由动画
isWaterMark: boolean; //是否开启水印
pageAnimateType: string; //路由动画类型
isProjectSetting: boolean; //显示项目配置
}
@ -52,6 +54,7 @@ export const useProjectSettingStore = defineStore({
crumbsSetting,
permissionMode,
isPageAnimate,
isWaterMark,
pageAnimateType,
isProjectSetting,
}),
@ -86,6 +89,9 @@ export const useProjectSettingStore = defineStore({
getIsPageAnimate(): boolean {
return this.isPageAnimate;
},
getIsWaterMark(): boolean {
return this.isWaterMark;
},
getPageAnimateType(): string {
return this.pageAnimateType;
},