feat: 水印自动包含当前用户名

This commit is contained in:
lbw 2023-03-08 12:24:38 +08:00
parent 1b902e65b1
commit 2be10fe044

View File

@ -271,13 +271,6 @@
<el-switch v-model="getThemeConfig.isWartermark" size="small" @change="onWartermarkChange"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt14">
<div class="layout-breadcrumb-seting-bar-flex-label">{{ $t('layout.fourWartermarkText') }}</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-input v-model="getThemeConfig.wartermarkText" style="width: 90px" @input="onWartermarkTextInput"></el-input>
</div>
</div>
<!-- 其它设置 -->
<el-divider content-position="left">{{ $t('layout.fiveTitle') }}</el-divider>
<div class="layout-breadcrumb-seting-bar-flex mt15">
@ -432,6 +425,7 @@ import Watermark from '/@/utils/wartermark';
import commonFunction from '/@/utils/commonFunction';
import other from '/@/utils/other';
import mittBus from '/@/utils/mitt';
import { useUserInfo } from '/@/stores/userInfo';
//
const { locale } = useI18n();
@ -555,16 +549,11 @@ const onAddDarkChange = () => {
};
// 4 -->
const onWartermarkChange = () => {
getThemeConfig.value.isWartermark ? Watermark.set(getThemeConfig.value.wartermarkText) : Watermark.del();
setLocalThemeConfig();
};
// 4 -->
const onWartermarkTextInput = (val: string) => {
getThemeConfig.value.wartermarkText = verifyAndSpace(val);
if (getThemeConfig.value.wartermarkText === '') return false;
if (getThemeConfig.value.isWartermark) Watermark.set(getThemeConfig.value.wartermarkText);
const username = useUserInfo().userInfos.user.username;
getThemeConfig.value.isWartermark ? Watermark.set(username) : Watermark.del();
setLocalThemeConfig();
};
// 5
const onSetLayout = (layout: string) => {
Local.set('oldLayout', layout);