diff --git a/src/api/user.ts b/src/api/user.ts
index cb3fafa..0f54116 100644
--- a/src/api/user.ts
+++ b/src/api/user.ts
@@ -25,3 +25,8 @@ export const editUser = (data?: object) => {
export const deleteUser = (userId: string) => {
return http.request("delete", baseUri("/user/delete/" + userId));
};
+
+// 修改密码
+export const changePassword = (data?: object) => {
+ return http.request("post", baseUri("/user/change-password"), { data });
+};
diff --git a/src/layout/components/lay-navbar/component/change-password.vue b/src/layout/components/lay-navbar/component/change-password.vue
new file mode 100644
index 0000000..d88f7ac
--- /dev/null
+++ b/src/layout/components/lay-navbar/component/change-password.vue
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/layout/components/lay-navbar/index.vue b/src/layout/components/lay-navbar/index.vue
index e9bfc7f..3bf2a9b 100644
--- a/src/layout/components/lay-navbar/index.vue
+++ b/src/layout/components/lay-navbar/index.vue
@@ -6,15 +6,22 @@ import LayNavMix from "../lay-sidebar/NavMix.vue";
import LaySidebarFullScreen from "../lay-sidebar/components/SidebarFullScreen.vue";
import LaySidebarBreadCrumb from "../lay-sidebar/components/SidebarBreadCrumb.vue";
import LaySidebarTopCollapse from "../lay-sidebar/components/SidebarTopCollapse.vue";
-
import LogoutCircleRLine from "@iconify-icons/ri/logout-circle-r-line";
import Setting from "@iconify-icons/ri/settings-3-line";
import { h, ref } from "vue";
import { addDialog } from "@/components/ReDialog/index";
-import { editUser as editUserApi, getUser, userList } from "@/api/user";
+import {
+ changePassword,
+ editUser as editUserApi,
+ getUser,
+ userList
+} from "@/api/user";
import { storageLocal } from "@pureadmin/utils";
import { setUser, userKey } from "@/utils/auth";
import forms, { type FormProps } from "./component/user.vue";
+import changePwdForms, {
+ type ChangePwdFormProps
+} from "./component/change-password.vue";
import { useRouter } from "vue-router";
import useGetGlobalProperties from "@/hooks/useGetGlobalProperties";
@@ -34,6 +41,7 @@ const { $bus } = useGetGlobalProperties();
const router = useRouter();
const userEditFormRef = ref();
+const changePwdFormRef = ref();
// eslint-disable-next-line vue/valid-define-emits
const emit = defineEmits();
@@ -85,6 +93,34 @@ const openUserInfoDialog = () => {
}
});
};
+
+const openChangePasswordDialog = () => {
+ const loginUser = storageLocal().getItem(userKey);
+ addDialog({
+ width: "20%",
+ title: loginUser.name,
+ contentRenderer: () => h(changePwdForms, { ref: changePwdFormRef }),
+ props: {
+ formInline: {
+ id: loginUser.id,
+ originPassword: "",
+ newPassword: "",
+ confirmPassword: ""
+ }
+ },
+ beforeSure: (done, { options }) => {
+ const FormRef = changePwdFormRef.value.getUserChangePwdFormRef();
+ FormRef.validate(valid => {
+ if (!valid) return;
+ changePassword(options.props.formInline).then(res => {
+ if (res.code === 200) {
+ done();
+ }
+ });
+ });
+ }
+ });
+};
@@ -126,6 +162,15 @@ const openUserInfoDialog = () => {
个人信息
+
+
+
+ 修改密码
+
+