Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/global/use-logo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const useLogo = async () => {
globalStore.themeConfig.loginBackground = res.data?.loginBackground;
globalStore.themeConfig.loginBtnLinkColor = res.data?.loginBtnLinkColor;
globalStore.themeConfig.favicon = res.data.favicon;
globalStore.watermarkShow = res.data.watermarkShow === 'Enable';
try {
globalStore.watermark = JSON.parse(res.data.watermark);
} catch {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/layout/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>

<el-watermark
v-if="globalStore.isMasterProductPro && globalStore.watermark"
v-if="globalStore.isMasterProductPro && globalStore.watermarkShow && globalStore.watermark"
:content="loadContent()"
:font="{
fontSize: globalStore.watermark.fontSize,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/store/interface/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface GlobalState {
isFullScreen: boolean;
openMenuTabs: boolean;
watermark: Watermark;
watermarkShow: boolean;
isOnRestart: boolean;
agreeLicense: boolean;
hasNewVersion: boolean;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/store/modules/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const GlobalStore = defineStore({
loginBtnLinkColor: '',
},
watermark: null,
watermarkShow: false,
openMenuTabs: false,
isFullScreen: false,
isOnRestart: false,
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/utils/xpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function resetXSetting() {
globalStore.themeConfig.logoWithText = '';
globalStore.themeConfig.favicon = '';
globalStore.watermark = null;
globalStore.watermarkShow = false;
globalStore.masterAlias = '';
}

Expand Down Expand Up @@ -116,6 +117,7 @@ export async function getXpackSettingForTheme() {
if (res2.data?.theme) {
globalStore.themeConfig.theme = res2.data.theme;
}
globalStore.watermarkShow = res2.data.watermarkShow === 'Enable';
try {
globalStore.watermark = JSON.parse(res2.data.watermark);
} catch {
Expand Down
15 changes: 8 additions & 7 deletions frontend/src/views/setting/panel/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@
</el-form-item>

<el-form-item :label="$t('setting.watermark')" v-if="isMasterProductPro" prop="watermark">
<el-radio-group class="w-full" @change="onChangeWatermark" v-model="form.watermarkItem">
<el-radio-group class="w-full" @change="onChangeWatermark" v-model="form.watermarkShow">
<el-radio-button value="Enable">
<span>{{ $t('commons.button.enable') }}</span>
</el-radio-button>
<el-radio-button value="Disable">
<span>{{ $t('commons.button.disable') }}</span>
</el-radio-button>
</el-radio-group>
<div v-if="form.watermarkItem === 'Enable'">
<div v-if="form.watermarkShow === 'Enable'">
<div>
<el-button link type="primary" @click="onChangeWatermark">
{{ $t('commons.button.view') }}
Expand Down Expand Up @@ -274,7 +274,7 @@ const form = reactive({
panelName: '',
theme: '',
watermark: '',
watermarkItem: '',
watermarkShow: '',
themeColor: {} as ThemeColor,
menuTabs: '',
language: '',
Expand Down Expand Up @@ -372,12 +372,12 @@ const search = async () => {
globalStore.themeConfig.theme = form.theme;
form.proxyDocker = xpackRes.data.proxyDocker;
form.watermark = xpackRes.data.watermark;
form.watermarkShow = xpackRes.data.watermarkShow;
try {
globalStore.watermark = JSON.parse(xpackRes.data.watermark);
} catch {
globalStore.watermark = null;
}
form.watermarkItem = xpackRes.data.watermark ? 'Enable' : 'Disable';
}
} else {
globalStore.themeConfig.theme = form.theme;
Expand Down Expand Up @@ -421,7 +421,7 @@ const onChangeThemeColor = () => {
};

const onChangeWatermark = async () => {
if (form.watermarkItem === 'Enable') {
if (form.watermarkShow === 'Enable') {
watermarkRef.value.acceptParams(form.watermark);
return;
}
Expand All @@ -431,10 +431,11 @@ const onChangeWatermark = async () => {
})
.then(async () => {
loading.value = true;
await updateXpackSettingByKey('Watermark', '')
await updateXpackSettingByKey('WatermarkShow', 'Disable')
.then(() => {
loading.value = false;
globalStore.watermark = null;
globalStore.watermarkShow = false;
search();
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
})
Expand All @@ -443,7 +444,7 @@ const onChangeWatermark = async () => {
});
})
.catch(() => {
form.watermarkItem = 'Enable';
form.watermarkShow = 'Enable';
});
};

Expand Down
1 change: 1 addition & 0 deletions frontend/src/views/setting/panel/watermark/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const onSave = async (formEl: FormInstance | undefined) => {
rotate: form.rotate,
gap: form.gap,
};
globalStore.watermarkShow = true;
handleClose();
return;
})
Expand Down
Loading