/* * 二次验证密码设置 * * @Author: 黎永顺 * @Date: 2025/4/17 * @Wechat: * @Email: 971387674@qq.com * @description: */ import React, { Component } from "react"; import { WeaDialog, WeaLocaleProvider } from "ecCom"; import { Button, message } from "antd"; import { WeaForm, WeaSwitch } from "comsMobx"; import FormInfo from "../../components/FormInfo"; import { secondarypwdCondition } from "./conditions"; import * as API from "../../apis/mySalaryBenefits"; import { RSAEcrypt } from "../../util/RSAUtil"; const form = new WeaForm(); const getLabel = WeaLocaleProvider.getLabel; class SecondarypwdVerifyPC extends Component { constructor(props) { super(props); this.state = { src: (window.ecologyContentPath || "") + "/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4", num: 0 }; } componentDidMount() { form.initFormFields(secondarypwdCondition); } componentWillUnmount() { form.resetForm(); } save = async () => { form.validateForm().then(f => { if (f.isValid) { const { secondaryPwd1, secondaryPwd2, validatecode } = form.getFormParams(); if (secondaryPwd1 !== secondaryPwd2) { form.showError("secondaryPwd2", getLabel(504376, "密码确认不正确!")); return; } RSAEcrypt("1", { secondaryPwd1, secondaryPwd2 }).then(RSAParam => { API.saveSecondaryPwd({ ...RSAParam, validatecode }, this.props.salaryBillToken) .then(({ sign, message: msg }) => { if (sign === "1") { message.success(msg); this.props.onCancel(); this.props.onSuccess(); } else { form.showError("validatecode", msg); this.setState({ num: this.state.num + 1 }, () => { this.setState({ src: `${window.ecologyContentPath || ""}/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=${this.state.num}` }); }); } }); }); } else { f.showErrors(); } }); }; render() { const itemRender = { validatecode: (field, textAreaProps, form, formParams) => { return ( { this.setState({ num: this.state.num + 1 }, () => { this.setState({ src: `${window.ecologyContentPath || ""}/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=${this.state.num}` }); }); }} alt=""/> ); } }; return ( (pre += cur.items.length), 0) * 47 + 33 }} initLoadCss title={getLabel(111, "二次验证密码设置")} buttons={[ ]}> ); } } export default SecondarypwdVerifyPC;