salary-management-front/pc4mobx/hrmSalary/pages/mobilePayroll/secondaryVerify.js

87 lines
2.7 KiB
JavaScript
Raw Normal View History

/*
* 二次验证密码
*
* @Author: 黎永顺
* @Date: 2025/4/16
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { WeaForm, WeaSwitch } from "comsMobx";
import { message } from "antd";
import FormInfo from "../../components/FormInfo";
import { secondaryVerifyConditions } from "./conditions";
import * as API from "../../apis/mySalaryBenefits";
import MobileModal from "./mobileModal";
const form = new WeaForm();
const getLabel = WeaLocaleProvider.getLabel;
class SecondaryVerify extends Component {
constructor(props) {
super(props);
this.state = { notSetting: false };
}
2025-11-20 14:39:45 +08:00
componentWillMount() {
this.setState({ notSetting: false }, () => form.resetForm());
}
componentDidMount() {
API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, this.props.salaryBillToken)
.then(({ notSetting }) => {
this.setState({ notSetting });
});
form.initFormFields(secondaryVerifyConditions);
}
componentWillUnmount() {
this.setState({ notSetting: false }, () => form.resetForm());
}
doSecondAuth = () => {
form.validateForm().then(f => {
if (f.isValid) {
const { salaryBillToken } = this.props;
API.doSecondAuth({ mouldCode: "HRM", itemCode: "SALARY", ...form.getFormParams() }, salaryBillToken)
.then(({ status, checkStatus, checkMsg }) => {
if (status && checkStatus === "1") {
message.success(checkMsg);
this.props.onSuccess();
} else {
form.showError("authCode", checkMsg);
}
});
} else {
f.showErrors();
}
});
};
render() {
2025-11-11 17:14:14 +08:00
const { notSetting } = this.state, { isSalaryMobile, onCancel } = this.props;
const itemRender = {
authCode: (field, textAreaProps, form, formParams) => {
return (<React.Fragment>
<WeaSwitch fieldConfig={{ ...field, ...textAreaProps }} form={form} formParams={formParams}/>
{
notSetting &&
<div style={{ clear: "both", paddingTop: 10 }}>
{getLabel(111, "您还未设置二次验证密码,点击")}
<a href="javascript:void(0);" onClick={this.props.onSetLogin}>{getLabel(111, "设置")}</a>
</div>
}
</React.Fragment>);
}
};
2025-11-11 17:14:14 +08:00
return (
<MobileModal title={getLabel(111, "身份验证")} onConfirm={this.doSecondAuth} isSalaryMobile={isSalaryMobile}
onCancel={onCancel}>
<FormInfo center={false} custLabelCol={9} itemRender={itemRender} form={form}
formFields={secondaryVerifyConditions}/>
</MobileModal>);
}
}
2025-11-11 17:14:14 +08:00
export default SecondaryVerify;