From d71b879290b994058f0bd82f34556ceffec0369e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 16 Jun 2023 16:34:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E5=B7=A5=E8=B5=84=E5=8D=95?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/captchaModal/index.js | 37 ++++-- .../hrmSalary/pages/mobilePayroll/index.js | 23 +++- pc4mobx/hrmSalary/pages/mySalary/index.js | 122 +++++++++--------- .../hrmSalary/pages/mySalary/mySalaryView.js | 51 ++++++-- 4 files changed, 140 insertions(+), 93 deletions(-) diff --git a/pc4mobx/hrmSalary/components/captchaModal/index.js b/pc4mobx/hrmSalary/components/captchaModal/index.js index 10675b57..35661772 100644 --- a/pc4mobx/hrmSalary/components/captchaModal/index.js +++ b/pc4mobx/hrmSalary/components/captchaModal/index.js @@ -28,26 +28,35 @@ class Index extends Component { componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visible && !nextProps.visible) { - this.setState({ captcha: "" }); - } else { clearInterval(this.timeRef); - this.setState({ time: 60 }); + this.setState({ captcha: "", time: 60 }); } } handleSendCaptcha = () => { - sendMobileCode({ id: this.props.id }).then(({}) => { - this.timeRef = setInterval(() => { - const { time } = this.state; - this.setState({ time: time - 1 }, () => { - if (this.state.time === -1) { - clearInterval(this.timeRef); - this.setState({ time: 60 }); - } - }); - }, 1000); + sendMobileCode({ id: this.props.id }).then(({ status, data }) => { + if (status) { + console.log(data); + this.timeRef = setInterval(() => { + const { time } = this.state; + this.setState({ time: time - 1 }, () => { + if (this.state.time === -1) { + clearInterval(this.timeRef); + this.setState({ time: 60 }); + } + }); + }, 1000); + } }); }; + handleConfirm = () => { + if (!this.state.captcha) { + this.refs.weaError.showError(); + // return + } + this.props.onCancel(); + this.props.onConfirm(); + }; render() { const { captcha, time } = this.state; @@ -56,7 +65,7 @@ class Index extends Component { initLoadCss {...this.props} style={{ width: 550 }} className="captchaWrapper" title={getLabel(111, "验证码验证")} buttons={[ - + ]} > diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js index 1978860a..bf310e92 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js @@ -8,7 +8,9 @@ import ComputerTemplate from "../payroll/templatePreview/computerTemplate"; 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"; @inject("mySalaryStore") @observer @@ -17,6 +19,7 @@ export default class MobilePayroll extends React.Component { super(props); this.state = { visible: false, + captchaVisible: false, authCode: "", mySalaryBillData: { employeeInformation: {}, @@ -26,13 +29,20 @@ export default class MobilePayroll extends React.Component { this.id = ""; } - componentWillMount() { + async componentWillMount() { const type = getQueryString("type"); this.id = getQueryString("id"); const { mySalaryStore: { init } } = this.props; - type !== "phone" && init(false); - type === "phone" && this.initMobile(); this.getMySalaryBill(this.id); + const { data, status } = await payrollCheckType(); + if (type !== "phone") { + if (status && data === "PWD") { + init(false); + } else { + this.setState({ captchaVisible: true }); + } + } + type === "phone" && this.initMobile(); } initMobile = () => { @@ -96,7 +106,7 @@ export default class MobilePayroll extends React.Component { render() { const { mySalaryStore: { clearLoading } } = this.props; - const { mySalaryBillData, visible } = this.state; + const { mySalaryBillData, visible, captchaVisible } = this.state; const type = getQueryString("type"); const employeeInformation = mySalaryBillData.employeeInformation ? mySalaryBillData.employeeInformation : {}; const salaryGroups = mySalaryBillData.salaryGroups ? mySalaryBillData.salaryGroups : []; @@ -148,6 +158,11 @@ export default class MobilePayroll extends React.Component { } + this.setState({ captchaVisible: false })} + onConfirm={() => this.props.mySalaryStore.setInitEmVerify()} + /> ); } diff --git a/pc4mobx/hrmSalary/pages/mySalary/index.js b/pc4mobx/hrmSalary/pages/mySalary/index.js index 97ce00b8..3b7ad55d 100644 --- a/pc4mobx/hrmSalary/pages/mySalary/index.js +++ b/pc4mobx/hrmSalary/pages/mySalary/index.js @@ -6,7 +6,6 @@ import { renderNoright } from "../../util"; // 渲染form数据的方法:因 import CustomTab from "../../components/customTab"; import moment from "moment"; import PayrollModal from "./payrollModal"; -import Authority from "./authority"; import CustomPaginationTable from "../../components/customPaginationTable"; import "./index.less"; @@ -29,9 +28,9 @@ export default class MySalary extends React.Component { this.historyPageInfo = { current: 1, pageSize: 10 }; } - componentWillMount() { - const { mySalaryStore: { init } } = this.props; - init(); + componentDidMount() { + const { mySalaryStore: { mySalaryBillList } } = this.props; + mySalaryBillList([moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")]); } // 查看工资单 @@ -114,7 +113,6 @@ export default class MySalary extends React.Component { myBillPageInfo } = mySalaryStore; const { salaryBillVisible, salaryInfoId, salaryRange } = this.state; - if (!hasRight && !loading) return renderNoright(); const topTab = [ { @@ -141,64 +139,62 @@ export default class MySalary extends React.Component { }; return (
- - } // 左侧图标 - iconBgcolor="#F14A2D" // 左侧图标背景色 - showDropIcon={false} // 是否显示下拉按钮 - > - { - this.handleTabChange(v); - this.setState({ selectedKey: v }); - }} - /> -
- - { - this.state.selectedKey === "0" && - { - this.pageInfo.current = value; - this.handlePageChange(); - }} - onShowSizeChange={(current, pageSize) => { - this.pageInfo = { current, pageSize }; - this.handlePageChange(); - }} - /> - } - { - this.state.selectedKey === "2" && - { - this.historyPageInfo.current = value; - this.handleHistoryPageChange(); - }} - onShowSizeChange={(current, pageSize) => { - this.historyPageInfo = { current, pageSize }; - this.handleHistoryPageChange(); - }} - /> - } - -
-
-
+ } // 左侧图标 + iconBgcolor="#F14A2D" // 左侧图标背景色 + showDropIcon={false} // 是否显示下拉按钮 + > + { + this.handleTabChange(v); + this.setState({ selectedKey: v }); + }} + /> +
+ + { + this.state.selectedKey === "0" && + { + this.pageInfo.current = value; + this.handlePageChange(); + }} + onShowSizeChange={(current, pageSize) => { + this.pageInfo = { current, pageSize }; + this.handlePageChange(); + }} + /> + } + { + this.state.selectedKey === "2" && + { + this.historyPageInfo.current = value; + this.handleHistoryPageChange(); + }} + onShowSizeChange={(current, pageSize) => { + this.historyPageInfo = { current, pageSize }; + this.handleHistoryPageChange(); + }} + /> + } + +
+
{ salaryBillVisible && -
- -
-
+ + +
+
+ +
+
+
+ this.setState({ captchaVisible: false })} + onConfirm={() => mySalaryStore.setInitEmVerify()} + /> +
); } }