| | |
| | | ProFormCaptcha, |
| | | ProFormCheckbox, |
| | | ProFormText, |
| | | ProFormSelect |
| | | } from '@ant-design/pro-components'; |
| | | import { Button, Divider, Alert, Tabs, message, theme, Form } from 'antd'; |
| | | import { useState, useEffect } from 'react'; |
| | |
| | | import { request } from '@umijs/max'; |
| | | import { setToken } from '@/utils/token-util' |
| | | import { PROJECT_NAME } from '@/config/setting' |
| | | import Http from '@/utils/http'; |
| | | |
| | | import logo from './logo.png' |
| | | |
| | |
| | | } |
| | | }; |
| | | |
| | | const fetchHostList = async () => { |
| | | const res = await Http.doGet('api/auth/host', {}) |
| | | console.log(res.data); |
| | | } |
| | | fetchHostList(); |
| | | |
| | | const handleSubmit = async (values) => { |
| | | try { |
| | | const r = await request('/api/login', { |
| | |
| | | backgroundColor: 'rgba(0, 0, 0,0.65)', |
| | | backdropFilter: 'blur(4px)', |
| | | }} |
| | | initialValues={{ |
| | | // username: 'root', |
| | | // password: '123456', |
| | | }} |
| | | onFinish={async (values) => { |
| | | await handleSubmit(values); |
| | | }} |
| | |
| | | </Tabs> |
| | | {loginType === 'account' && ( |
| | | <> |
| | | <ProFormSelect |
| | | className="centered-select" |
| | | name="hostId" |
| | | placeholder="机构:" |
| | | rules={[ |
| | | { |
| | | required: true, |
| | | message: '请选择机构!', |
| | | }, |
| | | ]} |
| | | debounceTime={300} |
| | | request={async ({ keyWords }) => { |
| | | const resp = await Http.doGet('api/auth/host', {}); |
| | | return resp.data.map(item => ({ |
| | | label: item.name, |
| | | value: item.id |
| | | })); |
| | | }} |
| | | /> |
| | | <ProFormText |
| | | name="username" |
| | | fieldProps={{ |
| | |
| | | /> |
| | | ), |
| | | }} |
| | | placeholder={'用户名: root'} |
| | | placeholder={'用户名: '} |
| | | rules={[ |
| | | { |
| | | required: true, |
| | |
| | | /> |
| | | ), |
| | | }} |
| | | placeholder={'密码: 123456'} |
| | | placeholder={'密码: '} |
| | | rules={[ |
| | | { |
| | | required: true, |