| | |
| | | } from "react-admin"; |
| | | import polyglotI18nProvider from "ra-i18n-polyglot"; |
| | | import englishMessages from "./i18n/en"; |
| | | import zhMessages from "./i18n/zh"; |
| | | import { Layout } from "./layout"; |
| | | import AuthProvider from "./config/authProvider"; |
| | | import DataProvider from "./config/dataProvider"; |
| | |
| | | DATA_PROVIDER_SPRING, |
| | | } from "./config/setting"; |
| | | import ResourceContent from "./page/ResourceContent"; |
| | | import { getSystemInfo } from "@/api/auth"; |
| | | import { getSystemInfo, getSystemDicts, tenants } from "@/api/auth"; |
| | | import chineseMessages from 'ra-language-chinese'; |
| | | import { createTheme, ThemeProvider } from '@mui/material/styles'; |
| | | import { zhCN } from '@mui/material/locale'; |
| | | |
| | | const i18nProvider = polyglotI18nProvider( |
| | | (locale) => { |
| | | if (locale === "zh") { |
| | | return import("./i18n/zh").then((messages) => messages.default); |
| | | if (locale === "en") { |
| | | return import("./i18n/en").then((messages) => messages.default); |
| | | } |
| | | // fallback |
| | | return englishMessages; |
| | | return { ...chineseMessages, ...zhMessages }; |
| | | }, |
| | | // default |
| | | // 'en', |
| | | resolveBrowserLocale("en", { fullLocale: true }), |
| | | "zh", |
| | | [ |
| | | { locale: "en", name: "English" }, |
| | | { locale: "zh", name: "简体中文" }, |
| | |
| | | allowMissing: true, |
| | | }, |
| | | ); |
| | | |
| | | |
| | | const theme = createTheme( |
| | | { |
| | | palette: { main: '#1976d2' }, |
| | | }, |
| | | zhCN |
| | | ) |
| | | |
| | | |
| | | const store = localStorageStore(SPA_VERSION, SPA_NAME); |
| | | |
| | |
| | | useEffect(() => { |
| | | getSystemInfo().then((data) => { |
| | | localStorage.setItem("system", JSON.stringify(data)); |
| | | }); |
| | | }) |
| | | }, []); |
| | | |
| | | return ( |
| | |
| | | }; |
| | | |
| | | const AppWrapper = () => ( |
| | | <StoreContextProvider value={store}> |
| | | <App /> |
| | | </StoreContextProvider> |
| | | <ThemeProvider theme={theme}> |
| | | <StoreContextProvider value={store}> |
| | | <App /> |
| | | </StoreContextProvider> |
| | | </ThemeProvider> |
| | | |
| | | ); |
| | | |
| | | export default AppWrapper; |
| | | export default AppWrapper; |