feat: 主题色保存/恢复增加确认提示 (#7036)

This commit is contained in:
2024-11-13 22:14:01 +08:00 committed by GitHub
parent 4c01b1e542
commit 911b4076f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -164,6 +164,11 @@ const changeDarkColor = (color: string) => {
const onSave = async (formEl: FormInstance | undefined) => { const onSave = async (formEl: FormInstance | undefined) => {
if (!formEl) return; if (!formEl) return;
ElMessageBox.confirm(i18n.global.t('xpack.theme.setHelper'), i18n.global.t('commons.button.save'), {
confirmButtonText: i18n.global.t('commons.button.confirm'),
cancelButtonText: i18n.global.t('commons.button.cancel'),
type: 'info',
}).then(async () => {
await formEl.validate(async (valid) => { await formEl.validate(async (valid) => {
if (!valid) return; if (!valid) return;
form.themeColor = { light: form.light, dark: form.dark }; form.themeColor = { light: form.light, dark: form.dark };
@ -184,12 +189,17 @@ const onSave = async (formEl: FormInstance | undefined) => {
initFavicon(); initFavicon();
drawerVisible.value = false; drawerVisible.value = false;
emit('search'); emit('search');
return;
} }
}); });
});
}; };
const onReSet = async () => { const onReSet = async () => {
ElMessageBox.confirm(i18n.global.t('xpack.theme.setDefaultHelper'), i18n.global.t('xpack.theme.setDefault'), {
confirmButtonText: i18n.global.t('commons.button.confirm'),
cancelButtonText: i18n.global.t('commons.button.cancel'),
type: 'info',
}).then(async () => {
form.themeColor = { light: '#005eeb', dark: '#F0BE96' }; form.themeColor = { light: '#005eeb', dark: '#F0BE96' };
if (globalStore.isProductPro) { if (globalStore.isProductPro) {
await updateXpackSettingByKey('ThemeColor', JSON.stringify(form.themeColor)); await updateXpackSettingByKey('ThemeColor', JSON.stringify(form.themeColor));
@ -207,8 +217,8 @@ const onReSet = async () => {
setPrimaryColor(color); setPrimaryColor(color);
initFavicon(); initFavicon();
drawerVisible.value = false; drawerVisible.value = false;
return;
} }
});
}; };
const handleClose = () => { const handleClose = () => {