chore: 代码保存,除了冠军模块,其他显示正常

This commit is contained in:
2025-11-12 20:01:21 +08:00
parent 391c489fb5
commit d6ee43e48b
10 changed files with 1048 additions and 294 deletions

View File

@@ -2,11 +2,43 @@ import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import router from './router'
import { getBackgroundConfig } from './services/configService'
// 设置页面背景
const setupBackground = async () => {
try {
const backgroundConfig = await getBackgroundConfig();
// 如果配置了使用背景图片
if (backgroundConfig.useBackgroundImage && backgroundConfig.backgroundImage) {
document.body.style.backgroundImage = `url(${backgroundConfig.backgroundImage})`;
document.body.style.backgroundSize = backgroundConfig.backgroundSize || 'cover';
document.body.style.backgroundPosition = backgroundConfig.backgroundPosition || 'center';
document.body.style.backgroundRepeat = 'no-repeat';
document.body.style.backgroundAttachment = 'fixed';
} else if (backgroundConfig.backgroundColor) {
// 使用纯色背景
document.body.style.backgroundColor = backgroundConfig.backgroundColor;
document.body.style.backgroundImage = 'none';
}
} catch (error) {
console.error('设置背景失败:', error);
}
};
// 设置默认背景(立即应用)
document.body.style.backgroundImage = 'url(/battle-background.jpg)';
document.body.style.backgroundSize = 'contain';
document.body.style.backgroundPosition = 'center';
document.body.style.backgroundRepeat = 'no-repeat';
document.body.style.backgroundAttachment = 'fixed';
const app = createApp(App)
// 使用路由
app.use(router)
// 挂载应用
app.mount('#app')
// 挂载应用前设置背景
setupBackground().then(() => {
app.mount('#app');
});