支持多语言英文

This commit is contained in:
whyour
2023-07-29 18:26:30 +08:00
parent 39bfd39559
commit e7d023a7e0
68 changed files with 2186 additions and 982 deletions
+20 -18
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react';
import { Typography, Input, Form, Button, message, Avatar, Upload } from 'antd';
import { request } from '@/utils/http';
@@ -110,8 +111,8 @@ const SecuritySettings = ({ user, userChange }: any) => {
<>
{twoFactorInfo ? (
<div>
<Title level={5}></Title>
Google Authenticator
<Title level={5}>{intl.get('第一步')}</Title>
{intl.get('下载两步验证手机应用,比如 Google Authenticator 、')}
<Link
href="https://www.microsoft.com/en-us/security/mobile-authenticator-app"
target="_blank"
@@ -137,9 +138,10 @@ const SecuritySettings = ({ user, userChange }: any) => {
LastPass Authenticator
</Link>
<Title style={{ marginTop: 5 }} level={5}>
{intl.get('第二步')}
</Title>
使 {twoFactorInfo?.secret}
{intl.get('使用手机应用扫描二维码,或者输入秘钥')}{' '}
{twoFactorInfo?.secret}
<div style={{ marginTop: 10 }}>
<QRCode
style={{ border: '1px solid #21262d', borderRadius: 6 }}
@@ -149,9 +151,9 @@ const SecuritySettings = ({ user, userChange }: any) => {
/>
</div>
<Title style={{ marginTop: 5 }} level={5}>
{intl.get('第三步')}
</Title>
6
{intl.get('输入手机应用上的6位数字')}
<Input
style={{ margin: '10px 0 10px 0', display: 'block', maxWidth: 200 }}
value={code}
@@ -159,7 +161,7 @@ const SecuritySettings = ({ user, userChange }: any) => {
placeholder="123456"
/>
<Button type="primary" loading={loading} onClick={completeTowFactor}>
{intl.get('完成设置')}
</Button>
</div>
) : (
@@ -176,35 +178,35 @@ const SecuritySettings = ({ user, userChange }: any) => {
paddingBottom: 4,
}}
>
{intl.get('修改用户名密码')}
</div>
<Form onFinish={handleOk} layout="vertical">
<Form.Item
label="用户名"
label={intl.get('用户名')}
name="username"
rules={[{ required: true }]}
hasFeedback
style={{ maxWidth: 300 }}
>
<Input placeholder="用户名" />
<Input placeholder={intl.get('用户名')} />
</Form.Item>
<Form.Item
label="密码"
label={intl.get('密码')}
name="password"
rules={[
{ required: true },
{
pattern: /^(?!admin$).*$/,
message: '密码不能为admin',
message: intl.get('密码不能为admin'),
},
]}
hasFeedback
style={{ maxWidth: 300 }}
>
<Input type="password" placeholder="密码" />
<Input type="password" placeholder={intl.get('密码')} />
</Form.Item>
<Button type="primary" htmlType="submit">
{intl.get('保存')}
</Button>
</Form>
@@ -217,14 +219,14 @@ const SecuritySettings = ({ user, userChange }: any) => {
marginTop: 16,
}}
>
{intl.get('两步验证')}
</div>
<Button
type="primary"
danger={twoFactorActivated}
onClick={activeOrDeactiveTwoFactor}
>
{twoFactorActivated ? '禁用' : '启用'}
{twoFactorActivated ? intl.get('禁用') : intl.get('启用')}
</Button>
<div
@@ -236,7 +238,7 @@ const SecuritySettings = ({ user, userChange }: any) => {
marginTop: 16,
}}
>
{intl.get('头像')}
</div>
<Avatar size={128} shape="square" icon={<UserOutlined />} src={avatar} />
<ImgCrop rotationSlider>
@@ -252,7 +254,7 @@ const SecuritySettings = ({ user, userChange }: any) => {
}}
>
<Button icon={<UploadOutlined />} style={{ marginLeft: 8 }}>
{intl.get('更换头像')}
</Button>
</Upload>
</ImgCrop>