pref(app): 修改系统默认语言为中文

master
钟良源 5 months ago
parent 5c8a36e10f
commit d80429f682

@ -29,7 +29,7 @@ interface RenderConfig {
export default function MyApp({
pageProps,
Component,
renderConfig,
renderConfig
}: AppProps & { renderConfig: RenderConfig }) {
const { arcoLang, arcoTheme } = renderConfig;
const [lang, setLang] = useStorage('arco-lang', arcoLang || 'en-US');
@ -43,19 +43,19 @@ export default function MyApp({
case 'en-US':
return enUS;
default:
return enUS;
return zhCN;
}
}, [lang]);
function fetchUserInfo() {
store.dispatch({
type: 'update-userInfo',
payload: { userLoading: true },
payload: { userLoading: true }
});
axios.get('/api/user/userInfo').then((res) => {
store.dispatch({
type: 'update-userInfo',
payload: { userInfo: res.data, userLoading: false },
payload: { userInfo: res.data, userLoading: false }
});
});
}
@ -63,7 +63,8 @@ export default function MyApp({
useEffect(() => {
if (checkLogin()) {
fetchUserInfo();
} else if (window.location.pathname.replace(/\//g, '') !== 'login') {
}
else if (window.location.pathname.replace(/\//g, '') !== 'login') {
window.location.pathname = '/login';
}
}, []);
@ -99,7 +100,7 @@ export default function MyApp({
lang,
setLang,
theme,
setTheme,
setTheme
};
return (
@ -116,14 +117,14 @@ export default function MyApp({
locale={locale}
componentConfig={{
Card: {
bordered: false,
bordered: false
},
List: {
bordered: false,
bordered: false
},
Table: {
border: false,
},
border: false
}
}}
>
<Provider store={store}>
@ -149,7 +150,7 @@ MyApp.getInitialProps = async (appContext) => {
return {
renderConfig: {
arcoLang: serverCookies['arco-lang'],
arcoTheme: serverCookies['arco-theme'],
},
arcoTheme: serverCookies['arco-theme']
}
};
};

Loading…
Cancel
Save