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 = () => {
-
-
-