mirror of
https://github.com/PlayEdu/backend
synced 2025-06-22 14:02:48 +08:00
修改密码
This commit is contained in:
parent
d66c19bb4c
commit
16bc8b027f
@ -14,15 +14,15 @@ export const Header: React.FC = () => {
|
|||||||
if (key === "login_out") {
|
if (key === "login_out") {
|
||||||
dispatch(LoginOutActionCreator());
|
dispatch(LoginOutActionCreator());
|
||||||
navigate("/login");
|
navigate("/login");
|
||||||
} else if (key === "edit_password") {
|
} else if (key === "change_password") {
|
||||||
navigate("/editPasswor");
|
navigate("/change-password");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const items: MenuProps["items"] = [
|
const items: MenuProps["items"] = [
|
||||||
{
|
{
|
||||||
label: "修改密码",
|
label: "修改密码",
|
||||||
key: "edit_password",
|
key: "change_password",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "退出登录",
|
label: "退出登录",
|
||||||
|
0
src/pages/change-password/index.module.less
Normal file
0
src/pages/change-password/index.module.less
Normal file
76
src/pages/change-password/index.tsx
Normal file
76
src/pages/change-password/index.tsx
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { Row, Col, Form, Input, Button, message } from "antd";
|
||||||
|
import styles from "./create.module.less";
|
||||||
|
import { login } from "../../api/index";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import { BackBartment } from "../../compenents";
|
||||||
|
|
||||||
|
export const ChangePasswordPage: React.FC = () => {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
|
const onFinish = (values: any) => {
|
||||||
|
login
|
||||||
|
.passwordChange(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 mb-24">
|
||||||
|
<BackBartment title="修改密码" />
|
||||||
|
</div>
|
||||||
|
<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>
|
||||||
|
<Button
|
||||||
|
className="ml-15"
|
||||||
|
htmlType="button"
|
||||||
|
onClick={() => navigate(-1)}
|
||||||
|
>
|
||||||
|
取消
|
||||||
|
</Button>
|
||||||
|
</Form.Item>
|
||||||
|
</Form>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
@ -17,3 +17,4 @@ export * from "./system/adminroles/update";
|
|||||||
export * from "./department";
|
export * from "./department";
|
||||||
export * from "./department/create";
|
export * from "./department/create";
|
||||||
export * from "./department/update";
|
export * from "./department/update";
|
||||||
|
export * from "./change-password";
|
||||||
|
@ -19,6 +19,7 @@ import {
|
|||||||
DepartmentPage,
|
DepartmentPage,
|
||||||
DepartmentCreatePage,
|
DepartmentCreatePage,
|
||||||
DepartmentUpdatePage,
|
DepartmentUpdatePage,
|
||||||
|
ChangePasswordPage
|
||||||
} from "../pages";
|
} from "../pages";
|
||||||
|
|
||||||
const routes: RouteObject[] = [
|
const routes: RouteObject[] = [
|
||||||
@ -30,6 +31,10 @@ const routes: RouteObject[] = [
|
|||||||
path: "/",
|
path: "/",
|
||||||
element: <Dashboard />,
|
element: <Dashboard />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/change-password",
|
||||||
|
element: <ChangePasswordPage />,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/vod",
|
path: "/vod",
|
||||||
element: <VodListPage />,
|
element: <VodListPage />,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user