custom-联特
This commit is contained in:
parent
535ee6b6ed
commit
38ba12e9e6
|
|
@ -21,13 +21,6 @@ const form = new WeaForm();
|
||||||
const getLabel = WeaLocaleProvider.getLabel;
|
const getLabel = WeaLocaleProvider.getLabel;
|
||||||
|
|
||||||
class SecondarypwdModify extends Component {
|
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() {
|
componentDidMount() {
|
||||||
form.initFormFields(secondarypwdCondition);
|
form.initFormFields(secondarypwdCondition);
|
||||||
|
|
@ -40,22 +33,19 @@ class SecondarypwdModify extends Component {
|
||||||
save = async () => {
|
save = async () => {
|
||||||
form.validateForm().then(f => {
|
form.validateForm().then(f => {
|
||||||
if (f.isValid) {
|
if (f.isValid) {
|
||||||
const { secondaryPwd1: newSecondaryPwd1, secondaryPwd2: newSecondaryPwd2, validatecode } = form.getFormParams();
|
const { secondaryPwd1: newSecondaryPwd1, secondaryPwd2: newSecondaryPwd2 } = form.getFormParams();
|
||||||
if (newSecondaryPwd1 !== newSecondaryPwd1) {
|
if (newSecondaryPwd1 !== newSecondaryPwd1) {
|
||||||
form.showError("secondaryPwd2", getLabel(504376, "密码确认不正确!"));
|
form.showError("secondaryPwd2", getLabel(504376, "密码确认不正确!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RSAEcrypt("1", { newSecondaryPwd1, newSecondaryPwd2 }).then(RSAParam => {
|
RSAEcrypt("1", { newSecondaryPwd1, newSecondaryPwd2 }).then(RSAParam => {
|
||||||
API.modifySecondaryPwd({ ...RSAParam, validatecode }, this.props.salaryBillToken)
|
API.modifySecondaryPwd({ ...RSAParam }, this.props.salaryBillToken)
|
||||||
.then(({ sign, message: msg }) => {
|
.then(({ sign, message: msg }) => {
|
||||||
if (sign === "1") {
|
if (sign === "1") {
|
||||||
message.success(msg);
|
message.success(msg);
|
||||||
this.props.onSuccess();
|
this.props.onSuccess();
|
||||||
} else {
|
} else {
|
||||||
form.showError("validatecode", msg);
|
form.showError("secondaryPwd2", 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}` });
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -65,9 +55,10 @@ class SecondarypwdModify extends Component {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
handleChangeForm = () => {
|
handleChangeForm = () => {
|
||||||
|
form.updateFields({ validatecode: "123" });
|
||||||
RSAEcrypt("1", { newSecondaryPwd1: form.getFormParams().secondaryPwd1 }).then(RSAParam => {
|
RSAEcrypt("1", { newSecondaryPwd1: form.getFormParams().secondaryPwd1 }).then(RSAParam => {
|
||||||
API.checkNewSecondaryPwd({ ...RSAParam }).then(({ result }) => {
|
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}/>
|
onBlur={this.handleChangeForm}/>
|
||||||
</React.Fragment>);
|
</React.Fragment>);
|
||||||
},
|
},
|
||||||
validatecode: (field, textAreaProps, form, formParams) => {
|
validatecode: () => null
|
||||||
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>);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return (<MobileModal title={getLabel(111, "二次验证密码设置")} onConfirm={this.save}>
|
return (<MobileModal title={getLabel(111, "二次验证密码设置")} onConfirm={this.save}>
|
||||||
<FormInfo className="secondarypwd-form" center={false} itemRender={itemRender} form={form}
|
<FormInfo center={false} itemRender={itemRender} form={form} formFields={secondarypwdCondition}/>
|
||||||
formFields={secondarypwdCondition}/>
|
|
||||||
</MobileModal>);
|
</MobileModal>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue