feat(ui): add persistent custom background image upload feature (#415)

This commit is contained in:
sagit
2026-04-05 17:44:19 +08:00
committed by sagitchu
parent 7668e24f4b
commit 534d36f0a1
4 changed files with 209 additions and 2 deletions
+19
View File
@@ -90,6 +90,25 @@ const LoginRoute = () => {
function App() {
const location = useLocation();
// 处理自定义背景图片
useEffect(() => {
const updateBg = () => {
const customBg = siteConfig.app_bg_image;
if (customBg) {
document.documentElement.style.setProperty("--custom-bg-image", `url(${customBg})`);
document.documentElement.classList.add("has-custom-bg");
} else {
document.documentElement.style.removeProperty("--custom-bg-image");
document.documentElement.classList.remove("has-custom-bg");
}
};
updateBg();
window.addEventListener("site-config-updated", updateBg);
return () => {
window.removeEventListener("site-config-updated", updateBg);
};
}, []);
// 立即设置页面标题(使用已从缓存读取的配置)
useEffect(() => {
document.title = siteConfig.name;