12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import React from "react";
- import md5 from "md5";
- import { Button, Form, Input, Radio } from "antd";
- import { login } from "@/services/login";
-
- export default (props) => {
- const { onSuccess, mode, appid } = props;
- const [form] = Form.useForm();
- const [loading, setLoading] = React.useState(false);
- console.log(process.env.NODE_ENV);
- const onFinish = (values) => {
- setLoading(true);
- login({
- loginName: values.loginName,
- loginType: "platform.pc",
- password: md5(values.password),
- })
- .then((res) => {
- setLoading(true);
- onSuccess(res.user);
- setLoading(false);
- })
- .catch((err) => {
- // console.log('----err--', err);
- setLoading(false);
- });
-
- setLoading(false);
- };
- return (
- <Form
- form={form}
- layout="vertical"
- onFinish={onFinish}
- // style={{ width: "260px", marginTop: "24px", paddingBottom: "24px" }}
- >
- <Form.Item
- label="账户"
- name="loginName"
- rules={[{ required: true, message: "请输入账户" }]}
- >
- <Input placeholder="请输入账户" style={{ borderRadius: "4px" }} />
- </Form.Item>
- <Form.Item
- label="密 码"
- name="password"
- rules={[{ required: true, message: "请输入密码" }]}
- >
- <Input.Password
- placeholder="请输入密码"
- style={{ borderRadius: "4px" }}
- />
- </Form.Item>
- <Form.Item>
- <Button
- type="primary"
- size="large"
- style={{ width: "100%", marginTop: "24px", borderRadius: "4px" }}
- loading={loading}
- htmlType="submit"
- >
- 登录
- </Button>
- </Form.Item>
- </Form>
- );
- };
|