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

73 lines
2.1 KiB
JavaScript
Raw Normal View History

/*
* 二次验证
* 登录密码验证
* @Author: 黎永顺
* @Date: 2025/4/23
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaDialog, WeaLocaleProvider } from "ecCom";
import { WeaForm } from "comsMobx";
import { Button } from "antd";
import FormInfo from "../../components/FormInfo";
import { loginCondition } from "./pwdCondtion";
import { RSAEcrypt } from "../../util/RSAUtil";
import * as API from "../../apis/mySalaryBenefits";
const form = new WeaForm();
const getLabel = WeaLocaleProvider.getLabel;
class LoginVerifyPC extends Component {
constructor(props) {
super(props);
this.state = { loading: false };
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) {
form.initFormFields(loginCondition);
} else {
form.resetForm();
}
}
save = async () => {
form.validateForm().then(f => {
if (f.isValid) {
RSAEcrypt("1", { ...form.getFormParams() }, this.props.salaryBillToken)
.then(RSAParam => {
API.checkPassword({ ...RSAParam }).then(({ result }) => {
if (result) {
this.props.onCancel();
this.props.onSetPwdSet();
} else {
form.showError("password", getLabel(504343, "登录密码错误"));
}
});
});
} else {
f.showErrors();
}
});
};
render() {
const { loading } = this.state;
return (
<WeaDialog
{...this.props}
style={{ width: 550, height: _.reduce(loginCondition, (pre, cur) => (pre += cur.items.length), 0) * 47 + 33 }}
initLoadCss title={getLabel(111, "请先输入登录密码")} buttons={[
<Button type="primary" onClick={this.save} loading={loading}>{getLabel(111, "下一步")}</Button>
]}>
<FormInfo className="form-dialog-layout" center={false} itemRender={{}} form={form}
formFields={loginCondition}/>
</WeaDialog>
);
}
}
export default LoginVerifyPC;