From 523d8cf68615134c7780f74933e70a14edb60f01 Mon Sep 17 00:00:00 2001
From: skyouc <958836976@qq.com>
Date: 星期五, 05 九月 2025 17:00:39 +0800
Subject: [PATCH] wcs联调功能优化
---
rsf-admin/src/App.jsx | 40 ++++++++++++++++++++++++++++++----------
1 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/rsf-admin/src/App.jsx b/rsf-admin/src/App.jsx
index 328a4b6..c8601b9 100644
--- a/rsf-admin/src/App.jsx
+++ b/rsf-admin/src/App.jsx
@@ -29,21 +29,38 @@
} from "./config/setting";
import ResourceContent from "./page/ResourceContent";
import { getSystemInfo, getSystemDicts, tenants } from "@/api/auth";
+import chineseMessages from 'ra-language-chinese';
+import { createTheme, ThemeProvider } from '@mui/material/styles';
+import { zhCN, frFR, enUS } from '@mui/material/locale';
+
+
+const getMaterialUILocale = (locale) => {
+ switch (locale) {
+ case 'en':
+ return enUS;
+ case 'fr':
+ return frFR;
+ default:
+ return zhCN;
+ }
+};
const i18nProvider = polyglotI18nProvider(
(locale) => {
if (locale === "en") {
return import("./i18n/en").then((messages) => messages.default);
}
- // fallback
- return zhMessages;
+ return { ...chineseMessages, ...zhMessages };
},
- // default
- // 'en',
- resolveBrowserLocale("zh", { fullLocale: true }),
+ "zh",
[
{ locale: "en", name: "English" },
{ locale: "zh", name: "绠�浣撲腑鏂�" },
+ { locale: "jp", name: "鏃ユ湰瑾�" },
+ { locale: "kr", name: "頃滉淡鞚�" },
+ { locale: "ru", name: "Russian" },
+ { locale: "lk", name: "袪褍褋褋泻懈泄" },
+ { locale: "es", name: "Espa帽ola" },
],
{
// msg in console
@@ -51,19 +68,21 @@
},
);
+
const store = localStorageStore(SPA_VERSION, SPA_NAME);
const App = () => {
const [themeName] = useStore("themeName", DEFAULT_THEME_NAME);
const lightTheme = themes.find((theme) => theme.name === themeName)?.light;
const darkTheme = themes.find((theme) => theme.name === themeName)?.dark;
-
+ const [locale, setLocale] = useState('zh');
+ const theme = createTheme(
+ {
+ ...lightTheme
+ }, getMaterialUILocale(locale))
useEffect(() => {
getSystemInfo().then((data) => {
localStorage.setItem("system", JSON.stringify(data));
- })
- getSystemDicts().then(data => {
- localStorage.setItem('sys_dicts', JSON.stringify(data));
})
}, []);
@@ -77,6 +96,7 @@
lightTheme={lightTheme}
darkTheme={darkTheme}
defaultTheme={DEFAULT_THEME_MODE}
+ theme={theme}
i18nProvider={i18nProvider}
dataProvider={DataProvider(DATA_PROVIDER_SPRING)}
loginPage={Login}
@@ -111,4 +131,4 @@
</StoreContextProvider>
);
-export default AppWrapper;
+export default AppWrapper;
\ No newline at end of file
--
Gitblit v1.9.1