2024-01-20 19:13:31 +08:00
|
|
|
// @unocss-include
|
2024-04-26 01:42:35 +08:00
|
|
|
import { getRgb } from '@sa/color';
|
2024-01-20 19:13:31 +08:00
|
|
|
import { $t } from '@/locales';
|
|
|
|
import { localStg } from '@/utils/storage';
|
2024-08-16 16:33:11 +08:00
|
|
|
import SystemLogo from '@/assets/imgs/logo.png';
|
2024-01-20 19:13:31 +08:00
|
|
|
|
|
|
|
export function setupLoading() {
|
2024-08-16 16:33:11 +08:00
|
|
|
const themeColor = localStg.get('themeColor') || '#2080f0';
|
2024-01-20 19:13:31 +08:00
|
|
|
|
2024-04-26 01:42:35 +08:00
|
|
|
const { r, g, b } = getRgb(themeColor);
|
2024-01-20 19:13:31 +08:00
|
|
|
|
|
|
|
const primaryColor = `--primary-color: ${r} ${g} ${b}`;
|
|
|
|
|
|
|
|
const loading = `
|
|
|
|
<div class="fixed-center flex-col" style="${primaryColor}">
|
2024-08-16 16:33:11 +08:00
|
|
|
<div class="w-120px h-120px my-36px">
|
2024-01-20 19:13:31 +08:00
|
|
|
<div class="relative h-full animate-spin">
|
2024-08-16 16:33:11 +08:00
|
|
|
<img src="${SystemLogo}" width="120" />
|
2024-01-20 19:13:31 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<h2 class="text-28px font-500 text-#646464">${$t('system.title')}</h2>
|
|
|
|
</div>`;
|
|
|
|
|
|
|
|
const app = document.getElementById('app');
|
|
|
|
|
|
|
|
if (app) {
|
|
|
|
app.innerHTML = loading;
|
|
|
|
}
|
|
|
|
}
|