修改密码组件

This commit is contained in:
禺狨
2023-03-24 14:56:23 +08:00
parent fb98e0986a
commit 6021adf463
9 changed files with 127 additions and 85 deletions

View File

@@ -1,64 +0,0 @@
import { Row, Col, Form, Input, Button, message } from "antd";
import styles from "./index.module.scss";
import { user } from "../../api/index";
import { useNavigate } from "react-router-dom";
const ChangePasswordPage = () => {
const navigate = useNavigate();
const [form] = Form.useForm();
const onFinish = (values: any) => {
user.password(values.old_password, values.new_password).then((res: any) => {
message.success("保存成功!");
navigate(-1);
});
};
const onFinishFailed = (errorInfo: any) => {
console.log("Failed:", errorInfo);
};
return (
<>
<Row className="playedu-main-body">
<Col>
<div className="float-left">
<Form
form={form}
name="basic"
labelCol={{ span: 8 }}
wrapperCol={{ span: 16 }}
style={{ width: 600 }}
initialValues={{ remember: true }}
onFinish={onFinish}
onFinishFailed={onFinishFailed}
autoComplete="off"
>
<Form.Item
label="原密码"
name="old_password"
rules={[{ required: true, message: "请输入原密码!" }]}
>
<Input.Password placeholder="请输入原密码" />
</Form.Item>
<Form.Item
label="新密码"
name="new_password"
rules={[{ required: true, message: "请输入新密码!" }]}
>
<Input.Password placeholder="请输入新密码" />
</Form.Item>
<Form.Item wrapperCol={{ offset: 8, span: 16 }}>
<Button type="primary" htmlType="submit">
</Button>
</Form.Item>
</Form>
</div>
</Col>
</Row>
</>
);
};
export default ChangePasswordPage;

View File

@@ -3,7 +3,7 @@ import { Row, Col, Empty, Spin, Tabs } from "antd";
import type { TabsProps } from "antd";
import { user } from "../../api/index";
import styles from "./index.module.scss";
import { AnyIfEmpty, useSelector } from "react-redux";
import { useSelector } from "react-redux";
import { CoursesModel } from "./compenents/courses-model";
import myLesoon from "../../assets/images/commen/icon-mylesoon.png";
import studyTime from "../../assets/images/commen/icon-studytime.png";