diff --git a/pc4mobx/hrmSalary/apis/mySalaryBenefits.js b/pc4mobx/hrmSalary/apis/mySalaryBenefits.js index f197ba27..75e3eb73 100644 --- a/pc4mobx/hrmSalary/apis/mySalaryBenefits.js +++ b/pc4mobx/hrmSalary/apis/mySalaryBenefits.js @@ -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); diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js index 389afbcd..a1756ede 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js @@ -14,7 +14,8 @@ import { ConfirmBtns } from "../mySalary/mySalaryView"; import Content from "../../components/pcTemplate/content"; import MobileTemplate from "../../components/mobileTemplate"; import SecondaryVerify from "./secondaryVerify"; -import { removeElementById } from "../../util"; +import LoginVerify from "./loginVerify"; +import SecondarypwdVerify from "./secondarypwdVerify"; import "../mySalary/index.less"; const getLabel = WeaLocaleProvider.getLabel; @@ -24,8 +25,7 @@ export default class MobilePayroll extends React.Component { constructor(props) { super(props); this.state = { - visible: false, - captchaVisible: false, + visible: false, captchaVisible: false, loginVisible: false, pwdSetVisible: false, mySalaryBillData: { employeeInformation: {}, salaryTemplate: [] }, salaryBillToken: {} }; @@ -140,15 +140,21 @@ export default class MobilePayroll extends React.Component { }; render() { - const { mySalaryStore: { setInitEmVerify } } = this.props, { captchaVisible, visible } = this.state; + const { mySalaryStore: { setInitEmVerify } } = this.props, { + captchaVisible, visible, loginVisible, pwdSetVisible + } = this.state; const type = getQueryString("type"); if (_.isEmpty(toJS(this.props.mySalaryStore.mySalaryBill))) return {visible && this.setState({ visible: false, loginVisible: true })} onSuccess={() => { setInitEmVerify(); - // removeElementById("am-modal-container"); this.getMySalaryBill(getQueryString("id")); }}/>} + {loginVisible && this.setState({ loginVisible: false, pwdSetVisible: true })}/>} + {pwdSetVisible && this.setState({ pwdSetVisible: false }, () => this.initMobile())}/>} {/*发送验证码*/} { form.validateForm().then(f => { if (f.isValid) { - RSAEcrypt("1", { ...form.getFormParams() }).then(RSAParam => { - API.checkPassword({ ...RSAParam }).then(({ result }) => { - if (result) { - ReactDom.render(, document.getElementById("container")); - } else { - form.showError("password", getLabel(504343, "登录密码错误")); - } + 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(); } diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/secondaryVerify.js b/pc4mobx/hrmSalary/pages/mobilePayroll/secondaryVerify.js index a9006367..b5310466 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/secondaryVerify.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/secondaryVerify.js @@ -15,7 +15,6 @@ import FormInfo from "../../components/FormInfo"; import { secondaryVerifyConditions } from "./conditions"; import * as API from "../../apis/mySalaryBenefits"; import MobileModal from "./mobileModal"; -import LoginVerify from "./loginVerify"; const form = new WeaForm(); const getLabel = WeaLocaleProvider.getLabel; @@ -23,7 +22,7 @@ const getLabel = WeaLocaleProvider.getLabel; class SecondaryVerify extends Component { constructor(props) { super(props); - this.state = { notSetting: false, visible: false }; + this.state = { notSetting: false }; } componentDidMount() { @@ -35,7 +34,7 @@ class SecondaryVerify extends Component { } componentWillUnmount() { - this.setState({ notSetting: false, visible: false }, () => form.resetForm()); + this.setState({ notSetting: false }, () => form.resetForm()); } doSecondAuth = () => { @@ -56,10 +55,9 @@ class SecondaryVerify extends Component { } }); }; - handleSetSecondaryPassword = () => this.setState({ visible: false }); render() { - const { notSetting, visible } = this.state; + const { notSetting } = this.state; const itemRender = { authCode: (field, textAreaProps, form, formParams) => { return ( @@ -68,7 +66,7 @@ class SecondaryVerify extends Component { notSetting &&
{getLabel(111, "您还未设置二次验证密码,点击")} - {getLabel(111, "设置")} + {getLabel(111, "设置")}
}
); @@ -77,9 +75,6 @@ class SecondaryVerify extends Component { return ( - { - visible && - } ); } } diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerify.js b/pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerify.js index 00e75d22..a8f84027 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerify.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerify.js @@ -8,7 +8,6 @@ * @description: */ import React, { Component } from "react"; -import ReactDom from "react-dom"; import { WeaLocaleProvider } from "ecCom"; import { message } from "antd"; import { WeaForm, WeaSwitch } from "comsMobx"; @@ -17,7 +16,6 @@ import { secondarypwdCondition } from "./conditions"; import * as API from "../../apis/mySalaryBenefits"; import MobileModal from "./mobileModal"; import { RSAEcrypt } from "../../util/RSAUtil"; -import SecondaryVerify from "./secondaryVerify"; const form = new WeaForm(); const getLabel = WeaLocaleProvider.getLabel; @@ -48,17 +46,18 @@ class SecondarypwdVerify extends Component { return; } RSAEcrypt("1", { secondaryPwd1, secondaryPwd2 }).then(RSAParam => { - API.saveSecondaryPwd({ ...RSAParam, validatecode }).then(({ sign, message: msg }) => { - if (sign === "1") { - message.success(msg); - ReactDom.render(, document.getElementById("container")); - } 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}` }); - }); - } - }); + 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();