diff --git a/pc4mobx/hrmSalary/components/captchaModal/index.js b/pc4mobx/hrmSalary/components/captchaModal/index.js index 1ae52279..efe657ba 100644 --- a/pc4mobx/hrmSalary/components/captchaModal/index.js +++ b/pc4mobx/hrmSalary/components/captchaModal/index.js @@ -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() { diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js index e6c1df11..35544ea5 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js @@ -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(); }}/> {/*发送验证码*/} - this.setState({ captchaVisible: false })} - onConfirm={() => { - setInitEmVerify(); - this.getMySalaryBill(getQueryString("id")); - }} - /> + { + captchaVisible && this.setState({ captchaVisible: false })} + onConfirm={() => { + setInitEmVerify(); + this.getMySalaryBill(getQueryString("id")); + }} + /> + } ; const { salaryTemplate, salaryGroups, employeeInformation, sendTime, confirmStatus, showAck, showFeedback