Skip to content

Commit d859e23

Browse files
committed
refactor: 只留loading页面 把插件loading去掉
1 parent 5290535 commit d859e23

File tree

5 files changed

+33
-69
lines changed

5 files changed

+33
-69
lines changed

src/main.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,10 @@ import FallbackRender from '../ErrorBoundary.tsx';
99
import App from './App.tsx';
1010
import './plugins/assets';
1111
import { setupI18n } from './locales';
12-
import { setupAppVersionNotification, setupDayjs, setupIconifyOffline, setupLoading, setupNProgress } from './plugins';
12+
import { setupAppVersionNotification, setupDayjs, setupIconifyOffline, setupNProgress } from './plugins';
1313

14-
async function setupApp() {
15-
await setupI18n();
16-
17-
setupLoading();
18-
19-
setupNProgress();
20-
21-
setupIconifyOffline();
22-
23-
setupDayjs();
24-
25-
setupAppVersionNotification();
14+
function setupApp() {
15+
setupI18n();
2616

2717
const container = document.getElementById('root');
2818

@@ -39,6 +29,14 @@ async function setupApp() {
3929
</Provider>
4030
</ErrorBoundary>
4131
);
32+
33+
setupNProgress();
34+
35+
setupIconifyOffline();
36+
37+
setupDayjs();
38+
39+
setupAppVersionNotification();
4240
}
4341

4442
setupApp();

src/pages/(base)/manage/user/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ const UserManage = () => {
220220
export const handle = {
221221
i18nKey: 'route.(base)_manage_user',
222222
icon: 'ic:round-manage-accounts',
223+
keepAlive: true,
223224
order: 1,
224225
roles: ['R_ADMIN'],
225226
title: 'manage_user'

src/pages/loading.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
1+
// @unocss-include
2+
import { getRgb } from '@sa/color';
13
import clsx from 'clsx';
24

35
import SystemLogo from '@/components/SystemLogo';
6+
import { DARK_CLASS } from '@/constants/app';
7+
import { toggleHtmlClass } from '@/utils/common';
8+
import { localStg } from '@/utils/storage';
49

510
const GlobalLoading = memo(() => {
611
const { t } = useTranslation();
712

13+
const themeColor = localStg.get('themeColor') || '#646cff';
14+
15+
const darkMode = localStg.get('darkMode') || false;
16+
17+
if (darkMode) {
18+
toggleHtmlClass(DARK_CLASS).add();
19+
}
20+
21+
const { b, g, r } = getRgb(themeColor);
22+
23+
const primaryColor = `--primary-color: ${r} ${g} ${b}`;
24+
825
const loadingClasses = [
926
'left-0 top-0',
1027
'left-0 bottom-0 animate-delay-500',
@@ -13,7 +30,10 @@ const GlobalLoading = memo(() => {
1330
];
1431

1532
return (
16-
<div className="fixed-center flex-col">
33+
<div
34+
className="fixed-center flex-col bg-layout"
35+
style={primaryColor as React.CSSProperties}
36+
>
1737
<SystemLogo className="size-128px text-primary" />
1838
<div className="my-36px h-56px w-56px">
1939
<div className="relative h-full animate-spin">

src/plugins/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export * from './app';
22
export * from './dayjs';
33
export * from './iconify';
4-
export * from './loading';
54
export * from './nprogress';

src/plugins/loading.ts

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)