mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-24 02:59:16 +08:00
feat: 主题色保存/恢复增加确认提示 (#7036)
This commit is contained in:
parent
4c01b1e542
commit
911b4076f5
@ -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 = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user