From 94c9a39f9f773fff1c9dd1e4e73984729fb90032 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Thu, 17 Apr 2025 14:23:31 +0800 Subject: [PATCH] =?UTF-8?q?feature/2.19.1.2501.01-=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E6=9F=A5=E7=9C=8B=E5=B7=A5=E8=B5=84=E5=8D=95=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/mobilePayroll/conditions.js | 66 ++++++++++++++++++ .../hrmSalary/pages/mobilePayroll/index.js | 14 ++-- .../hrmSalary/pages/mobilePayroll/index.less | 60 +++++++--------- .../pages/mobilePayroll/loginVerify.js | 56 +++++++++++++++ .../pages/mobilePayroll/mobileModal.js | 20 +++++- .../pages/mobilePayroll/secondaryVerify.js | 60 +++++++++++++++- .../pages/mobilePayroll/secondarypwdVerify.js | 68 +++++++++++++++++++ 7 files changed, 297 insertions(+), 47 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/mobilePayroll/loginVerify.js create mode 100644 pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerify.js diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/conditions.js b/pc4mobx/hrmSalary/pages/mobilePayroll/conditions.js index af7a60c8..3462cb08 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/conditions.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/conditions.js @@ -19,3 +19,69 @@ export const secondaryVerifyConditions = [ defaultshow: true } ]; +export const loginCondition = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["password"], + fieldcol: 14, + label: "登录密码", + labelcol: 10, + value: "", + otherParams: { + type: "password" + }, + rules: "required|string", + viewAttr: 3 + } + ], + title: "", + defaultshow: true + } +]; +export const secondarypwdCondition = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["secondaryPwd1"], + fieldcol: 14, + label: "密码", + labelcol: 10, + value: "", + otherParams: { + type: "password", + passwordStrength: true + }, + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "INPUT", + domkey: ["secondaryPwd2"], + fieldcol: 14, + label: "确认密码", + labelcol: 10, + value: "", + otherParams: { + type: "password" + }, + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "INPUT", + domkey: ["validatecode"], + fieldcol: 14, + label: "验证码", + labelcol: 10, + value: "", + rules: "required|string", + viewAttr: 3 + } + ], + title: "", + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js index 4e764da8..eaa34aff 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js @@ -15,9 +15,9 @@ import PassSetDialog from "./passSetDialog"; import { ConfirmBtns } from "../mySalary/mySalaryView"; import Content from "../../components/pcTemplate/content"; import MobileTemplate from "../../components/mobileTemplate"; -import "../mySalary/index.less"; -import MobileModal from "./mobileModal"; import SecondaryVerify from "./secondaryVerify"; +import { removeElementById } from "../../util"; +import "../mySalary/index.less"; const getLabel = WeaLocaleProvider.getLabel; @@ -85,11 +85,11 @@ export default class MobilePayroll extends React.Component { API.isNeedSecondPwdVerify({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken) .then(({ status, isNeedSecondAuth }) => { if (status && isNeedSecondAuth) { - ReactDom.render( - message.error("请输入密码")}> - - , - document.body); + ReactDom.render( { + removeElementById("am-modal-container"); + this.getMySalaryBill(getQueryString("id")); + }}/>, document.body); return; this.setState({ visible: true }, () => { API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, this.state.salaryBillToken) diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.less b/pc4mobx/hrmSalary/pages/mobilePayroll/index.less index c9bb4a6a..8d600fc5 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/index.less +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.less @@ -52,7 +52,7 @@ } .am-modal-transparent { - width: 270px; + width: 80%; } .am-modal-transparent .am-modal-content { @@ -92,50 +92,38 @@ height: 100%; line-height: 1.5; overflow: auto; - padding: 0 15px 15px; + padding: 0 15px 30px; .wea-search-group, .wea-content, .wea-form-cell { padding: 0; } } -.am-modal { - position: fixed; - top: 50%; - left: 50%; - transform: translate(-50%, -50%); - z-index: 1000; -} - .am-modal-wrap { - height: 100vh; + position: fixed; + overflow: auto; + top: 0; + right: 0; + bottom: 0; + left: 0; + height: 100%; + z-index: 999; + -webkit-overflow-scrolling: touch; + outline: 0; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; display: flex; - justify-content: center; + -webkit-box-align: center; + -webkit-align-items: center; + -ms-flex-align: center; align-items: center; - //position: fixed; - //overflow: auto; - //top: 0; - //right: 0; - //bottom: 0; - //left: 0; - //height: 100%; - //z-index: 999; - //-webkit-overflow-scrolling: touch; - //outline: 0; - //display: -webkit-box; - //display: -webkit-flex; - //display: -ms-flexbox; - //display: flex; - //-webkit-box-align: center; - //-webkit-align-items: center; - //-ms-flex-align: center; - //align-items: center; - //-webkit-box-pack: center; - //-webkit-justify-content: center; - //-ms-flex-pack: center; - //justify-content: center; - //-webkit-transform: translateZ(1px); - //transform: translateZ(1px); + -webkit-box-pack: center; + -webkit-justify-content: center; + -ms-flex-pack: center; + justify-content: center; + -webkit-transform: translateZ(1px); + transform: translateZ(1px); } .am-modal-button-group-h { diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/loginVerify.js b/pc4mobx/hrmSalary/pages/mobilePayroll/loginVerify.js new file mode 100644 index 00000000..1be34d7a --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/loginVerify.js @@ -0,0 +1,56 @@ +/* + * 登录密码验证 + * + * @Author: 黎永顺 + * @Date: 2025/4/17 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import ReactDom from "react-dom"; +import { WeaLocaleProvider } from "ecCom"; +import { WeaForm } from "comsMobx"; +import FormInfo from "../../components/FormInfo"; +import { loginCondition } from "./conditions"; +import MobileModal from "./mobileModal"; +import SecondarypwdVerify from "./secondarypwdVerify"; +import { checkPassword } from "../../apis/mySalaryBenefits"; +import { RSAEcrypt } from "../../util/RSAUtil"; + +const form = new WeaForm(); +const getLabel = WeaLocaleProvider.getLabel; + +class LoginVerify extends Component { + + componentDidMount() { + form.initFormFields(loginCondition); + } + + save = async () => { + form.validateForm().then(f => { + if (f.isValid) { + RSAEcrypt("1", { ...form.getFormParams() }).then(RSAParam => { + checkPassword({ ...RSAParam }).then(({ result }) => { + if (result) { + ReactDom.render(, document.body); + } else { + form.showError("password", getLabel(504343, "登录密码错误")); + } + }); + }); + } else { + f.showErrors(); + } + }); + }; + + render() { + const itemRender = {}; + return ( + + ); + } +} + +export default LoginVerify; diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/mobileModal.js b/pc4mobx/hrmSalary/pages/mobilePayroll/mobileModal.js index 1f76b313..b6f388db 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/mobileModal.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/mobileModal.js @@ -15,10 +15,28 @@ import "./index.less"; const getLabel = WeaLocaleProvider.getLabel; class MobileModal extends Component { + componentDidMount() { + this.setMetaViewport(); + } + + setMetaViewport = () => { + // 检查是否已存在 viewport meta 标签 + let viewportMeta = document.querySelector("meta[name=\"viewport\"]"); + if (!viewportMeta) { + // 如果不存在,创建一个新的 meta 标签 + viewportMeta = document.createElement("meta"); + viewportMeta.setAttribute("name", "viewport"); + document.head.appendChild(viewportMeta); + } + // 设置或更新 viewport 的 content 属性 + const content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"; + viewportMeta.setAttribute("content", content); + }; + render() { return (
-
+
diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/secondaryVerify.js b/pc4mobx/hrmSalary/pages/mobilePayroll/secondaryVerify.js index e8c18c3f..1660dfee 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/secondaryVerify.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/secondaryVerify.js @@ -8,22 +8,76 @@ * @description: */ import React, { Component } from "react"; +import ReactDom from "react-dom"; import { WeaLocaleProvider } from "ecCom"; -import { WeaForm } from "comsMobx"; +import { WeaForm, WeaSwitch } from "comsMobx"; +import { message } from "antd"; 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; class SecondaryVerify extends Component { + constructor(props) { + super(props); + this.state = { notSetting: false }; + } + componentDidMount() { + API.getSecondAuthForm({ mouldCode: "HRM", itemCode: "SALARY" }, this.props.salaryBillToken) + .then(({ notSetting }) => { + this.setState({ notSetting }); + }); form.initFormFields(secondaryVerifyConditions); } + doSecondAuth = () => { + form.validateForm().then(f => { + if (f.isValid) { + const { mySalaryStore: { setInitEmVerify }, salaryBillToken } = this.props; + API.doSecondAuth({ mouldCode: "HRM", itemCode: "SALARY", ...form.getFormParams() }, salaryBillToken) + .then(({ status, checkStatus, checkMsg }) => { + if (status && checkStatus === "1") { + message.success(checkMsg); + setInitEmVerify(); + this.props.onSuccess(); + } else { + form.showError("authCode", checkMsg); + } + }); + } else { + f.showErrors(); + } + }); + }; + handleSetSecondaryPassword = () => { + ReactDom.render(, document.body); + }; + render() { - const itemRender = {}; - return (); + const { notSetting } = this.state; + const itemRender = { + authCode: (field, textAreaProps, form, formParams) => { + return ( + + { + notSetting && +
+ {getLabel(111, "您还未设置二次验证密码,点击")} + {getLabel(111, "设置")} +
+ } +
); + } + }; + return ( + + ); } } diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerify.js b/pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerify.js new file mode 100644 index 00000000..fece44bd --- /dev/null +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/secondarypwdVerify.js @@ -0,0 +1,68 @@ +/* + * 二次验证密码设置 + * + * @Author: 黎永顺 + * @Date: 2025/4/17 + * @Wechat: + * @Email: 971387674@qq.com + * @description: +*/ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import { WeaForm, WeaSwitch } from "comsMobx"; +import FormInfo from "../../components/FormInfo"; +import { secondarypwdCondition } from "./conditions"; +import MobileModal from "./mobileModal"; +import { RSAEcrypt } from "../../util/RSAUtil"; + +const form = new WeaForm(); +const getLabel = WeaLocaleProvider.getLabel; + +class SecondarypwdVerify 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); + } + + save = async () => { + form.validateForm().then(f => { + if (f.isValid) { + RSAEcrypt("1", { ...form.getFormParams() }).then(RSAParam => { + console.log(form.getFormParams(), this.props); + }); + } else { + f.showErrors(); + } + }); + }; + + render() { + const itemRender = { + validatecode: (field, textAreaProps, form, formParams) => { + return ( + + { + 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=""/> + ); + } + }; + return ( + + ); + } +} + +export default SecondarypwdVerify;