feat(web): add lint (#875)

* feat: add lint

* feat: fix lint error

* chore: add ignore file

* chore: close indent
This commit is contained in:
キリサメ qianxi
2022-07-10 15:45:55 +08:00
committed by GitHub
parent 475b6da35a
commit 503d244166
121 changed files with 17023 additions and 16815 deletions

View File

@ -18,9 +18,9 @@ import i18next from "i18next";
import * as UserBackend from "../backend/UserBackend";
import {SafetyOutlined} from "@ant-design/icons";
import {authConfig} from "../auth/Auth";
import { CaptchaWidget } from "./CaptchaWidget";
import {CaptchaWidget} from "./CaptchaWidget";
const { Search } = Input;
const {Search} = Input;
export const CountDownInput = (props) => {
const {disabled, textBefore, onChange, onButtonClickArgs} = props;
@ -38,35 +38,35 @@ export const CountDownInput = (props) => {
const [clientSecret2, setClientSecret2] = React.useState("");
const handleCountDown = (leftTime = 60) => {
let leftTimeSecond = leftTime
setButtonLeftTime(leftTimeSecond)
let leftTimeSecond = leftTime;
setButtonLeftTime(leftTimeSecond);
const countDown = () => {
leftTimeSecond--;
setButtonLeftTime(leftTimeSecond)
setButtonLeftTime(leftTimeSecond);
if (leftTimeSecond === 0) {
return;
}
setTimeout(countDown, 1000);
}
};
setTimeout(countDown, 1000);
}
};
const handleOk = () => {
setVisible(false);
setButtonLoading(true)
setButtonLoading(true);
UserBackend.sendCode(checkType, checkId, key, ...onButtonClickArgs).then(res => {
setKey("");
setButtonLoading(false)
setButtonLoading(false);
if (res) {
handleCountDown(60);
}
})
}
});
};
const handleCancel = () => {
setVisible(false);
setKey("");
}
};
const loadCaptcha = () => {
UserBackend.getCaptcha("admin", authConfig.appName, false).then(res => {
@ -90,8 +90,8 @@ export const CountDownInput = (props) => {
setClientId2(res.clientId2);
setClientSecret2(res.clientSecret2);
}
})
}
});
};
const renderCaptcha = () => {
return (
@ -108,16 +108,16 @@ export const CountDownInput = (props) => {
}}
/>
<Row>
<Input autoFocus value={key} prefix={<SafetyOutlined/>} placeholder={i18next.t("general:Captcha")} onPressEnter={handleOk} onChange={e => setKey(e.target.value)}/>
<Input autoFocus value={key} prefix={<SafetyOutlined />} placeholder={i18next.t("general:Captcha")} onPressEnter={handleOk} onChange={e => setKey(e.target.value)} />
</Row>
</Col>
)
}
);
};
const onSubmit = (token) => {
setButtonDisabled(false);
setKey(token);
}
};
const renderCheck = () => {
if (checkType === "Default") {
@ -135,14 +135,14 @@ export const CountDownInput = (props) => {
/>
);
}
}
};
return (
<React.Fragment>
<Search
addonBefore={textBefore}
disabled={disabled}
prefix={<SafetyOutlined/>}
prefix={<SafetyOutlined />}
placeholder={i18next.t("code:Enter your code")}
onChange={e => onChange(e.target.value)}
enterButton={
@ -171,4 +171,4 @@ export const CountDownInput = (props) => {
</Modal>
</React.Fragment>
);
}
};