Merge branch 'feature/2.19.1.2501.01-PC端Token验证' into custom/湖南国科微电子股份有限公司(HR项目)

This commit is contained in:
lys 2025-04-23 16:21:55 +08:00
commit 966c08e20b
14 changed files with 788 additions and 135 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

@ -1,5 +1,5 @@
/*
* 工资单查看启用二次验证弹框
* pc端工资单查看启用二次验证弹框
* @Author: 黎永顺
* @Date: 2025/4/15
* @Wechat:
@ -12,6 +12,8 @@ import { WeaForm, WeaSwitch } from "comsMobx";
import { Button, message } from "antd";
import * as API from "../../apis/mySalaryBenefits";
import FormInfo from "../../components/FormInfo";
import LoginVerifyPC from "./loginVerifyPC";
import SecondarypwdVerifyPC from "./secondarypwdVerifyPC";
const getLabel = WeaLocaleProvider.getLabel;
const form = new WeaForm();
@ -20,7 +22,7 @@ class CheckSecondaryVerifyDialog extends Component {
constructor(props) {
super(props);
this.state = {
loading: false, conditions: [], notSetting: false
loading: false, conditions: [], notSetting: false, loginVerify: false, secondaryVerify: false
};
}
@ -59,16 +61,18 @@ class CheckSecondaryVerifyDialog extends Component {
};
render() {
const { conditions, loading, notSetting } = this.state;
const {
conditions, loading, notSetting, loginVerify, secondaryVerify
} = this.state, { salaryBillToken } = this.props;
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.setState({ pwdSetVisible: true })}>{getLabel("30747", "设置")}</a>*/}
{getLabel("111", "您还未设置二次验证密码,点击")}
<a href="javascript:void(0);"
onClick={() => this.setState({ loginVerify: true })}>{getLabel("30747", "设置")}</a>
</div>
}
</React.Fragment>);
@ -84,6 +88,14 @@ class CheckSecondaryVerifyDialog extends Component {
<FormInfo className="form-dialog-layout" center={false} itemRender={itemRender}
form={form} formFields={conditions}/>
</div>
{/*登录密码验证弹框*/}
<LoginVerifyPC salaryBillToken={salaryBillToken} visible={loginVerify}
onCancel={() => this.setState({ loginVerify: false })}
onSetPwdSet={() => this.setState({ secondaryVerify: true })}/>
{/*二次密码设置*/}
<SecondarypwdVerifyPC salaryBillToken={salaryBillToken} visible={secondaryVerify}
onCancel={() => this.setState({ secondaryVerify: false })}
onSuccess={this.initForm}/>
</WeaDialog>
);
}

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 { 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";
import SecondaryVerify from "./secondaryVerify";
import LoginVerify from "./loginVerify";
import SecondarypwdVerify from "./secondarypwdVerify";
import CheckSecondaryVerifyDialog from "./checkSecondaryVerifyDialog";
import "../mySalary/index.less";
@ -25,15 +27,8 @@ 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: []
},
visible: false, captchaVisible: false, loginVisible: false, pwdSetVisible: false,
mySalaryBillData: { employeeInformation: {}, salaryTemplate: [] },
salaryBillToken: {},
// 统一二次验证
checkSecVerify: false
@ -83,12 +78,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();
@ -105,12 +95,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();
@ -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) => {
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({
@ -155,10 +119,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("=");
@ -202,34 +164,23 @@ export default class MobilePayroll extends React.Component {
};
render() {
const { mySalaryStore: { clearLoading, pwdForm, setInitEmVerify } } = this.props;
const { salaryBillToken, visible, captchaVisible, notSetting, pwdSetVisible, checkSecVerify } = this.state;
const { mySalaryStore: { setInitEmVerify } } = this.props, {
captchaVisible, visible, loginVisible, pwdSetVisible, checkSecVerify
} = 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}
onSetLogin={() => this.setState({ visible: false, loginVisible: true })}
onSuccess={() => {
setInitEmVerify();
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())}/>}
{/*统一外部调用token*/}
<CheckSecondaryVerifyDialog visible={checkSecVerify} salaryBillToken={salaryBillToken}
<CheckSecondaryVerifyDialog visible={checkSecVerify} salaryBillToken={this.state.salaryBillToken}
onCancel={(callback) => this.setState({ checkSecVerify: false }, () => callback && callback())}
onSuccess={() => {
this.getMySalaryBill(getQueryString("id"));
@ -241,21 +192,20 @@ export default class MobilePayroll extends React.Component {
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`}
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
@ -264,9 +214,7 @@ export default class MobilePayroll extends React.Component {
goFeedback={this.handleGoFeedback}
/>
</MobileTemplate>
</Authority>
:
<Authority ecId={`${this && this.props && this.props.ecId || ""}_Authority@lulowc`}
</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}>
@ -277,9 +225,7 @@ export default class MobilePayroll extends React.Component {
/>
</Content>
</div>
</Authority>
}
</React.Fragment>
);
</Authority>}
</React.Fragment>);
}
}

View File

@ -39,3 +39,142 @@
}
}
}
.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;
}
.secondarypwd-form {
.wea-form-cell-wrapper {
& > div:last-child {
.ant-col-16 {
width: 37.5% !important;
}
}
}
}

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,72 @@
/*
* 二次验证
* 登录密码验证
* @Author: 黎永顺
* @Date: 2025/4/23
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaDialog, WeaLocaleProvider } from "ecCom";
import { WeaForm } from "comsMobx";
import { Button } from "antd";
import FormInfo from "../../components/FormInfo";
import { loginCondition } from "./pwdCondtion";
import { RSAEcrypt } from "../../util/RSAUtil";
import * as API from "../../apis/mySalaryBenefits";
const form = new WeaForm();
const getLabel = WeaLocaleProvider.getLabel;
class LoginVerifyPC extends Component {
constructor(props) {
super(props);
this.state = { loading: false };
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) {
form.initFormFields(loginCondition);
} else {
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.onCancel();
this.props.onSetPwdSet();
} else {
form.showError("password", getLabel(504343, "登录密码错误"));
}
});
});
} else {
f.showErrors();
}
});
};
render() {
const { loading } = this.state;
return (
<WeaDialog
{...this.props}
style={{ width: 550, height: _.reduce(loginCondition, (pre, cur) => (pre += cur.items.length), 0) * 47 + 33 }}
initLoadCss title={getLabel(111, "请先输入登录密码")} buttons={[
<Button type="primary" onClick={this.save} loading={loading}>{getLabel(111, "下一步")}</Button>
]}>
<FormInfo className="form-dialog-layout" center={false} itemRender={{}} form={form}
formFields={loginCondition}/>
</WeaDialog>
);
}
}
export default LoginVerifyPC;

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

@ -0,0 +1,96 @@
/*
* 二次验证密码设置
*
* @Author: 黎永顺
* @Date: 2025/4/17
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaDialog, WeaLocaleProvider } from "ecCom";
import { Button, message } from "antd";
import { WeaForm, WeaSwitch } from "comsMobx";
import FormInfo from "../../components/FormInfo";
import { secondarypwdCondition } from "./conditions";
import * as API from "../../apis/mySalaryBenefits";
import { RSAEcrypt } from "../../util/RSAUtil";
const form = new WeaForm();
const getLabel = WeaLocaleProvider.getLabel;
class SecondarypwdVerifyPC 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.onCancel();
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 (<WeaDialog
{...this.props} style={{
width: 550, height: _.reduce(secondarypwdCondition, (pre, cur) => (pre += cur.items.length), 0) * 47 + 33
}} initLoadCss title={getLabel(111, "二次验证密码设置")} buttons={[
<Button type="primary" onClick={this.save}>{getLabel(111, "保存")}</Button>
]}>
<FormInfo className="form-dialog-layout secondarypwd-form" center={false} itemRender={itemRender} form={form}
formFields={secondarypwdCondition}/>
</WeaDialog>);
}
}
export default SecondarypwdVerifyPC;

View File

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

View File

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

View File

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