加水印
This commit is contained in:
parent
08e7dc4d33
commit
9d0eec83ca
4
.env
4
.env
@ -2,10 +2,10 @@
|
|||||||
VITE_PORT = 8001
|
VITE_PORT = 8001
|
||||||
|
|
||||||
# spa-title
|
# spa-title
|
||||||
VITE_GLOB_APP_TITLE = AdminPro
|
VITE_GLOB_APP_TITLE = 云恒WMS
|
||||||
|
|
||||||
# spa shortname
|
# spa shortname
|
||||||
VITE_GLOB_APP_SHORT_NAME = AdminPro
|
VITE_GLOB_APP_SHORT_NAME = 云恒WMS
|
||||||
|
|
||||||
# 生产环境 开启mock
|
# 生产环境 开启mock
|
||||||
VITE_GLOB_PROD_MOCK = true
|
VITE_GLOB_PROD_MOCK = true
|
||||||
|
62
src/App.vue
62
src/App.vue
@ -1,10 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<NConfigProvider
|
<NConfigProvider :date-locale="dateZhCN" :locale="zhCN" :theme="getDarkTheme" :theme-overrides="getThemeOverrides">
|
||||||
:date-locale="dateZhCN"
|
|
||||||
:locale="zhCN"
|
|
||||||
:theme="getDarkTheme"
|
|
||||||
:theme-overrides="getThemeOverrides"
|
|
||||||
>
|
|
||||||
<AppProvider>
|
<AppProvider>
|
||||||
<RouterView v-if="!isLock" />
|
<RouterView v-if="!isLock" />
|
||||||
|
|
||||||
@ -12,30 +7,37 @@
|
|||||||
<LockScreen />
|
<LockScreen />
|
||||||
</transition>
|
</transition>
|
||||||
</AppProvider>
|
</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>
|
</NConfigProvider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, onMounted, onUnmounted } from 'vue';
|
import { computed, onMounted, onUnmounted } from 'vue';
|
||||||
import { darkTheme, dateZhCN, zhCN } from 'naive-ui';
|
import { darkTheme, dateZhCN, zhCN } from 'naive-ui';
|
||||||
import { LockScreen } from '@/components/Lockscreen';
|
import { LockScreen } from '@/components/Lockscreen';
|
||||||
import { AppProvider } from '@/components/Application';
|
import { AppProvider } from '@/components/Application';
|
||||||
import { useLockscreenStore } from '@/store/modules/lockscreen';
|
import { useLockscreenStore } from '@/store/modules/lockscreen';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useDesignSettingStore } from '@/store/modules/designSetting';
|
import { useDesignSettingStore } from '@/store/modules/designSetting';
|
||||||
import { lighten } from '@/utils';
|
import { useProjectSetting } from '@/hooks/setting/useProjectSetting';
|
||||||
|
import { lighten } from '@/utils';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const useLockscreen = useLockscreenStore();
|
const useLockscreen = useLockscreenStore();
|
||||||
const designStore = useDesignSettingStore();
|
const designStore = useDesignSettingStore();
|
||||||
|
|
||||||
const isLock = computed(() => useLockscreen.isLock);
|
const isLock = computed(() => useLockscreen.isLock);
|
||||||
const lockTime = computed(() => useLockscreen.lockTime);
|
const lockTime = computed(() => useLockscreen.lockTime);
|
||||||
|
|
||||||
/**
|
const proName = import.meta.env.VITE_GLOB_APP_TITLE;
|
||||||
|
|
||||||
|
const { getIsWaterMark } = useProjectSetting();
|
||||||
|
|
||||||
|
/**
|
||||||
* @type import('naive-ui').GlobalThemeOverrides
|
* @type import('naive-ui').GlobalThemeOverrides
|
||||||
*/
|
*/
|
||||||
const getThemeOverrides = computed(() => {
|
const getThemeOverrides = computed(() => {
|
||||||
const appTheme = designStore.appTheme;
|
const appTheme = designStore.appTheme;
|
||||||
const lightenStr = lighten(designStore.appTheme, 6);
|
const lightenStr = lighten(designStore.appTheme, 6);
|
||||||
return {
|
return {
|
||||||
@ -52,13 +54,13 @@
|
|||||||
colorEmbedded: '#f5f7f9',
|
colorEmbedded: '#f5f7f9',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const getDarkTheme = computed(() => (designStore.darkTheme ? darkTheme : undefined));
|
const getDarkTheme = computed(() => (designStore.darkTheme ? darkTheme : undefined));
|
||||||
|
|
||||||
let timer;
|
let timer;
|
||||||
|
|
||||||
const timekeeping = () => {
|
const timekeeping = () => {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
if (route.name == 'login' || isLock.value) return;
|
if (route.name == 'login' || isLock.value) return;
|
||||||
// 设置不锁屏
|
// 设置不锁屏
|
||||||
@ -74,13 +76,13 @@
|
|||||||
return clearInterval(timer);
|
return clearInterval(timer);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// document.addEventListener('mousedown', timekeeping);
|
// document.addEventListener('mousedown', timekeeping);
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
// document.removeEventListener('mousedown', timekeeping);
|
// document.removeEventListener('mousedown', timekeeping);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -26,6 +26,8 @@ export function useProjectSetting() {
|
|||||||
|
|
||||||
const getIsPageAnimate = computed(() => projectStore.isPageAnimate);
|
const getIsPageAnimate = computed(() => projectStore.isPageAnimate);
|
||||||
|
|
||||||
|
const getIsWaterMark = computed(() => projectStore.isWaterMark);
|
||||||
|
|
||||||
const getPageAnimateType = computed(() => projectStore.pageAnimateType);
|
const getPageAnimateType = computed(() => projectStore.pageAnimateType);
|
||||||
|
|
||||||
const getIsProjectSetting = computed(() => projectStore.isProjectSetting);
|
const getIsProjectSetting = computed(() => projectStore.isProjectSetting);
|
||||||
@ -42,6 +44,7 @@ export function useProjectSetting() {
|
|||||||
getCollapsedNav,
|
getCollapsedNav,
|
||||||
getShowFooter,
|
getShowFooter,
|
||||||
getIsPageAnimate,
|
getIsPageAnimate,
|
||||||
|
getIsWaterMark,
|
||||||
getPageAnimateType,
|
getPageAnimateType,
|
||||||
getIsProjectSetting,
|
getIsProjectSetting,
|
||||||
};
|
};
|
||||||
|
@ -177,6 +177,15 @@
|
|||||||
<n-switch v-model:value="settingStore.multiTabsSetting.show" />
|
<n-switch v-model:value="settingStore.multiTabsSetting.show" />
|
||||||
</div>
|
</div>
|
||||||
</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废弃,没啥用,占用操作空间-->
|
<!--1.15废弃,没啥用,占用操作空间-->
|
||||||
<!-- <div class="drawer-setting-item">-->
|
<!-- <div class="drawer-setting-item">-->
|
||||||
<!-- <div class="drawer-setting-item-title"> 显示页脚 </div>-->
|
<!-- <div class="drawer-setting-item-title"> 显示页脚 </div>-->
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
>
|
>
|
||||||
<div v-if="navMode === 'horizontal'" class="logo">
|
<div v-if="navMode === 'horizontal'" class="logo">
|
||||||
<img alt="" src="~@/assets/images/logo.png" />
|
<img alt="" src="~@/assets/images/logo.png" />
|
||||||
<h2 v-show="!collapsed" class="title">NaiveAdmin</h2>
|
<h2 v-show="!collapsed" class="title">云恒WMS</h2>
|
||||||
</div>
|
</div>
|
||||||
<AsideMenu
|
<AsideMenu
|
||||||
v-model:location="getMenuLocation"
|
v-model:location="getMenuLocation"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
v-if="isMixMenuNoneSub"
|
v-if="isMixMenuNoneSub"
|
||||||
>
|
>
|
||||||
<img src="~@/assets/images/logo.png" alt="" :class="{ 'mr-2': !isCollapsed }" />
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -52,6 +52,8 @@ const setting = {
|
|||||||
permissionMode: 'BACK',
|
permissionMode: 'BACK',
|
||||||
//是否开启路由动画
|
//是否开启路由动画
|
||||||
isPageAnimate: true,
|
isPageAnimate: true,
|
||||||
|
//是否开启水印
|
||||||
|
isWaterMark: true,
|
||||||
//路由动画类型 默认消退
|
//路由动画类型 默认消退
|
||||||
pageAnimateType: 'fade',
|
pageAnimateType: 'fade',
|
||||||
//显示项目配置
|
//显示项目配置
|
||||||
|
@ -20,6 +20,7 @@ const {
|
|||||||
crumbsSetting,
|
crumbsSetting,
|
||||||
permissionMode,
|
permissionMode,
|
||||||
isPageAnimate,
|
isPageAnimate,
|
||||||
|
isWaterMark,
|
||||||
pageAnimateType,
|
pageAnimateType,
|
||||||
isProjectSetting,
|
isProjectSetting,
|
||||||
} = projectSetting;
|
} = projectSetting;
|
||||||
@ -35,6 +36,7 @@ interface ProjectSettingState {
|
|||||||
crumbsSetting: IcrumbsSetting; //面包屑
|
crumbsSetting: IcrumbsSetting; //面包屑
|
||||||
permissionMode: string; //权限模式
|
permissionMode: string; //权限模式
|
||||||
isPageAnimate: boolean; //是否开启路由动画
|
isPageAnimate: boolean; //是否开启路由动画
|
||||||
|
isWaterMark: boolean; //是否开启水印
|
||||||
pageAnimateType: string; //路由动画类型
|
pageAnimateType: string; //路由动画类型
|
||||||
isProjectSetting: boolean; //显示项目配置
|
isProjectSetting: boolean; //显示项目配置
|
||||||
}
|
}
|
||||||
@ -52,6 +54,7 @@ export const useProjectSettingStore = defineStore({
|
|||||||
crumbsSetting,
|
crumbsSetting,
|
||||||
permissionMode,
|
permissionMode,
|
||||||
isPageAnimate,
|
isPageAnimate,
|
||||||
|
isWaterMark,
|
||||||
pageAnimateType,
|
pageAnimateType,
|
||||||
isProjectSetting,
|
isProjectSetting,
|
||||||
}),
|
}),
|
||||||
@ -86,6 +89,9 @@ export const useProjectSettingStore = defineStore({
|
|||||||
getIsPageAnimate(): boolean {
|
getIsPageAnimate(): boolean {
|
||||||
return this.isPageAnimate;
|
return this.isPageAnimate;
|
||||||
},
|
},
|
||||||
|
getIsWaterMark(): boolean {
|
||||||
|
return this.isWaterMark;
|
||||||
|
},
|
||||||
getPageAnimateType(): string {
|
getPageAnimateType(): string {
|
||||||
return this.pageAnimateType;
|
return this.pageAnimateType;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user