custom-联特

This commit is contained in:
lys 2025-04-29 10:19:41 +08:00
parent 535ee6b6ed
commit 38ba12e9e6
1 changed files with 7 additions and 29 deletions

View File

@ -21,13 +21,6 @@ const form = new WeaForm();
const getLabel = WeaLocaleProvider.getLabel;
class SecondarypwdModify 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);
@ -40,22 +33,19 @@ class SecondarypwdModify extends Component {
save = async () => {
form.validateForm().then(f => {
if (f.isValid) {
const { secondaryPwd1: newSecondaryPwd1, secondaryPwd2: newSecondaryPwd2, validatecode } = form.getFormParams();
const { secondaryPwd1: newSecondaryPwd1, secondaryPwd2: newSecondaryPwd2 } = form.getFormParams();
if (newSecondaryPwd1 !== newSecondaryPwd1) {
form.showError("secondaryPwd2", getLabel(504376, "密码确认不正确!"));
return;
}
RSAEcrypt("1", { newSecondaryPwd1, newSecondaryPwd2 }).then(RSAParam => {
API.modifySecondaryPwd({ ...RSAParam, validatecode }, this.props.salaryBillToken)
API.modifySecondaryPwd({ ...RSAParam }, this.props.salaryBillToken)
.then(({ sign, message: msg }) => {
if (sign === "1") {
message.success(msg);
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}` });
});
form.showError("secondaryPwd2", msg);
}
});
});
@ -65,9 +55,10 @@ class SecondarypwdModify extends Component {
});
};
handleChangeForm = () => {
form.updateFields({ validatecode: "123" });
RSAEcrypt("1", { newSecondaryPwd1: form.getFormParams().secondaryPwd1 }).then(RSAParam => {
API.checkNewSecondaryPwd({ ...RSAParam }).then(({ result }) => {
if (!result) form.showError("secondaryPwd2", getLabel(111, "二次验证密码不能和登录密码相同!"));
if (!result) form.showError("secondaryPwd1", getLabel(111, "二次验证密码不能和登录密码相同!"));
});
});
};
@ -81,23 +72,10 @@ class SecondarypwdModify extends Component {
onBlur={this.handleChangeForm}/>
</React.Fragment>);
},
validatecode: (field, textAreaProps, form, formParams) => {
return (<React.Fragment>
<WeaSwitch fieldConfig={{ ...field, ...textAreaProps }} form={form} formParams={formParams}/>
<img
style={{ height: 30, cursor: "pointer", position: "absolute", left: "118%" }}
src={this.state.src}
onClick={() => {
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=""/>
</React.Fragment>);
}
validatecode: () => null
};
return (<MobileModal title={getLabel(111, "二次验证密码设置")} onConfirm={this.save}>
<FormInfo className="secondarypwd-form" center={false} itemRender={itemRender} form={form}
formFields={secondarypwdCondition}/>
<FormInfo center={false} itemRender={itemRender} form={form} formFields={secondarypwdCondition}/>
</MobileModal>);
}
}