fix: resolve custom login background image issue (#12977)

This commit is contained in:
ssongliu
2026-06-09 17:28:36 +08:00
committed by GitHub
parent 791350c299
commit ed30567a22
2 changed files with 25 additions and 9 deletions
+4 -4
View File
@@ -1301,8 +1301,8 @@ onBeforeUnmount(() => {
:deep(.md-editor-content .md-editor-preview) {
padding: 0;
font-size: 11px;
line-height: 1.2;
font-size: 14px;
line-height: 1.6;
word-break: break-word;
white-space: pre-wrap;
}
@@ -1312,8 +1312,8 @@ onBeforeUnmount(() => {
:deep(.md-editor-preview table),
:deep(.md-editor-preview blockquote),
:deep(.md-editor-preview code) {
font-size: 11px;
line-height: 1.4;
font-size: 14px;
line-height: 1.6;
}
:deep(.md-editor-preview h1),
+21 -5
View File
@@ -62,11 +62,23 @@ const getStatus = async () => {
const loadImage = (name: string) => {
const { loginImage, loginBackground, loginBgType } = themeConfig.value;
if (name === 'loginImage') {
return loginImage === 'loginImage' ? loadedLoginImage.value : currentDefaultLoginImage.value;
if (loginImage === 'loginImage') {
return loadedLoginImage.value || currentDefaultLoginImage.value;
}
if (loginImage) {
return loginImage;
}
return currentDefaultLoginImage.value;
}
if (name === 'loginBackground') {
if (loginBgType === 'image') {
return loginBackground === 'loginBackground' ? loadedBackgroundImage.value : defaultLoginBgImage;
if (loginBackground === 'loginBackground') {
return loadedBackgroundImage.value || defaultLoginBgImage;
}
if (loginBackground) {
return loginBackground;
}
return defaultLoginBgImage;
}
if (loginBgType === 'color') {
return loginBackground;
@@ -85,8 +97,12 @@ onMounted(async () => {
await getStatus();
const loginImageUrl = `/api/v2/images/loginImage?t=${Date.now()}`;
const backgroundImageUrl = `/api/v2/images/loginBackground?t=${Date.now()}`;
loadedLoginImage.value = await preloadImage(loginImageUrl);
loadedBackgroundImage.value = await preloadImage(backgroundImageUrl);
if (themeConfig.value.loginImage === 'loginImage') {
loadedLoginImage.value = await preloadImage(loginImageUrl);
}
if (themeConfig.value.loginBgType === 'image' && themeConfig.value.loginBackground === 'loginBackground') {
loadedBackgroundImage.value = await preloadImage(backgroundImageUrl);
}
if (themeConfig.value.loginBgType === 'color') {
backgroundStyle.value = {
backgroundColor: themeConfig.value.loginBackground,
@@ -101,7 +117,7 @@ onMounted(async () => {
};
img.onerror = () => {
backgroundStyle.value = {
backgroundImage: `url(${defaultLoginBgImage})`, // 你定义的默认图
backgroundImage: `url(${defaultLoginBgImage})`,
};
};
img.src = url;