Merge branch 'feature/2.19.1.2501.01-移动端查看工资单密码设置' into feature/2.19.1.2501.01-PC端Token验证

# Conflicts:
#	pc4mobx/hrmSalary/pages/mobilePayroll/index.js
This commit is contained in:
lys 2025-04-18 11:30:56 +08:00
commit cd0706fe23
11 changed files with 591 additions and 128 deletions

View File

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

View File

@ -0,0 +1,87 @@
export const secondaryVerifyConditions = [
{
items: [
{
conditionType: "INPUT",
domkey: ["authCode"],
fieldcol: 14,
label: "二次验证密码",
labelcol: 10,
value: "",
otherParams: {
type: "password"
},
rules: "required|string",
viewAttr: 3
}
],
title: "",
defaultshow: true
}
];
export const loginCondition = [
{
items: [
{
conditionType: "INPUT",
domkey: ["password"],
fieldcol: 14,
label: "登录密码",
labelcol: 10,
value: "",
otherParams: {
type: "password"
},
rules: "required|string",
viewAttr: 3
}
],
title: "",
defaultshow: true
}
];
export const secondarypwdCondition = [
{
items: [
{
conditionType: "INPUT",
domkey: ["secondaryPwd1"],
fieldcol: 14,
label: "密码",
labelcol: 10,
value: "",
otherParams: {
type: "password",
passwordStrength: true
},
rules: "required|string",
viewAttr: 3
},
{
conditionType: "INPUT",
domkey: ["secondaryPwd2"],
fieldcol: 14,
label: "确认密码",
labelcol: 10,
value: "",
otherParams: {
type: "password"
},
rules: "required|string",
viewAttr: 3
},
{
conditionType: "INPUT",
domkey: ["validatecode"],
fieldcol: 14,
label: "验证码",
labelcol: 10,
value: "",
rules: "required|string",
viewAttr: 3
}
],
title: "",
defaultshow: true
}
];

View File

