Merge branch 'feature/230701-工资单移动端查看二次密码验证设置' into release/2.8.3.2307.01
This commit is contained in:
commit
0650acb1fc
|
|
@ -31,6 +31,15 @@ export const mySalaryBill = params => {
|
|||
export const isNeedSecondPwdVerify = params => {
|
||||
return WeaTools.callApi("/api/encrypt/secondauthsetting/isNeedSecondAuth", "POST", params);
|
||||
};
|
||||
export const getSecondAuthForm = params => {
|
||||
return WeaTools.callApi("/api/encrypt/secondauthsetting/getSecondAuthForm", "POST", 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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import React from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { getQueryString } from "../../util/url";
|
||||
import { WeaDialog, WeaError, WeaInput } from "ecCom";
|
||||
import { WeaDialog, WeaError, WeaInput, WeaLocaleProvider } from "ecCom";
|
||||
import { Button, message } from "antd";
|
||||
import Authority from "../mySalary/authority";
|
||||
import ComputerTemplate from "../payroll/templatePreview/computerTemplate";
|
||||
|
|
@ -9,8 +9,11 @@ import PhoneTemplate from "../payroll/templatePreview/phoneTemplate";
|
|||
import "../payroll/templatePreview/index.less";
|
||||
import * as API from "../../apis/mySalaryBenefits";
|
||||
import { payrollCheckType } from "../../apis/payroll";
|
||||
import "./index.less";
|
||||
import CaptchaModal from "../../components/captchaModal";
|
||||
import PassSetDialog from "./passSetDialog";
|
||||
import "./index.less";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
@inject("mySalaryStore")
|
||||
@observer
|
||||
|
|
@ -18,9 +21,11 @@ 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: []
|
||||
|
|
@ -49,7 +54,11 @@ export default class MobilePayroll extends React.Component {
|
|||
// if (window.em) {
|
||||
API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }).then(({ status, isNeedSecondAuth }) => {
|
||||
if (status && isNeedSecondAuth) {
|
||||
this.setState({ visible: true });
|
||||
this.setState({ visible: true }, () => {
|
||||
API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }).then(({ status, notSetting }) => {
|
||||
this.setState({ notSetting });
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.getMySalaryBill(getQueryString("id"));
|
||||
setInitEmVerify();
|
||||
|
|
@ -106,8 +115,8 @@ export default class MobilePayroll extends React.Component {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { mySalaryStore: { clearLoading } } = this.props;
|
||||
const { mySalaryBillData, visible, captchaVisible } = this.state;
|
||||
const { mySalaryStore: { clearLoading, pwdForm } } = this.props;
|
||||
const { mySalaryBillData, visible, captchaVisible, notSetting, pwdSetVisible } = this.state;
|
||||
const type = getQueryString("type");
|
||||
const employeeInformation = mySalaryBillData.employeeInformation ? mySalaryBillData.employeeInformation : {};
|
||||
const salaryGroups = mySalaryBillData.salaryGroups ? mySalaryBillData.salaryGroups : [];
|
||||
|
|
@ -126,9 +135,17 @@ export default class MobilePayroll extends React.Component {
|
|||
]}
|
||||
>
|
||||
<WeaError tipPosition="bottom" ref="weaError" error="此项必填">
|
||||
<WeaInput value={this.state.authCode} onChange={authCode => this.setState({ authCode })}/>
|
||||
<WeaInput value={this.state.authCode} 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 })}/>
|
||||
{
|
||||
type === "phone" ?
|
||||
<Authority ecId={`${this && this.props && this.props.ecId || ""}_Authority@lulowc`}
|
||||
|
|
|
|||
|
|
@ -15,3 +15,27 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pwdSetWrapper {
|
||||
.ant-modal-content {
|
||||
width: 80vw !important;
|
||||
|
||||
.wea-dialog-body, .wea-new-scroll {
|
||||
height: 195px !important;
|
||||
|
||||
.wea-search-group .wea-form-cell {
|
||||
padding: 0 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.validatecodeWrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.wea-input-normal {
|
||||
width: 50% !important;
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* Author: 黎永顺
|
||||
* name: 二次验证密码设置
|
||||
* Description:
|
||||
* Date: 2023/7/7
|
||||
*/
|
||||
import React, { Component } from "react";
|
||||
import { WeaDialog, WeaFormItem, WeaLocaleProvider, WeaSearchGroup } from "ecCom";
|
||||
import { WeaSwitch } from "comsMobx";
|
||||
import { condition, loginCondition } from "./pwdCondtion";
|
||||
import { Button, message } from "antd";
|
||||
import { RSAEcrypt } from "../../util/RSAUtil";
|
||||
import { checkPassword, saveSecondaryPwd } from "../../apis/mySalaryBenefits";
|
||||
import "./index.less";
|
||||
|
||||
const getLabel = WeaLocaleProvider.getLabel;
|
||||
|
||||
class PassSetDialog 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,
|
||||
isPassLoginPassword: false
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.props.form.initFormFields(loginCondition);
|
||||
this.props.form.initFormFields(condition);
|
||||
}
|
||||
|
||||
getSearchs = (form, condition) => {
|
||||
const { isFormInit } = form, formParams = form.getFormParams();
|
||||
let group = [];
|
||||
isFormInit && condition && condition.map(c => {
|
||||
let items = [];
|
||||
c.items.map(fields => {
|
||||
items.push({
|
||||
com: (
|
||||
<WeaFormItem
|
||||
label={`${fields.label}`} labelCol={{ span: `${fields.labelcol}` }}
|
||||
wrapperCol={{ span: `${fields.fieldcol}` }} error={form.getError(fields)}
|
||||
tipPosition="bottom"
|
||||
>
|
||||
{
|
||||
fields.domkey[0] === "validatecode" ?
|
||||
<div className="validatecodeWrapper">
|
||||
<WeaSwitch fieldConfig={fields} form={form} formParams={formParams}/>
|
||||
<img
|
||||
style={{ height: 30, cursor: "pointer" }}
|
||||
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=""
|
||||
/>
|
||||
</div>
|
||||
: <WeaSwitch fieldConfig={fields} form={form} formParams={formParams}/>
|
||||
}
|
||||
</WeaFormItem>),
|
||||
colSpan: 1
|
||||
});
|
||||
});
|
||||
group.push(
|
||||
<WeaSearchGroup
|
||||
col={1} needTigger={false} title={c.title}
|
||||
showGroup={c.defaultshow} items={items}
|
||||
/>);
|
||||
});
|
||||
return group;
|
||||
};
|
||||
saveSecondaryPassword = () => {
|
||||
const { isPassLoginPassword } = this.state;
|
||||
const { form } = this.props;
|
||||
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;
|
||||
}
|
||||
}
|
||||
const params = isPassLoginPassword ? { secondaryPwd1, secondaryPwd2 } : { password };
|
||||
RSAEcrypt("1", params).then(RSAParam => {
|
||||
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={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>
|
||||
]}
|
||||
>
|
||||
{
|
||||
isPassLoginPassword ?
|
||||
this.getSearchs(this.props.form, condition) :
|
||||
this.getSearchs(this.props.form, loginCondition)
|
||||
}
|
||||
</WeaDialog>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default PassSetDialog;
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
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: [
|
||||
{
|
||||
colSpan: 1,
|
||||
checkbox: false,
|
||||
checkboxValue: false,
|
||||
conditionType: "INPUT",
|
||||
domkey: ["secondaryPwd1"],
|
||||
fieldcol: 18,
|
||||
label: getLabel(409, "密码"),
|
||||
labelcol: 6,
|
||||
detailtype: 3,
|
||||
rules: "required|string",
|
||||
viewAttr: 3
|
||||
},
|
||||
{
|
||||
colSpan: 1,
|
||||
conditionType: "INPUT",
|
||||
domkey: ["secondaryPwd2"],
|
||||
fieldcol: 18,
|
||||
label: getLabel(511112, "确认密码"),
|
||||
labelcol: 6,
|
||||
rules: "required|string",
|
||||
viewAttr: 3
|
||||
},
|
||||
{
|
||||
colSpan: 1,
|
||||
conditionType: "INPUT",
|
||||
domkey: ["validatecode"],
|
||||
fieldcol: 18,
|
||||
label: getLabel(511113, "验证码"),
|
||||
labelcol: 6,
|
||||
value: "",
|
||||
rules: "required|string",
|
||||
viewAttr: 3
|
||||
}
|
||||
],
|
||||
title: "",
|
||||
defaultshow: true
|
||||
}
|
||||
];
|
||||
|
|
@ -14,6 +14,7 @@ const { TableStore } = WeaTableNew;
|
|||
export class MySalaryStore {
|
||||
@observable tableStore = new TableStore(); // new table
|
||||
@observable form = new WeaForm(); // nrew 一个form
|
||||
@observable pwdForm = new WeaForm(); // new 一个密码验证form
|
||||
@observable condition = []; // 存储后台得到的form数据
|
||||
@observable hasRight = false; // 判断用户是有权限查看当前页面: 没有权限渲染无权限页面,有权限渲染数据
|
||||
@observable showSearchAd = false; // 高级搜索面板显示
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
import loadjs from "loadjs";
|
||||
|
||||
const RSAEcrypt = (openRSA, param) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
//异步加载ras文件
|
||||
loadjs.isDefined("rsa") ? loadjs.ready("rsa", () => {
|
||||
if (openRSA && openRSA == "1") {
|
||||
Object.keys(param).forEach(key => {
|
||||
param[key] = __RSAEcrypt__.rsa_data_encrypt(param[key]);
|
||||
});
|
||||
}
|
||||
resolve(param);
|
||||
}) : loadjs(["/js/rsa/jsencrypt.js", "/js/rsa/rsa.js"], "rsa", {
|
||||
async: false,
|
||||
success: () => {
|
||||
if (openRSA && openRSA == "1") {
|
||||
const callback = () => {
|
||||
Object.keys(param).forEach(key => {
|
||||
param[key] = __RSAEcrypt__.rsa_data_encrypt(param[key]);
|
||||
});
|
||||
resolve(param);
|
||||
};
|
||||
__RSAEcrypt__.initRsaCode(callback);
|
||||
} else {
|
||||
resolve(param);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export { RSAEcrypt };
|
||||
Loading…
Reference in New Issue