diff --git a/pc4mobx/hrmSalary/apis/payroll.js b/pc4mobx/hrmSalary/apis/payroll.js
index 01932e6a..5f800d68 100644
--- a/pc4mobx/hrmSalary/apis/payroll.js
+++ b/pc4mobx/hrmSalary/apis/payroll.js
@@ -202,8 +202,12 @@ export const salaryBillSendSum = (params) => {
return postFetch("/api/bs/hrmsalary/salaryBill/send/sum", params);
};
//工资单发放-发送短信验证码
-export const sendMobileCode = (params) => {
- return postFetch("/api/bs/hrmsalary/salaryBill/sendMobileCode", params);
+export const sendMobileCode = (params, header = {}) => {
+ return postFetch("/api/bs/hrmsalary/salaryBill/sendMobileCode", params, header);
+};
+//工资单发放-发送短信验证码
+export const checkMobileCode = (params, header = {}) => {
+ return postFetch("/api/bs/hrmsalary/salaryBill/checkMobileCode", params, header);
};
//工资单-验证方式
export const payrollCheckType = async header => {
diff --git a/pc4mobx/hrmSalary/components/captchaModal/index.js b/pc4mobx/hrmSalary/components/captchaModal/index.js
index a7f00b9b..1ae52279 100644
--- a/pc4mobx/hrmSalary/components/captchaModal/index.js
+++ b/pc4mobx/hrmSalary/components/captchaModal/index.js
@@ -6,22 +6,29 @@
*/
import React, { Component } from "react";
import { WeaDialog, WeaError, WeaFormItem, WeaInput, WeaLocaleProvider, WeaSearchGroup } from "ecCom";
-import { sendMobileCode } from "../../apis/payroll";
-import { Button } from "antd";
+import { WeaForm, WeaSwitch } from "comsMobx";
+import { checkMobileCode, sendMobileCode } from "../../apis/payroll";
+import { getQueryString } from "../../util/url";
+import FormInfo from "../FormInfo";
+import { captchaCondition } from "../../pages/mobilePayroll/pwdCondtion";
+import MobileModal from "../../pages/mobilePayroll/mobileModal";
+import { Button, message } from "antd";
import "./index.less";
+const form = new WeaForm();
const { getLabel } = WeaLocaleProvider;
class Index extends Component {
constructor(props) {
super(props);
- this.state = {
- captcha: "",
- time: 60
- };
+ this.state = { captcha: "", time: 60 };
this.timeRef = null;
}
+ componentDidMount() {
+ form.initFormFields(captchaCondition);
+ }
+
componentWillUnmount() {
clearInterval(this.timeRef);
}
@@ -48,44 +55,73 @@ class Index extends Component {
}
});
};
- handleConfirm = () => {
- if (!this.state.captcha) {
+ handleConfirm = async () => {
+ const type = getQueryString("type"), f = await form.validateForm();
+ if (!this.state.captcha && type !== "phone") {
this.refs.weaError.showError();
- // return
+ return;
+ } else if (!f.isValid && type === "phone") {
+ f.showErrors();
+ return;
}
- this.props.onCancel();
- this.props.onConfirm();
+ checkMobileCode({ id: this.props.id, mobileCode: this.state.captcha }).then(({ status, errormsg }) => {
+ if (status) {
+ this.props.onCancel();
+ this.props.onConfirm();
+ } else {
+ message.error(errormsg);
+ }
+ });
};
render() {
- const { captcha, time } = this.state;
- return (
-