fix: translation

This commit is contained in:
chenos 2022-08-23 09:11:20 +08:00
parent e6a2dff79a
commit 966b4e3459
3 changed files with 8 additions and 4 deletions

View File

@ -555,4 +555,5 @@ export default {
"View all plugins": "View all plugins", "View all plugins": "View all plugins",
"Print": "Print", "Print": "Print",
'Single select and radio fields can be used as the grouping field': 'Single select and radio fields can be used as the grouping field', 'Single select and radio fields can be used as the grouping field': 'Single select and radio fields can be used as the grouping field',
'Sign up successfully, and automatically jump to the sign in page': 'Sign up successfully, and automatically jump to the sign in page',
} }

View File

@ -659,4 +659,5 @@ export default {
"Enabled languages": "启用的语言", "Enabled languages": "启用的语言",
"View all plugins": "查看所有插件", "View all plugins": "查看所有插件",
"Print": "打印", "Print": "打印",
'Sign up successfully, and automatically jump to the sign in page': '注册成功,即将跳转到登录页面',
} }

View File

@ -2,6 +2,7 @@ import { ISchema, useForm } from '@formily/react';
import { uid } from '@formily/shared'; import { uid } from '@formily/shared';
import { message } from 'antd'; import { message } from 'antd';
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next';
import { Redirect, useHistory } from 'react-router-dom'; import { Redirect, useHistory } from 'react-router-dom';
import { SchemaComponent, useAPIClient, useCurrentDocumentTitle, useSystemSettings } from '..'; import { SchemaComponent, useAPIClient, useCurrentDocumentTitle, useSystemSettings } from '..';
import VerificationCode from './VerificationCode'; import VerificationCode from './VerificationCode';
@ -26,7 +27,7 @@ const schema: ISchema = {
'x-validator': 'phone', 'x-validator': 'phone',
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
'x-component-props': { placeholder: '{{t("Phone")}}', style: {} }, 'x-component-props': { placeholder: '{{t("Phone")}}', style: {} },
'x-visible': '{{smsAuthEnabled}}' 'x-visible': '{{smsAuthEnabled}}',
}, },
code: { code: {
type: 'string', type: 'string',
@ -37,7 +38,7 @@ const schema: ISchema = {
targetFieldName: 'phone', targetFieldName: 'phone',
}, },
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
'x-visible': '{{smsAuthEnabled}}' 'x-visible': '{{smsAuthEnabled}}',
}, },
password: { password: {
type: 'string', type: 'string',
@ -110,13 +111,14 @@ export const useSignup = () => {
const history = useHistory(); const history = useHistory();
const form = useForm(); const form = useForm();
const api = useAPIClient(); const api = useAPIClient();
const { t } = useTranslation();
return { return {
async run() { async run() {
await form.submit(); await form.submit();
await api.resource('users').signup({ await api.resource('users').signup({
values: form.values, values: form.values,
}); });
message.success('注册成功,即将跳转登录页'); message.success('Sign up successfully, and automatically jump to the sign in page');
setTimeout(() => { setTimeout(() => {
history.push('/signin'); history.push('/signin');
}, 2000); }, 2000);
@ -135,7 +137,7 @@ export const SignupPage = () => {
<SchemaComponent <SchemaComponent
schema={schema} schema={schema}
components={{ components={{
VerificationCode VerificationCode,
}} }}
scope={{ useSignup, smsAuthEnabled }} scope={{ useSignup, smsAuthEnabled }}
/> />