Update pages.html
Browse files- pages.html +104 -144
pages.html
CHANGED
@@ -429,157 +429,117 @@ z-index: 1000; /* Убедитесь, что кнопка находится п
|
|
429 |
</script>
|
430 |
|
431 |
<script>
|
432 |
-
// Создаем
|
433 |
-
|
434 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
435 |
model: {
|
436 |
defaults: {
|
437 |
-
// HTML-код формы
|
438 |
-
content: `
|
439 |
-
<div class="container">
|
440 |
-
<form id="contactForm">
|
441 |
-
<h4>КЛУБ-ПРАКТИК. 255 техник для психолога - 2024</h4>
|
442 |
-
<div class="form-group">
|
443 |
-
<label for="name">Имя</label>
|
444 |
-
<input type="text" id="name" required>
|
445 |
-
</div>
|
446 |
-
<div class="form-group">
|
447 |
-
<label for="email">Почта</label>
|
448 |
-
<input type="email" id="email" required>
|
449 |
-
</div>
|
450 |
-
<div class="form-group">
|
451 |
-
<label for="phone">Телефон</label>
|
452 |
-
<input type="tel" id="phone" required>
|
453 |
-
</div>
|
454 |
-
<div class="form-group">
|
455 |
-
<label for="options">Выберите тариф</label>
|
456 |
-
<select id="options" required>
|
457 |
-
<option value="" disabled selected>Тариф</option>
|
458 |
-
<option>БИЗНЕС - 69 970р.</option>
|
459 |
-
<option>PREMIUM - 89 970р.</option>
|
460 |
-
<option>VIP - 149 990р.</option>
|
461 |
-
</select>
|
462 |
-
</div>
|
463 |
-
<div class="form-check">
|
464 |
-
<input type="checkbox" id="newsletter" required>
|
465 |
-
<label for="newsletter">Согласие на email рассылку</label>
|
466 |
-
</div>
|
467 |
-
<div class="form-group">
|
468 |
-
<a href="#" id="privacyPolicyLink">Политика конфиденциальности</a>
|
469 |
-
</div>
|
470 |
-
<button type="submit" class="btn-primary">ПЕРЕЙТИ К ОПЛАТЕ</button>
|
471 |
-
</form>
|
472 |
-
<div id="privacyModal" class="modal">
|
473 |
-
<div class="modal-content">
|
474 |
-
<span class="close">×</span>
|
475 |
-
</div>
|
476 |
-
</div>
|
477 |
-
</div>
|
478 |
-
`,
|
479 |
-
// Скрипт для обработки отправки формы
|
480 |
-
script: function(props) {
|
481 |
-
const form = this.querySelector('#contactForm');
|
482 |
-
form.addEventListener('submit', function(event) {
|
483 |
-
event.preventDefault();
|
484 |
-
const data = new URLSearchParams();
|
485 |
-
data.append('name', document.getElementById('name').value);
|
486 |
-
data.append('email', document.getElementById('email').value);
|
487 |
-
data.append('phone', document.getElementById('phone').value);
|
488 |
-
data.append('options', document.getElementById('options').value);
|
489 |
-
data.append('newsletter', document.getElementById('newsletter').checked);
|
490 |
-
// Добавляем данные VK API
|
491 |
-
if (sid_user) {
|
492 |
-
data.append('vk_user_id', sid_user);
|
493 |
-
}
|
494 |
-
if (!props.submitUrl) {
|
495 |
-
console.error('Submit URL is not defined');
|
496 |
-
return;
|
497 |
-
}
|
498 |
-
console.log('Form Data:', data.toString()); // Выводим данные формы в консоль
|
499 |
-
console.log('Submit URL:', props.submitUrl); // Выводим URL в консоль
|
500 |
-
fetch(props.submitUrl + '&api=1&uid=' + sid_user, {
|
501 |
-
method: 'POST',
|
502 |
-
headers: {
|
503 |
-
'Content-Type': 'application/x-www-form-urlencoded'
|
504 |
-
},
|
505 |
-
body: data.toString()
|
506 |
-
})
|
507 |
-
.then(response => {
|
508 |
-
console.log('Ответ сервера:', response); // Проверка ответа сервера
|
509 |
-
if (!response.ok) {
|
510 |
-
throw new Error('Ошибка HTTP: ' + response.status);
|
511 |
-
}
|
512 |
-
return response.json();
|
513 |
-
})
|
514 |
-
.then(data => {
|
515 |
-
console.log('Данные от сервера:', data); // Вывод ответа сервера в консоль
|
516 |
-
if (data.redirect) {
|
517 |
-
window.location.href = data.redirect;
|
518 |
-
}
|
519 |
-
})
|
520 |
-
.catch(error => {
|
521 |
-
console.error('Error:', error);
|
522 |
-
});
|
523 |
-
});
|
524 |
-
},
|
525 |
-
// Свойства, которые будут передаваться в скрипт
|
526 |
-
'script-props': ['submitUrl'],
|
527 |
-
// Настройки для изменения URL отправки
|
528 |
traits: [
|
529 |
{
|
530 |
type: 'text',
|
531 |
-
name: '
|
532 |
-
label: '
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
|
|
|
|
|
|
|
|
538 |
});
|
539 |
-
|
540 |
-
editor.
|
541 |
-
|
542 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
543 |
});
|
544 |
-
|
545 |
-
editor.
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
console.log(data);
|
572 |
-
sid_user = (data.id);
|
573 |
-
vk_ides = (data.id);
|
574 |
-
vk_photos1 = (data.photo_100);
|
575 |
-
hashs = (location.hash);
|
576 |
-
console.log(location.hash);
|
577 |
-
console.log(vk_photos1);
|
578 |
-
})
|
579 |
-
.catch(error => {
|
580 |
-
console.error('Error:', error);
|
581 |
-
});
|
582 |
-
};
|
583 |
});
|
584 |
// Добавление кнопки для открытия редактора кода
|
585 |
const pn = editor.Panels;
|
|
|
429 |
</script>
|
430 |
|
431 |
<script>
|
432 |
+
// Создаем блок формы
|
433 |
+
editor.Blocks.add('custom-form', {
|
434 |
+
label: 'Custom Form',
|
435 |
+
content: `
|
436 |
+
<div class="container">
|
437 |
+
<form id="contactForm">
|
438 |
+
<h4>КЛУБ-ПРАКТИК. 255 техник для психолога - 2024</h4>
|
439 |
+
<div class="form-group">
|
440 |
+
<label for="name">Имя</label>
|
441 |
+
<input type="text" id="name" required>
|
442 |
+
</div>
|
443 |
+
<div class="form-group">
|
444 |
+
<label for="email">Почта</label>
|
445 |
+
<input type="email" id="email" required>
|
446 |
+
</div>
|
447 |
+
<div class="form-group">
|
448 |
+
<label for="phone">Телефон</label>
|
449 |
+
<input type="tel" id="phone" required>
|
450 |
+
</div>
|
451 |
+
<div class="form-group">
|
452 |
+
<label for="options">Выберите тариф</label>
|
453 |
+
<select id="options" required>
|
454 |
+
<option value="" disabled selected>Тариф</option>
|
455 |
+
<option>БИЗНЕС - 69 970р.</option>
|
456 |
+
<option>PREMIUM - 89 970р.</option>
|
457 |
+
<option>VIP - 149 990р.</option>
|
458 |
+
</select>
|
459 |
+
</div>
|
460 |
+
<div class="form-check">
|
461 |
+
<input type="checkbox" id="newsletter" required>
|
462 |
+
<label for="newsletter">Согласие на email рассылку</label>
|
463 |
+
</div>
|
464 |
+
<div class="form-group">
|
465 |
+
<a href="#" id="privacyPolicyLink">Политика конфиденциальности</a>
|
466 |
+
</div>
|
467 |
+
<button type="submit" class="btn-primary">ПЕРЕЙТИ К ОПЛАТЕ</button>
|
468 |
+
</form>
|
469 |
+
<div id="privacyModal" class="modal">
|
470 |
+
<div class="modal-content">
|
471 |
+
<span class="close">×</span>
|
472 |
+
</div>
|
473 |
+
</div>
|
474 |
+
</div>
|
475 |
+
`,
|
476 |
+
});
|
477 |
+
|
478 |
+
// Добавляем возможность настройки каждого элемента формы
|
479 |
+
editor.DomComponents.addType('form-input', {
|
480 |
model: {
|
481 |
defaults: {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
traits: [
|
483 |
{
|
484 |
type: 'text',
|
485 |
+
name: 'placeholder',
|
486 |
+
label: 'Placeholder',
|
487 |
+
},
|
488 |
+
{
|
489 |
+
type: 'checkbox',
|
490 |
+
name: 'required',
|
491 |
+
label: 'Required',
|
492 |
+
},
|
493 |
+
],
|
494 |
+
},
|
495 |
+
},
|
496 |
});
|
497 |
+
|
498 |
+
editor.DomComponents.addType('form-select', {
|
499 |
+
model: {
|
500 |
+
defaults: {
|
501 |
+
traits: [
|
502 |
+
{
|
503 |
+
type: 'text',
|
504 |
+
name: 'options',
|
505 |
+
label: 'Options',
|
506 |
+
},
|
507 |
+
{
|
508 |
+
type: 'checkbox',
|
509 |
+
name: 'required',
|
510 |
+
label: 'Required',
|
511 |
+
},
|
512 |
+
],
|
513 |
+
},
|
514 |
+
},
|
515 |
});
|
516 |
+
|
517 |
+
editor.DomComponents.addType('form-checkbox', {
|
518 |
+
model: {
|
519 |
+
defaults: {
|
520 |
+
traits: [
|
521 |
+
{
|
522 |
+
type: 'checkbox',
|
523 |
+
name: 'required',
|
524 |
+
label: 'Required',
|
525 |
+
},
|
526 |
+
],
|
527 |
+
},
|
528 |
+
},
|
529 |
+
});
|
530 |
+
|
531 |
+
editor.DomComponents.addType('form-button', {
|
532 |
+
model: {
|
533 |
+
defaults: {
|
534 |
+
traits: [
|
535 |
+
{
|
536 |
+
type: 'text',
|
537 |
+
name: 'text',
|
538 |
+
label: 'Button Text',
|
539 |
+
},
|
540 |
+
],
|
541 |
+
},
|
542 |
+
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
543 |
});
|
544 |
// Добавление кнопки для открытия редактора кода
|
545 |
const pn = editor.Panels;
|