feature/2.19.1.2501.01-PC端Token验证
This commit is contained in:
parent
ae7785ff6e
commit
0b081877f4
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,3 +168,13 @@
|
|||
position: relative;
|
||||
border-left: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.secondarypwd-form {
|
||||
.wea-form-cell-wrapper {
|
||||
& > div:last-child {
|
||||
.ant-col-16 {
|
||||
width: 37.5% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
Loading…
Reference in New Issue