-
+
-
+
-
+
-
+
-
+
@@ -97,7 +64,7 @@ export default {
}
},
- data () {
+ data() {
return {
name: '',
email: '',
@@ -107,11 +74,11 @@ export default {
},
computed: {
- submitDisabled () {
+ submitDisabled() {
return this.name.length < 1 || this.contact.length < 6
},
- utm () {
+ utm() {
const { query } = this.$route
const res = {}
@@ -125,10 +92,69 @@ export default {
},
methods: {
- onSubmit () {
- // eslint-disable-next-line no-undef
- ym(45245817, 'reachGoal', 'zayavka')
+ handleSubmit(evt) {
+ evt.preventDefault();
+
+ const form = evt.target;
+ const data = new FormData(form);
+
+ leadgets('lead', data, (response) => {
+ if (response.status === 1) {
+ ym(45245817, 'reachGoal', 'zayavka');
+
+ this.name = '';
+ this.email = '';
+ this.contact = '';
+ this.text = '';
+
+ this.isSubmitted = true;
+ }
+ });
}
+ },
+
+ mounted() {
+ // Подключение сервиса leadgets
+ (function () {
+ const leadgets = window.leadgets = window.leadgets || function () {
+ (leadgets.q = leadgets.q || []).push(arguments);
+ };
+ const cdnUrl = 'https://cdn.leadgets.ru/';
+ const scriptVersion = 'v1.js';
+
+ const elements = {
+ link: [{
+ href: cdnUrl,
+ rel: "dns-prefetch"
+ },
+ {
+ href: cdnUrl,
+ rel: "preconnect"
+ },
+ {
+ href: cdnUrl + scriptVersion,
+ as: "script",
+ rel: "preload"
+ }
+ ],
+ script: [{
+ src: cdnUrl + scriptVersion,
+ async: true
+ }]
+ };
+
+ for (const [tagName, tagValues] of Object.entries(elements)) {
+ for (const tagAttributes of tagValues) {
+ const element = document.createElement(tagName);
+ for (const [attribute, value] of Object.entries(tagAttributes)) {
+ element.setAttribute(attribute, value);
+ }
+ document.head.appendChild(element);
+ }
+ }
+
+ leadgets('init', '9d0984a073794a76b3b6c13fbed6cd67');
+ })();
}
}
@@ -146,11 +172,9 @@ export default {
overflow: hidden;
&::before {
- background-image: linear-gradient(
- to right,
- $link-color 0%,
- $dark-blue 100%
- );
+ background-image: linear-gradient(to right,
+ $link-color 0%,
+ $dark-blue 100%);
content: '';
display: block;
position: absolute;
@@ -207,4 +231,4 @@ export default {
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
}
-
+
\ No newline at end of file