Merge branch 'feature/230701-工资单移动端查看二次密码验证设置' into develop

This commit is contained in:
黎永顺 2023-07-11 12:08:18 +08:00
commit facc8dd4f6
3 changed files with 76 additions and 23 deletions

View File

@ -37,6 +37,9 @@ export const getSecondAuthForm = params => {
export const doSecondAuth = params => {
return WeaTools.callApi("/api/encrypt/secondauthsetting/doSecondAuth", "POST", params);
};
export const checkPassword = params => {
return WeaTools.callApi("/api/hrm/secondarypwd/checkPassword", "POST", params);
};
export const saveSecondaryPwd = params => {
return WeaTools.callApi("/api/hrm/secondarypwd/saveSecondaryPwd", "POST", params);
};

View File

@ -7,10 +7,10 @@
import React, { Component } from "react";
import { WeaDialog, WeaFormItem, WeaLocaleProvider, WeaSearchGroup } from "ecCom";
import { WeaSwitch } from "comsMobx";
import { condition } from "./pwdCondtion";
import { condition, loginCondition } from "./pwdCondtion";
import { Button, message } from "antd";
import { RSAEcrypt } from "../../util/RSAUtil";
import { saveSecondaryPwd } from "../../apis/mySalaryBenefits";
import { checkPassword, saveSecondaryPwd } from "../../apis/mySalaryBenefits";
import "./index.less";
const getLabel = WeaLocaleProvider.getLabel;
@ -20,11 +20,13 @@ class PassSetDialog extends Component {
super(props);
this.state = {
src: (window.ecologyContentPath || "") + "/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4",
num: 0
num: 0,
isPassLoginPassword: false
};
}
componentDidMount() {
this.props.form.initFormFields(loginCondition);
this.props.form.initFormFields(condition);
}
@ -71,40 +73,66 @@ class PassSetDialog extends Component {
return group;
};
saveSecondaryPassword = () => {
const { isPassLoginPassword } = this.state;
const { form } = this.props;
const { secondaryPwd1, secondaryPwd2, validatecode } = form.getFormParams();
if (!validatecode || !secondaryPwd1 || !secondaryPwd2) {
message.error(getLabel(518702, "必要信息不完整,红色*为必填项!"));
return;
const { secondaryPwd1, secondaryPwd2, validatecode, password } = form.getFormParams();
if (isPassLoginPassword) {
if (!validatecode || !secondaryPwd1 || !secondaryPwd2) {
message.error(getLabel(518702, "必要信息不完整,红色*为必填项!"));
return;
}
if (secondaryPwd1 !== secondaryPwd2) {
message.error(getLabel("504376", "密码确认不正确!"));
return;
}
} else {
if (!password) {
message.error(getLabel(518702, "必要信息不完整,红色*为必填项!"));
return;
}
}
if (secondaryPwd1 !== secondaryPwd2) {
message.error(getLabel("504376", "密码确认不正确!"));
return;
}
const params = { secondaryPwd1, secondaryPwd2 };
const params = isPassLoginPassword ? { secondaryPwd1, secondaryPwd2 } : { password };
RSAEcrypt("1", params).then(RSAParam => {
saveSecondaryPwd({ ...RSAParam, validatecode }).then(({ sign, message: msg }) => {
if (sign === "1") {
message.success(msg);
this.props.onCancel();
form.resetForm();
} else {
message.warning(msg);
}
});
isPassLoginPassword ?
saveSecondaryPwd({ ...RSAParam, validatecode }).then(({ sign, message: msg }) => {
if (sign === "1") {
message.success(msg);
this.props.onCancel();
form.resetForm();
} else {
message.warning(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}` });
});
}
}) :
checkPassword({ ...RSAParam }).then(({ result }) => {
if (result) {
this.setState({ isPassLoginPassword: true });
form.resetForm();
} else {
message.error(getLabel(504343, "登录密码错误"));
}
});
});
};
render() {
const { isPassLoginPassword } = this.state;
return (
<WeaDialog
onCancel={this.props.onCancel}
title={getLabel(504332, "二次验证密码设置")} visible={this.props.visible}
title={isPassLoginPassword ? getLabel(504332, "二次验证密码设置") : getLabel(504331, "请先输入登录密码")}
visible={this.props.visible}
initLoadCss className="pwdSetWrapper" hasScroll buttons={[
<Button type="primary" size="small" onClick={this.saveSecondaryPassword}>{getLabel(537558, "保存")}</Button>
]}
>
{this.getSearchs(this.props.form, condition)}
{
isPassLoginPassword ?
this.getSearchs(this.props.form, condition) :
this.getSearchs(this.props.form, loginCondition)
}
</WeaDialog>
);
}

View File

@ -1,6 +1,28 @@
import { WeaLocaleProvider } from "ecCom";
const { getLabel } = WeaLocaleProvider;
export const loginCondition = [
{
items: [
{
colSpan: 1,
checkbox: false,
checkboxValue: false,
conditionType: "INPUT",
domkey: ["password"],
fieldcol: 18,
label: getLabel(388431, "登录密码"),
labelcol: 6,
detailtype: 3,
rules: "required|string",
type: "password",
viewAttr: 3
}
],
title: "",
defaultshow: true
}
];
export const condition = [
{
items: [