From ead1233f36b1cd332ba2296b2c8e264dcab459cb Mon Sep 17 00:00:00 2001 From: MyGit <3282299728@qq.com> Date: Wed, 10 Jul 2024 11:36:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=96=B0=E5=A2=9E=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E6=A1=86=E7=BB=84=E4=BB=B6=EF=BC=8C=E6=8E=A7=E5=88=B6=E6=98=BE?= =?UTF-8?q?=E9=9A=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/bs-ui/input/index.tsx | 24 +++++++++++++++++- .../src/pages/LoginPage/UserPwdModal.tsx | 5 ++-- src/frontend/src/pages/LoginPage/resetPwd.tsx | 17 ++++++------- .../SystemPage/components/CreateUser.tsx | 25 ++++--------------- 4 files changed, 37 insertions(+), 34 deletions(-) diff --git a/src/frontend/src/components/bs-ui/input/index.tsx b/src/frontend/src/components/bs-ui/input/index.tsx index 093fb91db..496ce97cc 100644 --- a/src/frontend/src/components/bs-ui/input/index.tsx +++ b/src/frontend/src/components/bs-ui/input/index.tsx @@ -3,6 +3,9 @@ import { cname } from "../utils" import { SearchIcon } from "../../bs-icons/search" import { generateUUID } from "../utils" import { MinusCircledIcon } from "@radix-ui/react-icons" +import { EyeOpenIcon, EyeNoneIcon } from "@radix-ui/react-icons" +import { useState } from "react" + export interface InputProps extends React.InputHTMLAttributes { } @@ -36,6 +39,25 @@ const SearchInput = React.forwardRef( + ({ className, inputClassName, iconClassName, ...props }, ref) => { + const [type, setType] = useState('password') + const handleShowPwd = () => { + type === 'password' ? setType('text') : setType('password') + } + return
+ + { + type === 'password' + ? + : + } +
+ } +) + +PasswordInput.displayName = 'PasswordInput' + /** * 多行文本 @@ -144,4 +166,4 @@ const InputList = React.forwardRef((props, ref)
- passwordRef.current.value = e.target.value} diff --git a/src/frontend/src/pages/LoginPage/resetPwd.tsx b/src/frontend/src/pages/LoginPage/resetPwd.tsx index ce9c90f88..ed9bc08ad 100644 --- a/src/frontend/src/pages/LoginPage/resetPwd.tsx +++ b/src/frontend/src/pages/LoginPage/resetPwd.tsx @@ -4,7 +4,7 @@ import { useEffect, useRef } from "react"; import { useTranslation } from 'react-i18next'; import { useLocation, useNavigate } from 'react-router-dom'; import { Button } from "../../components/bs-ui/button"; -import { Input } from "../../components/bs-ui/input"; +import { PasswordInput } from "../../components/bs-ui/input"; import { loggedChangePasswordApi, changePasswordApi } from "../../controllers/API/user"; import { captureAndAlertRequestErrorHoc } from "../../controllers/request"; import { PWD_RULE, handleEncrypt } from './utils'; @@ -89,30 +89,27 @@ export const ResetPwdPage = () => {
-
-
-