From 8113c7b45db804ee8bc801e422ba3dffed0b8bae Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Wed, 24 Jul 2024 09:57:11 +0300 Subject: [PATCH 1/5] many sections --- composables/useCalc.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composables/useCalc.ts b/composables/useCalc.ts index ea19ae6..214937f 100644 --- a/composables/useCalc.ts +++ b/composables/useCalc.ts @@ -15,5 +15,5 @@ export const use_section_count = () => useState('section_count', () => n) export const use_extra_section = () => useState('extra_section', () => 0) export const use_total_length = () => useState('total_length', () => (((min + 104) * n) + 104) * 0.001) export const use_min_length = () => useState('min_length', () => 700) -export const use_max_size = () => useState('max_size', () => 13) +export const use_max_size = () => useState('max_size', () => 40) export const use_explosion_state = () => useState('explosion_state', () => false) \ No newline at end of file From c6c8b4bd825c768d2354976d69a4c5fe054561d5 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Wed, 24 Jul 2024 10:10:51 +0300 Subject: [PATCH 2/5] fix --- components/calcValues.vue | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/components/calcValues.vue b/components/calcValues.vue index 62f213a..1aab197 100644 --- a/components/calcValues.vue +++ b/components/calcValues.vue @@ -67,9 +67,6 @@ const changeParametres = () => { } } - if (!form_state.auto_length && (form_state.length > form_state.total_length_mm)) { - form_state.length = form_state.total_length_mm - } form_state.total_length_mm = form_state.total_length * 1000 let { fence_length, total_length_mm, auto_length, length, full_sections } = form_state @@ -107,8 +104,8 @@ const changeParametres = () => { } form_state.full_sections = full_sections - form_state.length = length - form_state.fence_length = fence_length + form_state.length = typeof length == 'string' ? parseFloat(length) : length + form_state.fence_length = typeof fence_length == 'string' ? parseFloat(fence_length) : fence_length copy_form_state = Object.assign({}, form_state) @@ -159,7 +156,7 @@ const goal = (target: string, params: object) => {
- +
From a9daee022c9c3770d7443d24b39359f0fcd83348 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Wed, 24 Jul 2024 10:11:57 +0300 Subject: [PATCH 3/5] predef random pair --- composables/useCalc.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/composables/useCalc.ts b/composables/useCalc.ts index 214937f..c8badf7 100644 --- a/composables/useCalc.ts +++ b/composables/useCalc.ts @@ -5,12 +5,13 @@ export const predefLamelleColors = ['3009', '9003', '6027', '5024', '9001', '101 const n = 2 const min = 1300 +const random_pair = Math.floor(Math.random() * predefPillarColors.length) export const use_lamelle_height = () => useState('lamelle_height', () => 0.115) export const use_lamelles_count = () => useState('lamelles_count', () => 14) export const use_fence_section = () => useState('fence_section', () => min * 0.001) export const use_remove_pillar = () => useState('remove_pillar', () => false) -export const use_pillar_color = () => useState('pillar_color', () => predefPillarColors[Math.floor(Math.random() * predefPillarColors.length)] as ralTypes) -export const use_lamelle_color = () => useState('lamelle_color', () => predefLamelleColors[Math.floor(Math.random() * predefLamelleColors.length)] as ralTypes) +export const use_pillar_color = () => useState('pillar_color', () => predefPillarColors[random_pair] as ralTypes) +export const use_lamelle_color = () => useState('lamelle_color', () => predefLamelleColors[random_pair] as ralTypes) export const use_section_count = () => useState('section_count', () => n) export const use_extra_section = () => useState('extra_section', () => 0) export const use_total_length = () => useState('total_length', () => (((min + 104) * n) + 104) * 0.001) From c03b6dc69b3e6cce5faf818b9e42e9da9f13879c Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Wed, 24 Jul 2024 10:22:00 +0300 Subject: [PATCH 4/5] predef color --- components/calcValues.vue | 11 +++++++++-- composables/useCalc.ts | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/components/calcValues.vue b/components/calcValues.vue index 1aab197..ac898c3 100644 --- a/components/calcValues.vue +++ b/components/calcValues.vue @@ -15,6 +15,12 @@ const extra_section = use_extra_section() const total_length = use_total_length() const min_length = use_min_length() +if (!pillar_color.value) { + const r = Math.floor(Math.random() * predefPillarColors.length) + pillar_color.value = predefPillarColors[r] as ralTypes + lamelle_color.value = predefLamelleColors[r] as ralTypes +} + const parametric = reactive({ length: { min: min_length.value, @@ -130,7 +136,7 @@ watch(() => form_state, changeParametres, { deep: true }) const isModalOpen = useState('modal_open', () => false) const toggleModal = () => { isModalOpen.value = !isModalOpen.value - if(isModalOpen.value == true) { + if (isModalOpen.value == true) { document.body.classList.add('modal-opened') } else { document.body.classList.remove('modal-opened') @@ -187,7 +193,8 @@ const goal = (target: string, params: object) => {

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

Внимание! Дополнительная секция приводит к увеличению стоимости. diff --git a/composables/useCalc.ts b/composables/useCalc.ts index c8badf7..c11aef2 100644 --- a/composables/useCalc.ts +++ b/composables/useCalc.ts @@ -5,13 +5,13 @@ export const predefLamelleColors = ['3009', '9003', '6027', '5024', '9001', '101 const n = 2 const min = 1300 -const random_pair = Math.floor(Math.random() * predefPillarColors.length) + export const use_lamelle_height = () => useState('lamelle_height', () => 0.115) export const use_lamelles_count = () => useState('lamelles_count', () => 14) export const use_fence_section = () => useState('fence_section', () => min * 0.001) export const use_remove_pillar = () => useState('remove_pillar', () => false) -export const use_pillar_color = () => useState('pillar_color', () => predefPillarColors[random_pair] as ralTypes) -export const use_lamelle_color = () => useState('lamelle_color', () => predefLamelleColors[random_pair] as ralTypes) +export const use_pillar_color = () => useState('pillar_color') +export const use_lamelle_color = () => useState('lamelle_color') export const use_section_count = () => useState('section_count', () => n) export const use_extra_section = () => useState('extra_section', () => 0) export const use_total_length = () => useState('total_length', () => (((min + 104) * n) + 104) * 0.001) From 75602e5166c91e3b62a7865c420f0bb6921a2f52 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Wed, 24 Jul 2024 10:27:57 +0300 Subject: [PATCH 5/5] calc min length --- components/calcValues.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/calcValues.vue b/components/calcValues.vue index ac898c3..7e2a7df 100644 --- a/components/calcValues.vue +++ b/components/calcValues.vue @@ -57,7 +57,7 @@ const form_refs = { } const changeParametres = () => { - // console.log(form_state.total_length * 1000, copy_form_state.total_length * 1000) + // console.log('form', form_state.total_length * 1000, 'copy', copy_form_state.total_length * 1000) const lamelles = Math.floor(form_state.height / parametric.height.step) @@ -188,7 +188,7 @@ const goal = (target: string, params: object) => {

-