Merge pull request #57 from Kininaru/master

fix: remove all dom APIs from the project
This commit is contained in:
hsluoyz 2021-05-15 12:43:41 +08:00 committed by GitHub
commit 08779b607d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -27,6 +27,7 @@ export const CropperDiv = (props) => {
const {title} = props;
const {targetFunction} = props;
const {buttonText} = props;
let uploadButton;
const onChange = (e) => {
e.preventDefault();
@ -74,7 +75,7 @@ export const CropperDiv = (props) => {
};
const selectFile = () => {
document.getElementsByName('fileupload').item(0).click()
uploadButton.click();
}
return (
@ -95,7 +96,7 @@ export const CropperDiv = (props) => {
>
<Col style={{margin: "0px auto 40px auto", width: 1000, height: 300}}>
<Row style={{width: "100%", marginBottom: "20px"}}>
<input style={{display: "none"}} name="fileupload" type="file" onChange={onChange}/>
<input style={{display: "none"}} ref={input => uploadButton = input} type="file" onChange={onChange}/>
<Button block onClick={selectFile}>{i18next.t("user:Select a photo...")}</Button>
</Row>
<Cropper

View File

@ -21,6 +21,9 @@ import * as Setting from "./Setting";
export const PasswordModal = (props) => {
const [visible, setVisible] = React.useState(false);
const [confirmLoading, setConfirmLoading] = React.useState(false);
const [oldPassword, setOldPassword] = React.useState("");
const [newPassword, setNewPassword] = React.useState("");
const [rePassword, setRePassword] = React.useState("");
const {user} = props;
const showModal = () => {
@ -32,10 +35,6 @@ export const PasswordModal = (props) => {
};
const handleOk = () => {
let oldPassword = document.getElementById("old-password")?.value;
let newPassword = document.getElementById("new-password").value;
let rePassword = document.getElementById("re-new-password").value;
if (oldPassword === null || oldPassword === undefined) oldPassword = "";
if (newPassword === "" || rePassword === "") {
Setting.showMessage("error", i18next.t("user:Empty input!"));
return;
@ -75,14 +74,14 @@ export const PasswordModal = (props) => {
<Col style={{margin: "0px auto 40px auto", width: 1000, height: 300}}>
{ hasOldPassword ? (
<Row style={{width: "100%", marginBottom: "20px"}}>
<Input.Password addonBefore={i18next.t("user:Old Password")} placeholder={i18next.t("user:input password")} id="old-password"/>
<Input.Password addonBefore={i18next.t("user:Old Password")} placeholder={i18next.t("user:input password")} onChange={(e) => setOldPassword(e.target.value)}/>
</Row>
) : null}
<Row style={{width: "100%", marginBottom: "20px"}}>
<Input.Password addonBefore={i18next.t("user:New Password")} placeholder={i18next.t("user:input password")} id="new-password"/>
<Input.Password addonBefore={i18next.t("user:New Password")} placeholder={i18next.t("user:input password")} onChange={(e) => setNewPassword(e.target.value)}/>
</Row>
<Row style={{width: "100%", marginBottom: "20px"}}>
<Input.Password addonBefore={i18next.t("user:Re-enter New")} placeholder={i18next.t("user:input password")} id="re-new-password"/>
<Input.Password addonBefore={i18next.t("user:Re-enter New")} placeholder={i18next.t("user:input password")} onChange={(e) => setRePassword(e.target.value)}/>
</Row>
</Col>
</Modal>