diff --git a/src/compenents/header/index.tsx b/src/compenents/header/index.tsx index ce44ab2..9cc17db 100644 --- a/src/compenents/header/index.tsx +++ b/src/compenents/header/index.tsx @@ -14,15 +14,15 @@ export const Header: React.FC = () => { if (key === "login_out") { dispatch(LoginOutActionCreator()); navigate("/login"); - } else if (key === "edit_password") { - navigate("/editPasswor"); + } else if (key === "change_password") { + navigate("/change-password"); } }; const items: MenuProps["items"] = [ { label: "修改密码", - key: "edit_password", + key: "change_password", }, { label: "退出登录", diff --git a/src/pages/change-password/index.module.less b/src/pages/change-password/index.module.less new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/change-password/index.tsx b/src/pages/change-password/index.tsx new file mode 100644 index 0000000..af620ba --- /dev/null +++ b/src/pages/change-password/index.tsx @@ -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 ( + <> + + +
+ +
+
+
+ + + + + + + + + + +
+
+ +
+ + ); +}; diff --git a/src/pages/index.ts b/src/pages/index.ts index 0a329fe..d5393ae 100644 --- a/src/pages/index.ts +++ b/src/pages/index.ts @@ -17,3 +17,4 @@ export * from "./system/adminroles/update"; export * from "./department"; export * from "./department/create"; export * from "./department/update"; +export * from "./change-password"; diff --git a/src/router/routes.tsx b/src/router/routes.tsx index b27586c..7cb86d2 100644 --- a/src/router/routes.tsx +++ b/src/router/routes.tsx @@ -19,6 +19,7 @@ import { DepartmentPage, DepartmentCreatePage, DepartmentUpdatePage, + ChangePasswordPage } from "../pages"; const routes: RouteObject[] = [ @@ -30,6 +31,10 @@ const routes: RouteObject[] = [ path: "/", element: , }, + { + path: "/change-password", + element: , + }, { path: "/vod", element: ,