From e9546e53290edda71d27e6908c960c999f8d6122 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 15:32:05 +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 --- pc4mobx/hrmSalary/apis/payroll.js | 4 ++++ .../components/captchaModal/index.js | 21 +++++++++++-------- pc4mobx/hrmSalary/pages/mySalary/index.js | 17 +++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/payroll.js b/pc4mobx/hrmSalary/apis/payroll.js index 6440ff2a..ac0debc2 100644 --- a/pc4mobx/hrmSalary/apis/payroll.js +++ b/pc4mobx/hrmSalary/apis/payroll.js @@ -367,6 +367,10 @@ export const getAvailableSalaryItemSet = (params) => { export const salaryBillSendSum = (params) => { return postFetch("/api/bs/hrmsalary/salaryBill/send/sum", params); }; +//工资单发放-发送短信验证码 +export const sendMobileCode = (params) => { + return postFetch("/api/bs/hrmsalary/salaryBill/sendMobileCode", params); +}; //工资单-验证方式 export const payrollCheckType = params => { return WeaTools.callApi("/api/bs/hrmsalary/salaryBill/payrollCheckType", "GET", params); diff --git a/pc4mobx/hrmSalary/components/captchaModal/index.js b/pc4mobx/hrmSalary/components/captchaModal/index.js index 9098df54..10675b57 100644 --- a/pc4mobx/hrmSalary/components/captchaModal/index.js +++ b/pc4mobx/hrmSalary/components/captchaModal/index.js @@ -6,6 +6,7 @@ */ import React, { Component } from "react"; import { WeaDialog, WeaError, WeaFormItem, WeaInput, WeaLocaleProvider, WeaSearchGroup } from "ecCom"; +import { sendMobileCode } from "../../apis/payroll"; import { Button } from "antd"; import "./index.less"; @@ -35,15 +36,17 @@ class Index extends Component { } handleSendCaptcha = () => { - 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(({}) => { + 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); + }); }; render() { diff --git a/pc4mobx/hrmSalary/pages/mySalary/index.js b/pc4mobx/hrmSalary/pages/mySalary/index.js index da92ac0f..6902836e 100644 --- a/pc4mobx/hrmSalary/pages/mySalary/index.js +++ b/pc4mobx/hrmSalary/pages/mySalary/index.js @@ -2,14 +2,12 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { DatePicker } from "antd"; import { WeaNewScroll, WeaTop } from "ecCom"; -import { renderNoright } from "../../util"; +import { renderNoright } from "../../util"; // 渲染form数据的方法:因为多个页面都会使用,所以抽的公共方法在util中 import CustomTab from "../../components/customTab"; import moment from "moment"; import PayrollModal from "./payrollModal"; import Authority from "./authority"; import CustomPaginationTable from "../../components/customPaginationTable"; -import CaptchaModal from "../../components/captchaModal"; -import { payrollCheckType } from "../../apis/payroll"; import "./index.less"; const { RangePicker } = DatePicker; @@ -24,19 +22,15 @@ export default class MySalary extends React.Component { selectedKey: "0", salaryBillVisible: false, salaryInfoId: "", - salaryRange: [moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")], - captchaVisible: false + salaryRange: [moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")] }; this.pageInfo = { current: 1, pageSize: 10 }; this.historyPageInfo = { current: 1, pageSize: 10 }; } - async componentWillMount() { + componentWillMount() { const { mySalaryStore: { init } } = this.props; - const data = await payrollCheckType(); - console.log(data); - this.setState({ captchaVisible: true }); - // init(); + init(); } // 查看工资单 @@ -119,7 +113,7 @@ export default class MySalary extends React.Component { recordListPageInfo, myBillPageInfo } = mySalaryStore; - const { salaryBillVisible, salaryInfoId, salaryRange, captchaVisible } = this.state; + const { salaryBillVisible, salaryInfoId, salaryRange } = this.state; if (!hasRight && !loading) return renderNoright(); const topTab = [ @@ -216,7 +210,6 @@ export default class MySalary extends React.Component { }} /> } - this.setState({ captchaVisible: false })}/> ); }