From e940433b524d534f3be6132f5c427114a20b2fa1 Mon Sep 17 00:00:00 2001 From: tone <3341154833@qq.com> Date: Sun, 18 May 2025 21:29:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BF=AE=E6=94=B9=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=AF=86=E7=A0=81=E6=97=B6=E5=A4=B1=E8=B4=A5=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/list/components/user-info-editor.tsx | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tone-page-web/app/console/(with-menu)/user/list/components/user-info-editor.tsx b/tone-page-web/app/console/(with-menu)/user/list/components/user-info-editor.tsx index c30dddf..17717f5 100644 --- a/tone-page-web/app/console/(with-menu)/user/list/components/user-info-editor.tsx +++ b/tone-page-web/app/console/(with-menu)/user/list/components/user-info-editor.tsx @@ -50,6 +50,7 @@ export function UserInfoEditor({ if (res) { toast.success("保存成功"); onUserUpdate(res); + onClose(); } else { throw new Error(); } @@ -75,12 +76,14 @@ export function UserInfoEditor({ } } + const [passwordDialogOpen, setPasswordDialogOpen] = React.useState(false); const [setPasswordLoading, setSetPasswordLoading] = React.useState(false); const handleSetPassword = async (userId: string, password: string) => { try { setSetPasswordLoading(true); await AdminApi.user.setPassword(userId, password); toast.success("密码修改成功"); + setPasswordDialogOpen(false); } catch (error) { toast.error((error as Error).message || "密码修改失败"); } finally { @@ -100,6 +103,8 @@ export function UserInfoEditor({ user={user} onSetPassword={handleSetPassword} onRemove={handleRemove} + passwordDialogOpen={passwordDialogOpen} + setPasswordDialogOpen={setPasswordDialogOpen} onSubmit={(e) => { e.preventDefault() const formData = new FormData(e.currentTarget); @@ -137,11 +142,13 @@ export function UserInfoEditor({ ) } -function ProfileForm({ className, user, onSetPassword, onRemove, ...props }: +function ProfileForm({ className, user, onSetPassword, onRemove, passwordDialogOpen, setPasswordDialogOpen, ...props }: React.ComponentProps<"form"> & { - user: User, - onSetPassword: (userId: string, password: string) => Promise, - onRemove: (userId: string) => Promise, + user: User; + onSetPassword: (userId: string, password: string) => Promise; + onRemove: (userId: string) => Promise; + passwordDialogOpen: boolean; + setPasswordDialogOpen: (s: boolean) => void; }) { const [newPassword, setNewPassword] = React.useState(""); @@ -168,7 +175,7 @@ function ProfileForm({ className, user, onSetPassword, onRemove, ...props }:
- + @@ -194,9 +201,7 @@ function ProfileForm({ className, user, onSetPassword, onRemove, ...props }:
- - - +