@ -2,18 +2,20 @@ import React from "react";
import { inject, observer } from "mobx-react"; import { inject, observer } from "mobx-react";
import { toJS } from "mobx"; import { toJS } from "mobx";
import { getQueryString } from "../../util/url"; import { getQueryString } from "../../util/url";
import { WeaDialog, WeaError, WeaInput, WeaLocaleProvider } from "ecCom"; import { WeaLocaleProvider } from "ecCom";
import { Button, message, Modal } from "antd"; import { message, Modal } from "antd";
import Authority from "../mySalary/authority"; import Authority from "../mySalary/authority";
import "../payroll/templatePreview/index.less"; import "../payroll/templatePreview/index.less";
import * as API from "../../apis/mySalaryBenefits"; import * as API from "../../apis/mySalaryBenefits";
import { salaryBillGetToken } from "../../apis/mySalaryBenefits"; import { salaryBillGetToken } from "../../apis/mySalaryBenefits";
import { confirmSalaryBill, feedBackSalaryBill, payrollCheckType } from "../../apis/payroll"; import { confirmSalaryBill, feedBackSalaryBill, payrollCheckType } from "../../apis/payroll";
import CaptchaModal from "../../components/captchaModal"; import CaptchaModal from "../../components/captchaModal";
import PassSetDialog from "./passSetDialog";
import { ConfirmBtns } from "../mySalary/mySalaryView"; import { ConfirmBtns } from "../mySalary/mySalaryView";
import Content from "../../components/pcTemplate/content"; import Content from "../../components/pcTemplate/content";
import MobileTemplate from "../../components/mobileTemplate"; import MobileTemplate from "../../components/mobileTemplate";
import SecondaryVerify from "./secondaryVerify";
import LoginVerify from "./loginVerify";
import SecondarypwdVerify from "./secondarypwdVerify";
import CheckSecondaryVerifyDialog from "./checkSecondaryVerifyDialog"; import CheckSecondaryVerifyDialog from "./checkSecondaryVerifyDialog";
import "../mySalary/index.less"; import "../mySalary/index.less";
@ -25,15 +27,8 @@ export default class MobilePayroll extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
pwdSetVisible: false, visible: false, captchaVisible: false, loginVisible: false, pwdSetVisible: false,
visible: false, mySalaryBillData: { employeeInformation: {}, salaryTemplate: [] },
captchaVisible: false,
authCode: "",
notSetting: false,
mySalaryBillData: {
employeeInformation: {},
salaryTemplate: []
},
salaryBillToken: {}, salaryBillToken: {},
// 统一二次验证 // 统一二次验证
checkSecVerify: false checkSecVerify: false
@ -83,12 +78,7 @@ export default class MobilePayroll extends React.Component {
API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken) API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
.then(({ status, isNeedSecondAuth }) => { .then(({ status, isNeedSecondAuth }) => {
if (status && isNeedSecondAuth) { if (status && isNeedSecondAuth) {
this.setState({ visible: true }, () => { this.setState({ visible: true });
API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
.then(({ status, notSetting }) => {
this.setState({ notSetting });
});
});
} else { } else {
this.getMySalaryBill(getQueryString("id")); this.getMySalaryBill(getQueryString("id"));
setInitEmVerify(); setInitEmVerify();
@ -105,12 +95,7 @@ export default class MobilePayroll extends React.Component {
API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken) API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
.then(({ status, isNeedSecondAuth }) => { .then(({ status, isNeedSecondAuth }) => {
if (status && isNeedSecondAuth) { if (status && isNeedSecondAuth) {
this.setState({ visible: true }, () => { this.setState({ visible: true });
API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken)
.then(({ status, notSetting }) => {
this.setState({ notSetting });
});
});
} else { } else {
this.getMySalaryBill(getQueryString("id")); this.getMySalaryBill(getQueryString("id"));
setInitEmVerify(); setInitEmVerify();
@ -119,33 +104,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) => { getMySalaryBill = (salaryInfoId) => {
const { salaryBillToken } = this.state; const { salaryBillToken } = this.state;
const { mySalaryStore: { getMySalaryBill } } = this.props; const { mySalaryStore: { getMySalaryBill } } = this.props;
const params = this.getUrlkey(); const params = this.getUrlkey();
const payload = { const payload = {
salaryInfoId, header: salaryBillToken, salaryInfoId, header: salaryBillToken, ..._.pick(params, ["recipient"])
..._.pick(params, ["recipient"])
}; };
getMySalaryBill(payload).then(result => { getMySalaryBill(payload).then(result => {
this.setState({ this.setState({
@ -155,10 +119,8 @@ export default class MobilePayroll extends React.Component {
}; };
getUrlkey = () => { getUrlkey = () => {
let url = window.location.href; let url = window.location.href;
let params = {}, let params = {}, arr = url.split("?");
arr = url.split("?"); if (arr.length <= 1) return params;
if (arr.length <= 1)
return params;
arr = arr[1].split("&"); arr = arr[1].split("&");
for (var i = 0, l = arr.length; i < l; i++) { for (var i = 0, l = arr.length; i < l; i++) {
var a = arr[i].split("="); var a = arr[i].split("=");
@ -202,84 +164,68 @@ export default class MobilePayroll extends React.Component {
}; };
render() { render() {
const { mySalaryStore: { clearLoading, pwdForm, setInitEmVerify } } = this.props; const { mySalaryStore: { setInitEmVerify } } = this.props, {
const { salaryBillToken, visible, captchaVisible, notSetting, pwdSetVisible, checkSecVerify } = this.state; captchaVisible, visible, loginVisible, pwdSetVisible, checkSecVerify
} = this.state;
const type = getQueryString("type"); const type = getQueryString("type");
if (_.isEmpty(toJS(this.props.mySalaryStore.mySalaryBill))) return <div> if (_.isEmpty(toJS(this.props.mySalaryStore.mySalaryBill))) return <React.Fragment>
<WeaDialog {visible && <SecondaryVerify {...this.props} salaryBillToken={this.state.salaryBillToken}
onCancel={() => this.setState({ visible: false }, () => clearLoading())} onSetLogin={() => this.setState({ visible: false, loginVisible: true })}
title="请输入二次验证密码" visible={visible} initLoadCss onSuccess={() => {
className="verifyWrapper" setInitEmVerify();
hasScroll buttons={[ this.getMySalaryBill(getQueryString("id"));
<Button type="primary" size="small" onClick={this.doSecondAuth}>确定</Button> }}/>}
]} {loginVisible && <LoginVerify {...this.props} salaryBillToken={this.state.salaryBillToken}
> onSetPwdSet={() => this.setState({ loginVisible: false, pwdSetVisible: true })}/>}
<WeaError tipPosition="bottom" ref="weaError" error="此项必填"> {pwdSetVisible && <SecondarypwdVerify {...this.props} salaryBillToken={this.state.salaryBillToken}
<WeaInput value={this.state.authCode} type="password" viewAttr={3} onSuccess={() => this.setState({ pwdSetVisible: false }, () => this.initMobile())}/>}
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 })}/>
{/*统一外部调用token*/} {/*统一外部调用token*/}
<CheckSecondaryVerifyDialog visible={checkSecVerify} salaryBillToken={salaryBillToken} <CheckSecondaryVerifyDialog visible={checkSecVerify} salaryBillToken={salaryBillToken}
onCancel={(callback) => this.setState({ checkSecVerify: false }, () => callback && callback())} onCancel={(callback) => this.setState({ checkSecVerify: false }, () => callback && callback())}
onSuccess={() => { onSuccess={() => {
this.getMySalaryBill(getQueryString("id")); this.getMySalaryBill(getQueryString("id"));
setInitEmVerify(); setInitEmVerify();
}}/> }}/>
{/*发送验证码*/} {/*发送验证码*/}
<CaptchaModal <CaptchaModal
visible={captchaVisible} id={getQueryString("id")} visible={captchaVisible} id={getQueryString("id")}
onCancel={() => this.setState({ captchaVisible: false })} onCancel={() => this.setState({ captchaVisible: false })}
onConfirm={() => this.props.mySalaryStore.setInitEmVerify()} onConfirm={() => this.props.mySalaryStore.setInitEmVerify()}
/> />
</div>; </React.Fragment>;
const { const {
salaryTemplate, salaryGroups, employeeInformation, salaryTemplate, salaryGroups, employeeInformation, sendTime, confirmStatus, showAck, showFeedback
sendTime, confirmStatus, showAck, showFeedback
} = toJS(this.props.mySalaryStore.mySalaryBill); } = toJS(this.props.mySalaryStore.mySalaryBill);
const salaryProps = { const salaryProps = {
theme: salaryTemplate.theme, tip: salaryTemplate.textContent, sendTime, theme: salaryTemplate.theme,
background: salaryTemplate.background, tipPosi: salaryTemplate.textContentPosition || "", tip: salaryTemplate.textContent,
sendTime,
background: salaryTemplate.background,
tipPosi: salaryTemplate.textContentPosition || "",
itemTypeList: [employeeInformation, ...salaryGroups] itemTypeList: [employeeInformation, ...salaryGroups]
}; };
return ( return (<React.Fragment>
<React.Fragment> {type === "phone" ? <Authority ecId={`${this && this.props && this.props.ecId || ""}_Authority@lulowc`}
{ store={this.props.mySalaryStore}>
type === "phone" ? <MobileTemplate {...salaryProps} title={getLabel(111, "工资单查看")}>
<Authority ecId={`${this && this.props && this.props.ecId || ""}_Authority@lulowc`} <ConfirmBtns
store={this.props.mySalaryStore}> showAck={showAck} showFeedback={showFeedback}
<MobileTemplate {...salaryProps} title={getLabel(111, "工资单查看")}> confirmSalaryBill={this.confirmSalaryBill}
<ConfirmBtns goFeedback={this.handleGoFeedback}
showAck={showAck} showFeedback={showFeedback} />
confirmSalaryBill={this.confirmSalaryBill} </MobileTemplate>
goFeedback={this.handleGoFeedback} </Authority> : <Authority ecId={`${this && this.props && this.props.ecId || ""}_Authority@lulowc`}
/> store={this.props.mySalaryStore}>
</MobileTemplate> <div className="weapp-salary-my-salary-view-payroll">
</Authority> <Content {...salaryProps}>
: <ConfirmBtns
<Authority ecId={`${this && this.props && this.props.ecId || ""}_Authority@lulowc`} showAck={showAck} showFeedback={showFeedback}
store={this.props.mySalaryStore}> confirmSalaryBill={this.confirmSalaryBill}
<div className="weapp-salary-my-salary-view-payroll"> goFeedback={this.handleGoFeedback}
<Content {...salaryProps}> />
<ConfirmBtns </Content>
showAck={showAck} showFeedback={showFeedback} </div>
confirmSalaryBill={this.confirmSalaryBill} </Authority>}
goFeedback={this.handleGoFeedback} </React.Fragment>);
/>
</Content>
</div>
</Authority>
}
</React.Fragment>
);
} }
} }

View File

@ -39,3 +39,132 @@
} }
} }
} }
.am-modal-mask {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
height: 100%;
z-index: 999;
background-color: rgba(0, 0, 0, .4);
}
.am-modal-transparent {
width: 80%;
}
.am-modal-transparent .am-modal-content {
border-radius: 7px;
padding-top: 15px;
}
.am-modal-content {
position: relative;
background-color: #fff;
border: 0;
background-clip: padding-box;
text-align: center;
height: 100%;
overflow: hidden;
}
.am-modal-header {
padding: 15px;
}
.am-modal-title {
margin: 0;
letter-spacing: -.1px;
color: #333;
font-size: 14px;
line-height: 20px;
text-align: center;
height: auto;
max-height: 150px;
overflow-y: auto;
}
.am-modal-body {
font-size: 14px;
color: #868686;
height: 100%;
line-height: 1.5;
overflow: auto;
padding: 0 15px 30px;
.wea-search-group, .wea-content, .wea-form-cell {
padding: 0;
}
.secondarypwd-form {
.wea-form-cell-wrapper {
& > div:last-child {
.ant-col-16 {
width: 37.5% !important;
}
}
}
}
}
.am-modal-wrap {
position: fixed;
overflow: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
height: 100%;
z-index: 999;
-webkit-overflow-scrolling: touch;
outline: 0;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-transform: translateZ(1px);
transform: translateZ(1px);
}
.am-modal-button-group-h {
position: relative;
border-top: 1px solid #ddd;
display: flex;
}
.am-modal-button-group-h .am-modal-button {
-webkit-touch-callout: none;
flex: 1 1;
box-sizing: border-box;
text-align: center;
text-decoration: none;
outline: none;
color: #55b1f9;
height: 50px;
line-height: 50px;
display: block;
width: auto;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 14px;
}
.am-modal-button-group-h .am-modal-button:first-child {
color: #333;
}
.am-modal-button-group-h .am-modal-button:last-child {
position: relative;
border-left: 1px solid #ddd;
}

View File

@ -0,0 +1,59 @@
/*
* 登录密码验证
*
* @Author: 黎永顺
* @Date: 2025/4/17
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { WeaForm } from "comsMobx";
import FormInfo from "../../components/FormInfo";
import { loginCondition } from "./conditions";
import MobileModal from "./mobileModal";
import * as API from "../../apis/mySalaryBenefits";
import { RSAEcrypt } from "../../util/RSAUtil";
const form = new WeaForm();
const getLabel = WeaLocaleProvider.getLabel;
class LoginVerify extends Component {
componentDidMount() {
form.initFormFields(loginCondition);
}
componentWillUnmount() {
form.resetForm();
}
save = async () => {
form.validateForm().then(f => {
if (f.isValid) {
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();
}
});
};
render() {
const itemRender = {};
return (<MobileModal title={getLabel(111, "请先输入登录密码")} onConfirm={this.save}>
<FormInfo center={false} itemRender={itemRender} form={form} formFields={loginCondition}/>
</MobileModal>);
}
}
export default LoginVerify;

View File

@ -0,0 +1,65 @@
/*
* 自定义移动端弹框组件
*
* @Author: 黎永顺
* @Date: 2025/4/16
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { removeElementById } from "../../util";
import "./index.less";
const getLabel = WeaLocaleProvider.getLabel;
class MobileModal extends Component {
componentDidMount() {
this.setMetaViewport();
}
setMetaViewport = () => {
// 检查是否已存在 viewport meta 标签
let viewportMeta = document.querySelector("meta[name=\"viewport\"]");
if (!viewportMeta) {
// 如果不存在,创建一个新的 meta 标签
viewportMeta = document.createElement("meta");
viewportMeta.setAttribute("name", "viewport");
document.head.appendChild(viewportMeta);
}
// 设置或更新 viewport 的 content 属性
const content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover";
viewportMeta.setAttribute("content", content);
};
render() {
return (
<div id="am-modal-container">
<div>
<div className="am-modal-mask"></div>
<div className="am-modal-wrap">
<div className="am-modal am-modal-transparent">
<div className="am-modal-content">
<div className="am-modal-header">
<div className="am-modal-title">{this.props.title}</div>
</div>
<div className="am-modal-body">{this.props.children}</div>
<div className="am-modal-footer">
<div className="am-modal-button-group-h">
<a href="javascript:void(0);" className="am-modal-button"
onClick={() => removeElementById("am-modal-container")}>{getLabel(111, "取消")}</a>
<a href="javascript:void(0);" className="am-modal-button"
onClick={this.props.onConfirm}>{getLabel(111, "确定")}</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
}
export default MobileModal;

View File

@ -0,0 +1,82 @@
/*
* 二次验证密码
*
* @Author: 黎永顺
* @Date: 2025/4/16
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { WeaForm, WeaSwitch } from "comsMobx";
import { message } from "antd";
import FormInfo from "../../components/FormInfo";
import { secondaryVerifyConditions } from "./conditions";
import * as API from "../../apis/mySalaryBenefits";
import MobileModal from "./mobileModal";
const form = new WeaForm();
const getLabel = WeaLocaleProvider.getLabel;
class SecondaryVerify extends Component {
constructor(props) {
super(props);
this.state = { notSetting: false };
}
componentDidMount() {
API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, this.props.salaryBillToken)
.then(({ notSetting }) => {
this.setState({ notSetting });
});
form.initFormFields(secondaryVerifyConditions);
}
componentWillUnmount() {
this.setState({ notSetting: false }, () => form.resetForm());
}
doSecondAuth = () => {
form.validateForm().then(f => {
if (f.isValid) {
const { salaryBillToken } = this.props;
API.doSecondAuth({ mouldCode: "HRM", itemCode: "SALARY", ...form.getFormParams() }, salaryBillToken)
.then(({ status, checkStatus, checkMsg }) => {
if (status && checkStatus === "1") {
message.success(checkMsg);
this.props.onSuccess();
} else {
form.showError("authCode", checkMsg);
}
});
} else {
f.showErrors();
}
});
};
render() {
const { notSetting } = this.state;
const itemRender = {
authCode: (field, textAreaProps, form, formParams) => {
return (<React.Fragment>
<WeaSwitch fieldConfig={{ ...field, ...textAreaProps }} form={form} formParams={formParams}/>
{
notSetting &&
<div style={{ clear: "both", paddingTop: 10 }}>
{getLabel(111, "您还未设置二次验证密码,点击")}
<a href="javascript:void(0);" onClick={this.props.onSetLogin}>{getLabel(111, "设置")}</a>
</div>
}
</React.Fragment>);
}
};
return (<MobileModal title={getLabel(111, "身份验证")} onConfirm={this.doSecondAuth}>
<FormInfo center={false} custLabelCol={9} itemRender={itemRender} form={form}
formFields={secondaryVerifyConditions}/>
</MobileModal>);
}
}
export default SecondaryVerify;

View File

@ -0,0 +1,91 @@
/*
* 二次验证密码设置
*
* @Author: 黎永顺
* @Date: 2025/4/17
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { message } from "antd";
import { WeaForm, WeaSwitch } from "comsMobx";
import FormInfo from "../../components/FormInfo";
import { secondarypwdCondition } from "./conditions";
import * as API from "../../apis/mySalaryBenefits";
import MobileModal from "./mobileModal";
import { RSAEcrypt } from "../../util/RSAUtil";
const form = new WeaForm();
const getLabel = WeaLocaleProvider.getLabel;
class SecondarypwdVerify 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);
}
componentWillUnmount() {
form.resetForm();
}
save = async () => {
form.validateForm().then(f => {
if (f.isValid) {
const { secondaryPwd1, secondaryPwd2, validatecode } = form.getFormParams();
if (secondaryPwd1 !== secondaryPwd2) {
form.showError("secondaryPwd2", getLabel(504376, "密码确认不正确!"));
return;
}
RSAEcrypt("1", { secondaryPwd1, secondaryPwd2 }).then(RSAParam => {
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();
}
});
};
render() {
const itemRender = {
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>);
}
};
return (<MobileModal title={getLabel(111, "二次验证密码设置")} onConfirm={this.save}>
<FormInfo className="secondarypwd-form" center={false} itemRender={itemRender} form={form}
formFields={secondarypwdCondition}/>
</MobileModal>);
}
}
export default SecondarypwdVerify;

View File

@ -9,7 +9,6 @@ export default class Authority extends React.Component {
render() { render() {
const { store } = this.props; const { store } = this.props;
const { loading, hasRight } = store; const { loading, hasRight } = store;
const style = { const style = {
position: "absolute", position: "absolute",
top: "50%", top: "50%",

View File

@ -32,10 +32,10 @@ class PayrollPartTable extends Component {
} }
componentWillReceiveProps(nextProps, nextContext) { componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible) { if (nextProps.visible !== this.props.visible && nextProps.visible) this.sendRangeList(nextProps);
nextProps.visible && this.sendRangeList(nextProps); if (nextProps.visible !== this.props.visible && !nextProps.visible) this.setState({
this.setState({ selectedRowKeys: [] }); selectedRowKeys: [], pageInfo: { current: 1, pageSize: 10, total: 0 }
} });
} }
sendRangeList = (props) => { sendRangeList = (props) => {
@ -52,9 +52,9 @@ class PayrollPartTable extends Component {
sendRangeList(payload).then(({ status, data }) => { sendRangeList(payload).then(({ status, data }) => {
this.setState({ loading: { ...loading, query: false } }); this.setState({ loading: { ...loading, query: false } });
if (status) { if (status) {
const { pageNum: current, pageSize, total, columns, list: dataSource } = data; const { pageNum: current, total, columns, list: dataSource } = data;
this.setState({ this.setState({
pageInfo: { ...pageInfo, current, pageSize, total }, pageInfo: { ...pageInfo, current, total },
dataSource: _.map(dataSource, it => ({ dataSource: _.map(dataSource, it => ({
...it, ...it,
includeObj: _.map(it.includeObj, child => child.targetName || child.targetTypeName).join(","), includeObj: _.map(it.includeObj, child => child.targetName || child.targetTypeName).join(","),
@ -125,8 +125,7 @@ class PayrollPartTable extends Component {
onChange: current => { onChange: current => {
this.setState({ this.setState({
pageInfo: { ...pageInfo, current } pageInfo: { ...pageInfo, current }
}, () => { }, () => this.sendRangeList({ grantType, salarySendId }));
});
} }
}; };
const rowSelection = { const rowSelection = {

View File

@ -143,3 +143,7 @@ export const getIframeParentHeight = (selector, total, extraHeight) => {
} }
return height; return height;
}; };
export const removeElementById = (id) => {
const element = document.getElementById(id);
if (element) element.remove();
};