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

This commit is contained in:
lys 2025-04-17 17:12:53 +08:00
parent 5ab71a3492
commit b01d280644
4 changed files with 51 additions and 123 deletions

View File

@ -1,17 +1,15 @@
import React from "react";
import ReactDom from "react-dom";
import { inject, observer } from "mobx-react";
import { toJS } from "mobx";
import { getQueryString } from "../../util/url";
import { WeaDialog, WeaError, WeaInput, WeaLocaleProvider } from "ecCom";
import { Button, message, Modal } from "antd";
import { WeaLocaleProvider } from "ecCom";
import { message, Modal } from "antd";
import Authority from "../mySalary/authority";
import "../payroll/templatePreview/index.less";
import * as API from "../../apis/mySalaryBenefits";
import { salaryBillGetToken } from "../../apis/mySalaryBenefits";
import { confirmSalaryBill, feedBackSalaryBill, payrollCheckType } from "../../apis/payroll";
import CaptchaModal from "../../components/captchaModal";
import PassSetDialog from "./passSetDialog";
import { ConfirmBtns } from "../mySalary/mySalaryView";
import Content from "../../components/pcTemplate/content";
import MobileTemplate from "../../components/mobileTemplate";
@ -21,21 +19,14 @@ import "../mySalary/index.less";
const getLabel = WeaLocaleProvider.getLabel;
@inject("mySalaryStore")
@observer
@inject("mySalaryStore") @observer
export default class MobilePayroll extends React.Component {
constructor(props) {
super(props);
this.state = {
pwdSetVisible: false,
visible: false,
captchaVisible: false,
authCode: "",
notSetting: false,
mySalaryBillData: {
employeeInformation: {},
salaryTemplate: []
},
mySalaryBillData: { employeeInformation: {}, salaryTemplate: [] },
salaryBillToken: {}
};
this.id = "";
@ -63,12 +54,7 @@ export default class MobilePayroll extends React.Component {
API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
.then(({ status, isNeedSecondAuth }) => {
if (status && isNeedSecondAuth) {
this.setState({ visible: true }, () => {
API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
.then(({ status, notSetting }) => {
this.setState({ notSetting });
});
});
this.setState({ visible: true });
} else {
this.getMySalaryBill(getQueryString("id"));
setInitEmVerify();
@ -85,19 +71,7 @@ export default class MobilePayroll extends React.Component {
API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
.then(({ status, isNeedSecondAuth }) => {
if (status && isNeedSecondAuth) {
ReactDom.render(<SecondaryVerify {...this.props} salaryBillToken={this.state.salaryBillToken}
onSuccess={() => {
setInitEmVerify();
removeElementById("am-modal-container");
this.getMySalaryBill(getQueryString("id"));
}}/>, document.getElementById("container"));
// return;
// this.setState({ visible: true }, () => {
// API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
// .then(({ status, notSetting }) => {
// this.setState({ notSetting });
// });
// });
this.setState({ visible: true });
} else {
this.getMySalaryBill(getQueryString("id"));
setInitEmVerify();
@ -106,33 +80,12 @@ export default class MobilePayroll extends React.Component {
});
}
};
doSecondAuth = () => {
const { salaryBillToken } = this.state;
const { mySalaryStore: { setInitEmVerify } } = this.props;
if (!this.state.authCode) {
this.refs.weaError.showError();
return;
}
API.doSecondAuth({
authCode: this.state.authCode, mouldCode: "HRM", itemCode: "SALARY"
}, salaryBillToken).then(({ status, checkStatus, checkMsg }) => {
if (status && checkStatus === "1") {
message.success(checkMsg);
setInitEmVerify();
this.setState({ visible: false });
this.getMySalaryBill(getQueryString("id"));
} else {
message.error(checkMsg);
}
});
};
getMySalaryBill = (salaryInfoId) => {
const { salaryBillToken } = this.state;
const { mySalaryStore: { getMySalaryBill } } = this.props;
const params = this.getUrlkey();
const payload = {
salaryInfoId, header: salaryBillToken,
..._.pick(params, ["recipient"])
salaryInfoId, header: salaryBillToken, ..._.pick(params, ["recipient"])
};
getMySalaryBill(payload).then(result => {
this.setState({
@ -142,10 +95,8 @@ export default class MobilePayroll extends React.Component {
};
getUrlkey = () => {
let url = window.location.href;
let params = {},
arr = url.split("?");
if (arr.length <= 1)
return params;
let params = {}, arr = url.split("?");
if (arr.length <= 1) return params;
arr = arr[1].split("&");
for (var i = 0, l = arr.length; i < l; i++) {
var a = arr[i].split("=");
@ -189,77 +140,55 @@ export default class MobilePayroll extends React.Component {
};
render() {
const { mySalaryStore: { clearLoading, pwdForm } } = this.props;
const { mySalaryBillData, visible, captchaVisible, notSetting, pwdSetVisible } = this.state;
const { mySalaryStore: { setInitEmVerify } } = this.props, { captchaVisible, visible } = this.state;
const type = getQueryString("type");
if (_.isEmpty(toJS(this.props.mySalaryStore.mySalaryBill))) return <div>
<WeaDialog
onCancel={() => this.setState({ visible: false }, () => clearLoading())}
title="请输入二次验证密码" visible={visible} initLoadCss
className="verifyWrapper"
hasScroll buttons={[
<Button type="primary" size="small" onClick={this.doSecondAuth}>确定</Button>
]}
>
<WeaError tipPosition="bottom" ref="weaError" error="此项必填">
<WeaInput value={this.state.authCode} type="password" viewAttr={3}
onChange={authCode => this.setState({ authCode })}/>
</WeaError>
{
notSetting &&
<div style={{ clear: "both", paddingTop: 10 }}>
{getLabel("514970", "您还未设置二次验证密码,点击")}
<a href="javascript:void(0);"
onClick={() => this.setState({ pwdSetVisible: true })}>{getLabel("30747", "设置")}</a>
</div>
}
</WeaDialog>
<PassSetDialog form={pwdForm} visible={pwdSetVisible} onCancel={() => this.setState({ pwdSetVisible: false })}/>
if (_.isEmpty(toJS(this.props.mySalaryStore.mySalaryBill))) return <React.Fragment>
{visible && <SecondaryVerify {...this.props} salaryBillToken={this.state.salaryBillToken}
onSuccess={() => {
setInitEmVerify();
// removeElementById("am-modal-container");
this.getMySalaryBill(getQueryString("id"));
}}/>}
{/*发送验证码*/}
<CaptchaModal
visible={captchaVisible} id={getQueryString("id")}
onCancel={() => this.setState({ captchaVisible: false })}
onConfirm={() => this.props.mySalaryStore.setInitEmVerify()}
/>
</div>;
</React.Fragment>;
const {
salaryTemplate, salaryGroups, employeeInformation,
sendTime, confirmStatus, showAck, showFeedback
salaryTemplate, salaryGroups, employeeInformation, sendTime, confirmStatus, showAck, showFeedback
} = toJS(this.props.mySalaryStore.mySalaryBill);
const salaryProps = {
theme: salaryTemplate.theme, tip: salaryTemplate.textContent, sendTime,
background: salaryTemplate.background, tipPosi: salaryTemplate.textContentPosition || "",
theme: salaryTemplate.theme,
tip: salaryTemplate.textContent,
sendTime,
background: salaryTemplate.background,
tipPosi: salaryTemplate.textContentPosition || "",
itemTypeList: [employeeInformation, ...salaryGroups]
};
return (
<React.Fragment>
{
type === "phone" ?
<Authority ecId={`${this && this.props && this.props.ecId || ""}_Authority@lulowc`}
store={this.props.mySalaryStore}>
<MobileTemplate {...salaryProps} title={getLabel(111, "工资单查看")}>
<ConfirmBtns
showAck={showAck} showFeedback={showFeedback}
confirmSalaryBill={this.confirmSalaryBill}
goFeedback={this.handleGoFeedback}
/>
</MobileTemplate>
</Authority>
:
<Authority ecId={`${this && this.props && this.props.ecId || ""}_Authority@lulowc`}
store={this.props.mySalaryStore}>
<div className="weapp-salary-my-salary-view-payroll">
<Content {...salaryProps}>
<ConfirmBtns
showAck={showAck} showFeedback={showFeedback}
confirmSalaryBill={this.confirmSalaryBill}
goFeedback={this.handleGoFeedback}
/>
</Content>
</div>
</Authority>
}
</React.Fragment>
);
return (<React.Fragment>
{type === "phone" ? <Authority ecId={`${this && this.props && this.props.ecId || ""}_Authority@lulowc`}
store={this.props.mySalaryStore}>
<MobileTemplate {...salaryProps} title={getLabel(111, "工资单查看")}>
<ConfirmBtns
showAck={showAck} showFeedback={showFeedback}
confirmSalaryBill={this.confirmSalaryBill}
goFeedback={this.handleGoFeedback}
/>
</MobileTemplate>
</Authority> : <Authority ecId={`${this && this.props && this.props.ecId || ""}_Authority@lulowc`}
store={this.props.mySalaryStore}>
<div className="weapp-salary-my-salary-view-payroll">
<Content {...salaryProps}>
<ConfirmBtns
showAck={showAck} showFeedback={showFeedback}
confirmSalaryBill={this.confirmSalaryBill}
goFeedback={this.handleGoFeedback}
/>
</Content>
</div>
</Authority>}
</React.Fragment>);
}
}

View File

@ -37,7 +37,7 @@ class LoginVerify extends Component {
RSAEcrypt("1", { ...form.getFormParams() }).then(RSAParam => {
API.checkPassword({ ...RSAParam }).then(({ result }) => {
if (result) {
ReactDom.render(<SecondarypwdVerify {...this.props} />, document.body);
ReactDom.render(<SecondarypwdVerify {...this.props} />, document.getElementById("container"));
} else {
form.showError("password", getLabel(504343, "登录密码错误"));
}

View File

@ -42,12 +42,11 @@ class SecondaryVerify extends Component {
doSecondAuth = () => {
form.validateForm().then(f => {
if (f.isValid) {
const { mySalaryStore: { setInitEmVerify }, salaryBillToken } = this.props;
const { salaryBillToken } = this.props;
API.doSecondAuth({ mouldCode: "HRM", itemCode: "SALARY", ...form.getFormParams() }, salaryBillToken)
.then(({ status, checkStatus, checkMsg }) => {
if (status && checkStatus === "1") {
message.success(checkMsg);
setInitEmVerify();
this.props.onSuccess();
} else {
form.showError("authCode", checkMsg);
@ -59,7 +58,7 @@ class SecondaryVerify extends Component {
});
};
handleSetSecondaryPassword = () => {
ReactDom.render(<LoginVerify {...this.props} />, document.body);
ReactDom.render(<LoginVerify {...this.props} />, document.getElementById("container"));
};
render() {

View File

@ -51,7 +51,7 @@ class SecondarypwdVerify extends Component {
API.saveSecondaryPwd({ ...RSAParam, validatecode }).then(({ sign, message: msg }) => {
if (sign === "1") {
message.success(msg);
ReactDom.render(<SecondaryVerify {...this.props}/>, document.body);
ReactDom.render(<SecondaryVerify {...this.props}/>, document.getElementById("container"));
} else {
form.showError("validatecode", msg);
this.setState({ num: this.state.num + 1 }, () => {