feature/2.19.1.2501.01-PC端Token验证

This commit is contained in:
lys 2025-04-25 13:55:23 +08:00
parent fad6c3a2b1
commit 40c7a4f7a0
2 changed files with 36 additions and 33 deletions

View File

@ -31,17 +31,11 @@ class Index extends Component {
componentWillUnmount() {
clearInterval(this.timeRef);
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && !nextProps.visible) {
clearInterval(this.timeRef);
this.setState({ captcha: "", time: 60 });
}
this.setState({ captcha: "", time: 60 });
}
handleSendCaptcha = () => {
sendMobileCode({ id: this.props.id }).then(({ status, data }) => {
sendMobileCode({ id: this.props.id }, this.props.salaryBillToken).then(({ status }) => {
if (status) {
this.timeRef = setInterval(() => {
const { time } = this.state;
@ -64,14 +58,15 @@ class Index extends Component {
f.showErrors();
return;
}
checkMobileCode({ id: this.props.id, mobileCode: this.state.captcha }).then(({ status, errormsg }) => {
if (status) {
this.props.onCancel();
this.props.onConfirm();
} else {
message.error(errormsg);
}
});
checkMobileCode({ id: this.props.id, mobileCode: this.state.captcha }, this.props.salaryBillToken)
.then(({ status, errormsg }) => {
if (status) {
this.props.onCancel();
this.props.onConfirm();
} else {
message.error(errormsg);
}
});
};
render() {

View File

@ -92,15 +92,21 @@ export default class MobilePayroll extends React.Component {
salaryCode: _.pick(params, ["salaryCode"]).salaryCode
});
this.setState({ salaryBillToken: data }, () => {
API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
.then(({ status, isNeedSecondAuth }) => {
if (status && isNeedSecondAuth) {
this.setState({ visible: true });
} else {
this.getMySalaryBill(getQueryString("id"));
setInitEmVerify();
}
});
payrollCheckType(this.state.salaryBillToken).then(({ data, status }) => {
if (status && data === "PWD") {
API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
.then(({ status, isNeedSecondAuth }) => {
if (status && isNeedSecondAuth) {
this.setState({ visible: true });
} else {
this.getMySalaryBill(getQueryString("id"));
setInitEmVerify();
}
});
} else {
this.setState({ captchaVisible: true });
}
});
});
}
};
@ -187,14 +193,16 @@ export default class MobilePayroll extends React.Component {
setInitEmVerify();
}}/>
{/*发送验证码*/}
<CaptchaModal
visible={captchaVisible} id={getQueryString("id")}
onCancel={() => this.setState({ captchaVisible: false })}
onConfirm={() => {
setInitEmVerify();
this.getMySalaryBill(getQueryString("id"));
}}
/>
{
captchaVisible && <CaptchaModal
visible={captchaVisible} id={getQueryString("id")} salaryBillToken={this.state.salaryBillToken}
onCancel={() => this.setState({ captchaVisible: false })}
onConfirm={() => {
setInitEmVerify();
this.getMySalaryBill(getQueryString("id"));
}}
/>
}
</React.Fragment>;
const {
salaryTemplate, salaryGroups, employeeInformation, sendTime, confirmStatus, showAck, showFeedback