From 9cf6502893f94e7ff0c3d5950723074d229c3966 Mon Sep 17 00:00:00 2001 From: yziiy <15979918+mayday-yziiy@user.noreply.gitee.com> Date: Fri, 10 Oct 2025 17:20:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/modules/admin.ts | 7 ++++- src/views/Admin/userList/hook.tsx | 41 +++++++++++++++++++++++++-- src/views/Admin/userList/index.vue | 4 +++ src/views/Admin/userList/password.vue | 30 ++++++++++++++++++++ src/views/system/private/index.vue | 3 +- 5 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 src/views/Admin/userList/password.vue diff --git a/src/api/modules/admin.ts b/src/api/modules/admin.ts index 70639a0..52ab34f 100644 --- a/src/api/modules/admin.ts +++ b/src/api/modules/admin.ts @@ -46,4 +46,9 @@ export const getLogInfo = params => { "/adminapi/Adminlog/detail", { params } ); -}; \ No newline at end of file +}; +export const apiPassWord = data => { + return http.request("post", "/adminapi/User/changePwd", { + data + }); +} \ No newline at end of file diff --git a/src/views/Admin/userList/hook.tsx b/src/views/Admin/userList/hook.tsx index 430953f..78bf6fb 100644 --- a/src/views/Admin/userList/hook.tsx +++ b/src/views/Admin/userList/hook.tsx @@ -6,8 +6,10 @@ import { addData, editData, deleteData, - getDataInfo + getDataInfo, + apiPassWord } from "@/api/modules/admin"; +import passwordForm from './password.vue'; import { addDialog } from "@/components/ReDialog"; export function useData() { const formRef = ref(); @@ -142,6 +144,40 @@ export function useData() { onSearch(); } }; + const settingPassWord = (title, rowData) => { + addDialog({ + title: title, + width: "40%", + props: { + formInline: { + new_pwd: "" + } + }, + closeOnClickModal: false, + contentRenderer: () => h(passwordForm, { ref: formRef, formInline: null }), + beforeSure: (done, { options }) => { + const FormRef = formRef.value.getRef(); + const curData = options.props.formInline; + const updatePassWord = async form => { + console.log(form) + const { code } = await apiPassWord(form); + if (code) { + message("设置成功", { type: "success" }); + onSearch(); + done(); + } else { + message("设置失败", { type: "error" }); + } + }; + FormRef.validate(valid => { + if (valid) { + console.log("curData", curData.new_pwd); + updatePassWord({ new_pwd: curData.new_pwd, user_id: rowData.id }) + } + }); + } + }); + } return { onSearch, isShow, @@ -152,6 +188,7 @@ export function useData() { handleCurrentChange, loading, openDialog, - handleDelete + handleDelete, + settingPassWord }; } diff --git a/src/views/Admin/userList/index.vue b/src/views/Admin/userList/index.vue index 4e44d5c..46c5b2a 100644 --- a/src/views/Admin/userList/index.vue +++ b/src/views/Admin/userList/index.vue @@ -15,6 +15,7 @@ const { handleCurrentChange, openDialog, loading, + settingPassWord, handleDelete } = useData(); defineOptions({ @@ -44,6 +45,9 @@ onMounted(() => { color: 'var(--el-text-color-primary)' }" @page-size-change="handleSizeChange" @page-current-change="handleCurrentChange">