diff --git a/actions/formsActions.js b/actions/formsActions.js index d387d82..25c776c 100644 --- a/actions/formsActions.js +++ b/actions/formsActions.js @@ -16,7 +16,7 @@ if(process.browser) }; } -export const sendLeasingOrder = ({ name, phone, email, company }) => +export const sendLeasingOrder = ({ name, phone, email, company, recaptcha_token }) => { return new Promise((resolve, reject) => { @@ -28,6 +28,7 @@ export const sendLeasingOrder = ({ name, phone, email, company }) => formData.append("FORM_FIELD_COMPANY", company); formData.append("FORM_FIELD_PAGE_NAME", document.title); formData.append("FORM_FIELD_PAGE_URL", window.location.href); + formData.append("recaptcha_token", recaptcha_token); axios.post(`${ process.env.NEXT_PUBLIC_API_HOST }/api/forms/`, formData) .then((response) => @@ -38,7 +39,7 @@ export const sendLeasingOrder = ({ name, phone, email, company }) => } else { - reject(); + reject(response.data); } }) .catch((error) => diff --git a/css/main/style.css b/css/main/style.css index ce32742..a7026fb 100644 --- a/css/main/style.css +++ b/css/main/style.css @@ -3990,6 +3990,9 @@ main .dropdown_blocks_list .dropdown_block .block_body .fines_detail ul li { color: var(--blue); font-weight: 600; } +.grecaptcha-badge { + visibility: hidden; +} @media all and (max-width: 1279px) { .changes { min-height: 60vh; diff --git a/css/main/style.less b/css/main/style.less index 5490456..d85ec6d 100644 --- a/css/main/style.less +++ b/css/main/style.less @@ -4461,6 +4461,7 @@ main .dropdown_blocks_list .dropdown_block .block_body { } } +.grecaptcha-badge { visibility: hidden; } .changes { @media all and (max-width:1279px) { min-height: 60vh; diff --git a/next.config.js b/next.config.js index 4931a14..691ffb0 100644 --- a/next.config.js +++ b/next.config.js @@ -30,6 +30,7 @@ module.exports = withImages(withFonts(withLess({ async redirects() { return [ + process.env.MAINTENANCE_MODE === "1" ? { source: "/((?!maintenance|!?assets).*)", destination: "/maintenance", permanent: false } : { source: "/maintenance", destination: "/login", permanent: false }, { source: '/support', destination: '/support/faq', diff --git a/package.json b/package.json index 0331199..03050dd 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "react": "17.0.2", "react-cookie": "^4.1.1", "react-dom": "17.0.2", + "react-google-recaptcha-v3": "^1.10.0", "react-dropzone": "^14.2.2", "react-redux": "^7.2.6", "react-select": "^5.4.0", diff --git a/pages/api/file/bitrix.js b/pages/api/file/bitrix.js index 8b266fd..16de1f3 100644 --- a/pages/api/file/bitrix.js +++ b/pages/api/file/bitrix.js @@ -18,6 +18,7 @@ export default async function handler(req, res) { if(jwt.verify(cookies.jwt, process.env.JWT_SECRET_CLIENT)) { + console.log("req.query.urlreq.query.urlreq.query.urlreq.query.urlreq.query.url", req.query.url); try { axios.get(req.query.url, { diff --git a/pages/components/FormRequest/index.js b/pages/components/FormRequest/index.js index 098d180..4f5aea2 100644 --- a/pages/components/FormRequest/index.js +++ b/pages/components/FormRequest/index.js @@ -1,8 +1,10 @@ import React from "react"; +import { SpinnerCircular } from 'spinners-react'; +import { GoogleReCaptchaProvider, GoogleReCaptcha, withGoogleReCaptcha } from 'react-google-recaptcha-v3'; import { sendLeasingOrder } from "../../../actions"; -export default class FormRequest extends React.Component +class FormContent extends React.Component { constructor(props) { @@ -14,6 +16,7 @@ export default class FormRequest extends React.Component company: "", accept: true, success: false, + fail: false, leasing_form_submitting: false, errors: {}, }; @@ -70,18 +73,36 @@ export default class FormRequest extends React.Component if(accept && !leasing_form_submitting && this.checkErrors()) { + const { executeRecaptcha } = this.props.googleReCaptchaProps; + this.setState({ leasing_form_submitting: true }, () => { - sendLeasingOrder(this.state) - .then(() => + executeRecaptcha() + .then((token) => { - this.setState({ leasing_form_submitting: false, success: true }); + sendLeasingOrder({ ...this.state, ...{ recaptcha_token: token } }) + .then(() => + { + this.setState({ leasing_form_submitting: false, success: true, fail: false }); + }) + .catch((response) => + { + if(response.message === "recaptcha_error") + { + this.setState({ leasing_form_submitting: false, success: false, fail: true }); + } + else + { + this.setState({ leasing_form_submitting: false, success: false, fail: false }); + } + }); }) - .catch(() => + .catch((error) => { - this.setState({ leasing_form_submitting: false, success: false }); + console.error("error", error); + this.setState({ leasing_form_submitting: false }); }); - }); + }); } } @@ -122,7 +143,7 @@ export default class FormRequest extends React.Component render() { - const { name, phone, email, company, accept, success, errors } = this.state; + const { name, phone, email, company, accept, success, fail, errors, leasing_form_submitting } = this.state; return (
@@ -132,8 +153,8 @@ export default class FormRequest extends React.Component

Напишите на buy@evoleasing.ru или заполните форму

-
this._onFormSubmit(event) }> - { !success ? ( + this._onFormSubmit(event) } style={ !fail ? {} : { backgroundColor: "#2C2D2E" }}> + { !success ? !fail ? ( <>
this._handle_onChange_name(event.target.value) }/> @@ -151,7 +172,17 @@ export default class FormRequest extends React.Component this._handle_onChange_accept(event.target.checked) }/>
- + +
защита от спама reCAPTCHA
Конфиденциальность - Условия использования
+ + ) : (<> +
+

Сожалеем, запросы, отправляемые с Вашего устройства похожи на автоматические. Пожалуйста, воспользуйтесь другим браузером/подключением или попробуйте позднее.

+
) : (
@@ -164,4 +195,60 @@ export default class FormRequest extends React.Component
) } -} \ No newline at end of file +} + +export const FormContentWithRecaptcha = withGoogleReCaptcha(FormContent); + +export default class FormRequest extends React.Component +{ + constructor(props) + { + super(props); + this.state = { + }; + } + + render() + { + return ( + + + + ) + } +} + +/* +export default class FormRequest extends React.Component +{ + constructor(props) + { + super(props); + this.state = { + recaptcha_token: null, + }; + } + + componentDidMount() + { + setTimeout(() => + { + this.setState({ recaptcha_token: null }); + }, 120000); + } + + render() + { + const { recaptcha_token } = this.state; + + return ( + + { recaptcha_token === null && ( + { console.log("GoogleReCaptcha", "token response", token); this.setState({ recaptcha_token: token })} }/> + ) } + + + ) + } +} +*/ \ No newline at end of file diff --git a/pages/contract/change/components/CalculationsList/index.js b/pages/contract/change/components/CalculationsList/index.js index abaf257..e5c949b 100644 --- a/pages/contract/change/components/CalculationsList/index.js +++ b/pages/contract/change/components/CalculationsList/index.js @@ -35,9 +35,17 @@ export default class CalculationsList extends React.Component super(props); this.state = { company: {}, + width: 1920 }; } + componentDidMount() + { + this.setState({ + width: window.innerWidth + }) + } + _handle_onCalculation = (calculation_id) => { //href={ `/contract/${ number }/change/#${ calculation.addcontract_number }` } @@ -50,11 +58,11 @@ export default class CalculationsList extends React.Component dots: false, infinite: false, speed: 500, - slidesToShow: 2.3, - slidesToScroll: 1, + slidesToShow: this.state.width < 1279 ? 1 : 2.3, centerMode: false, - variableWidth: false, - nextArrow: , + variableWidth: this.state.width < 1279 ? true : false, + dragFree: this.state.width < 1279 ? true : false, + nextArrow: , prevArrow: , }; diff --git a/pages/contract/change/components/SignatoriesList/index.js b/pages/contract/change/components/SignatoriesList/index.js index 48e1b93..72c18ce 100644 --- a/pages/contract/change/components/SignatoriesList/index.js +++ b/pages/contract/change/components/SignatoriesList/index.js @@ -34,19 +34,28 @@ export default class SignatoriesList extends React.Component super(props); this.state = { company: {}, + width: 1920 }; } + componentDidMount() + { + this.setState({ + width: window.innerWidth + }) + } + render() { const settings = { dots: false, infinite: false, speed: 500, - slidesToShow: 2.5, - slidesToScroll: 1, + slidesToShow: this.state.width < 1279 ? 1 : 2.5, + centerMode: false, + variableWidth: this.state.width < 1279 ? true : false, + dragFree: this.state.width < 1279 ? true : false, centerMode: false, - variableWidth: false, nextArrow: , prevArrow: , }; diff --git a/pages/maintenance.js b/pages/maintenance.js new file mode 100644 index 0000000..1df5b79 --- /dev/null +++ b/pages/maintenance.js @@ -0,0 +1,56 @@ +import React from "react"; +import Head from "next/head"; + +import MainHeader from "./components/MainHeader"; +import Footer from "./components/Footer"; + +class Page503 extends React.Component +{ + constructor(props) + { + super(props); + this.state = {}; + } + + static getDerivedStateFromProps(nextProps, prevState) + { + return {}; + } + + componentDidMount() {} + + render() + { + return ( + + + ЛК Эволюция автолизинга + + + +
+
+
+
+
+
+

Личный кабинет

+
+
+
+

+ В настоящий момент ведутся технические работы. Если Вам + необходимо получить информацию, пожалуйста, свяжитесь с нами + по телефону: 8 800 333 75 75 +

+
+
+
+
+