feature/2.19.1.2501.01-移动端查看工资单密码设置

This commit is contained in:
lys 2025-04-17 17:44:30 +08:00
parent 6b3e321846
commit 554cf4b6b3
5 changed files with 42 additions and 41 deletions

View File

@ -45,11 +45,13 @@ export const doSecondAuth = (params, headers) => {
export const getPasswordForm = params => {
return WeaTools.callApi("/api/hrm/secondarypwd/getPasswordForm", "GET", params);
};
export const checkPassword = params => {
return WeaTools.callApi("/api/hrm/secondarypwd/checkPassword", "POST", params);
export const checkPassword = (params, headers) => {
return formHeaderPost("/api/hrm/secondarypwd/checkPassword", "POST", params, headers);
// return WeaTools.callApi("/api/hrm/secondarypwd/checkPassword", "POST", params);
};
export const saveSecondaryPwd = params => {
return WeaTools.callApi("/api/hrm/secondarypwd/saveSecondaryPwd", "POST", params);
export const saveSecondaryPwd = (params, headers) => {
return formHeaderPost("/api/hrm/secondarypwd/saveSecondaryPwd", "POST", params, headers);
// return WeaTools.callApi("/api/hrm/secondarypwd/saveSecondaryPwd", "POST", params);
};
export const salaryBillGetToken = params => {
return postFetch("/api/bs/hrmsalary/salaryBill/getToken", params);

View File

@ -14,7 +14,8 @@ import { ConfirmBtns } from "../mySalary/mySalaryView";
import Content from "../../components/pcTemplate/content";
import MobileTemplate from "../../components/mobileTemplate";
import SecondaryVerify from "./secondaryVerify";
import { removeElementById } from "../../util";
import LoginVerify from "./loginVerify";
import SecondarypwdVerify from "./secondarypwdVerify";
import "../mySalary/index.less";
const getLabel = WeaLocaleProvider.getLabel;
@ -24,8 +25,7 @@ export default class MobilePayroll extends React.Component {
constructor(props) {
super(props);
this.state = {
visible: false,
captchaVisible: false,
visible: false, captchaVisible: false, loginVisible: false, pwdSetVisible: false,
mySalaryBillData: { employeeInformation: {}, salaryTemplate: [] },
salaryBillToken: {}
};
@ -140,15 +140,21 @@ export default class MobilePayroll extends React.Component {
};
render() {
const { mySalaryStore: { setInitEmVerify } } = this.props, { captchaVisible, visible } = this.state;
const { mySalaryStore: { setInitEmVerify } } = this.props, {
captchaVisible, visible, loginVisible, pwdSetVisible
} = this.state;
const type = getQueryString("type");
if (_.isEmpty(toJS(this.props.mySalaryStore.mySalaryBill))) return <React.Fragment>
{visible && <SecondaryVerify {...this.props} salaryBillToken={this.state.salaryBillToken}
onSetLogin={() => this.setState({ visible: false, loginVisible: true })}
onSuccess={() => {
setInitEmVerify();
// removeElementById("am-modal-container");
this.getMySalaryBill(getQueryString("id"));
}}/>}
{loginVisible && <LoginVerify {...this.props} salaryBillToken={this.state.salaryBillToken}
onSetPwdSet={() => this.setState({ loginVisible: false, pwdSetVisible: true })}/>}
{pwdSetVisible && <SecondarypwdVerify {...this.props} salaryBillToken={this.state.salaryBillToken}
onSuccess={() => this.setState({ pwdSetVisible: false }, () => this.initMobile())}/>}
{/*发送验证码*/}
<CaptchaModal
visible={captchaVisible} id={getQueryString("id")}

View File

@ -8,13 +8,11 @@
* @description:
*/
import React, { Component } from "react";
import ReactDom from "react-dom";
import { WeaLocaleProvider } from "ecCom";
import { WeaForm } from "comsMobx";
import FormInfo from "../../components/FormInfo";
import { loginCondition } from "./conditions";
import MobileModal from "./mobileModal";
import SecondarypwdVerify from "./secondarypwdVerify";
import * as API from "../../apis/mySalaryBenefits";
import { RSAEcrypt } from "../../util/RSAUtil";
@ -34,15 +32,16 @@ class LoginVerify extends Component {
save = async () => {
form.validateForm().then(f => {
if (f.isValid) {
RSAEcrypt("1", { ...form.getFormParams() }).then(RSAParam => {
API.checkPassword({ ...RSAParam }).then(({ result }) => {
if (result) {
ReactDom.render(<SecondarypwdVerify {...this.props} />, document.getElementById("container"));
} else {
form.showError("password", getLabel(504343, "登录密码错误"));
}
RSAEcrypt("1", { ...form.getFormParams() }, this.props.salaryBillToken)
.then(RSAParam => {
API.checkPassword({ ...RSAParam }).then(({ result }) => {
if (result) {
this.props.onSetPwdSet();
} else {
form.showError("password", getLabel(504343, "登录密码错误"));
}
});
});
});
} else {
f.showErrors();
}

View File

@ -15,7 +15,6 @@ import FormInfo from "../../components/FormInfo";
import { secondaryVerifyConditions } from "./conditions";
import * as API from "../../apis/mySalaryBenefits";
import MobileModal from "./mobileModal";
import LoginVerify from "./loginVerify";
const form = new WeaForm();
const getLabel = WeaLocaleProvider.getLabel;
@ -23,7 +22,7 @@ const getLabel = WeaLocaleProvider.getLabel;
class SecondaryVerify extends Component {
constructor(props) {
super(props);
this.state = { notSetting: false, visible: false };
this.state = { notSetting: false };
}
componentDidMount() {
@ -35,7 +34,7 @@ class SecondaryVerify extends Component {
}
componentWillUnmount() {
this.setState({ notSetting: false, visible: false }, () => form.resetForm());
this.setState({ notSetting: false }, () => form.resetForm());
}
doSecondAuth = () => {
@ -56,10 +55,9 @@ class SecondaryVerify extends Component {
}
});
};
handleSetSecondaryPassword = () => this.setState({ visible: false });
render() {
const { notSetting, visible } = this.state;
const { notSetting } = this.state;
const itemRender = {
authCode: (field, textAreaProps, form, formParams) => {
return (<React.Fragment>
@ -68,7 +66,7 @@ class SecondaryVerify extends Component {
notSetting &&
<div style={{ clear: "both", paddingTop: 10 }}>
{getLabel(111, "您还未设置二次验证密码,点击")}
<a href="javascript:void(0);" onClick={this.handleSetSecondaryPassword}>{getLabel(111, "设置")}</a>
<a href="javascript:void(0);" onClick={this.props.onSetLogin}>{getLabel(111, "设置")}</a>
</div>
}
</React.Fragment>);
@ -77,9 +75,6 @@ class SecondaryVerify extends Component {
return (<MobileModal title={getLabel(111, "身份验证")} onConfirm={this.doSecondAuth}>
<FormInfo center={false} custLabelCol={9} itemRender={itemRender} form={form}
formFields={secondaryVerifyConditions}/>
{
visible && <LoginVerify {...this.props} />
}
</MobileModal>);
}
}

View File

@ -8,7 +8,6 @@
* @description:
*/
import React, { Component } from "react";
import ReactDom from "react-dom";
import { WeaLocaleProvider } from "ecCom";
import { message } from "antd";
import { WeaForm, WeaSwitch } from "comsMobx";
@ -17,7 +16,6 @@ import { secondarypwdCondition } from "./conditions";
import * as API from "../../apis/mySalaryBenefits";
import MobileModal from "./mobileModal";
import { RSAEcrypt } from "../../util/RSAUtil";
import SecondaryVerify from "./secondaryVerify";
const form = new WeaForm();
const getLabel = WeaLocaleProvider.getLabel;
@ -48,17 +46,18 @@ class SecondarypwdVerify extends Component {
return;
}
RSAEcrypt("1", { secondaryPwd1, secondaryPwd2 }).then(RSAParam => {
API.saveSecondaryPwd({ ...RSAParam, validatecode }).then(({ sign, message: msg }) => {
if (sign === "1") {
message.success(msg);
ReactDom.render(<SecondaryVerify {...this.props}/>, document.getElementById("container"));
} 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}` });
});
}
});
API.saveSecondaryPwd({ ...RSAParam, validatecode }, 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}` });
});
}
});
});
} else {
f.showErrors();