Record.tsx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. import * as React from 'react';
  2. import { Link } from 'react-router-dom';
  3. import { IconButton } from './button';
  4. import ReturnIcon from "../icons/return.svg";
  5. const RecordApp: React.FC = () => {
  6. const [account, setAccount] = React.useState('');
  7. const [password, setPassword] = React.useState('');
  8. // 点击导出
  9. const onClickExport = async (data: { account: string, password: string }) => {
  10. if (data.account && data.password) {
  11. if (data.account === 'root' && password === 'root@2024') {
  12. const res = await fetch('/api/bigModel');
  13. console.log(res);
  14. } else {
  15. alert('账号密码不正确');
  16. }
  17. } else {
  18. alert('请输入账号密码');
  19. }
  20. }
  21. return (
  22. <div>
  23. <div style={{ padding: '14px 20px', borderBottom: '1px solid rgba(0, 0, 0, 0.1)', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
  24. <div>
  25. <div style={{ fontSize: 20, fontWeight: 'bolder' }}>
  26. 建科招聘聊天记录
  27. </div>
  28. <div style={{ fontSize: 14 }}>
  29. 输入账号密码导出聊天记录
  30. </div>
  31. </div>
  32. <div>
  33. <Link to='/'>
  34. <IconButton
  35. icon={<ReturnIcon />}
  36. bordered
  37. title='返回'
  38. aria='返回'
  39. />
  40. </Link>
  41. </div>
  42. </div>
  43. <div style={{ width: '100%', padding: '20px 0', display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
  44. <input
  45. style={{ width: '50%' }}
  46. type="text"
  47. placeholder="请输入账号"
  48. value={account}
  49. onChange={(e) => {
  50. const value = e.target.value;
  51. setAccount(value);
  52. }}
  53. />
  54. <input
  55. style={{ width: '50%', margin: '20px 0' }}
  56. type="password"
  57. placeholder="请输入密码"
  58. value={password}
  59. onChange={(e) => {
  60. const value = e.target.value;
  61. setPassword(value);
  62. }}
  63. />
  64. <button
  65. style={{
  66. width: '50%',
  67. border: '1px solid rgba(0, 0, 0, 0.1)',
  68. backgroundColor: '#FFFFFF',
  69. borderRadius: '10px',
  70. height: 36,
  71. cursor: 'pointer'
  72. }}
  73. onClick={async () => {
  74. await onClickExport({
  75. account: account,
  76. password: password,
  77. })
  78. }}
  79. >
  80. 导出
  81. </button>
  82. </div>
  83. </div>
  84. );
  85. };
  86. export default RecordApp;