You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.3 KiB

1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
12 months ago
1 year ago
  1. import { Form, FormProps, Input, notification } from 'antd'
  2. import '../../styles/login.scss'
  3. import Button from '../../components/Button'
  4. import { useRouter } from '../../hooks/useRouter'
  5. import store from '../../store'
  6. import { useEffect, useState } from 'react'
  7. import { http_code, http_login, http_submit } from '../../http/api'
  8. import { useTranslation } from 'react-i18next'
  9. import LanguageMenu from '../../components/LanguageMenu'
  10. type FieldType = {
  11. account: string;
  12. password: string;
  13. };
  14. const Submit = () => {
  15. const [form] = Form.useForm()
  16. const { t } = useTranslation()
  17. const onFinish: FormProps<FieldType>['onFinish'] = async (values) => {
  18. const res: any = await http_submit({
  19. ...values
  20. })
  21. if (res.code === 0) {
  22. notification.success({
  23. message: t('Submit success')
  24. })
  25. form.resetFields()
  26. }
  27. };
  28. useEffect(() => {
  29. }, [])
  30. return (
  31. <div className='login' style={{ position: 'relative' }}>
  32. <div style={{ position: 'absolute', top: 20, right: 20 }}>
  33. <LanguageMenu width={40} />
  34. </div>
  35. <div className='container'>
  36. <div className='row-center'>
  37. <img src={require('../../assets/gmi.jpg')} className='img' alt="" />
  38. </div>
  39. <div className='row-center'>
  40. <div style={{ maxWidth: 500, width: '100%', padding: '0 20px' }}>
  41. <Form
  42. onFinish={onFinish}
  43. form={form}
  44. >
  45. <Form.Item
  46. name="account"
  47. rules={[
  48. {
  49. required: true,
  50. message: t('Please enter a account'),
  51. },
  52. ]}
  53. >
  54. <Input className='input' placeholder={t('Account')} ></Input>
  55. </Form.Item>
  56. <Form.Item
  57. name="password"
  58. rules={[
  59. {
  60. required: true,
  61. message: t('Please enter a password'),
  62. },
  63. ]}
  64. >
  65. <Input.Password className='input' placeholder={t('Please enter a password')} />
  66. </Form.Item>
  67. <Form.Item>
  68. <Button htmlType="submit">{t('Submit')}</Button>
  69. </Form.Item>
  70. </Form>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. )
  76. }
  77. export default Submit