bx-935-calc #1

Merged
ksenia_mikhailova merged 15 commits from bx-935-calc into main 2024-07-03 14:57:08 +03:00
6 changed files with 15 additions and 45 deletions
Showing only changes of commit 711cf45819 - Show all commits

View File

@ -17,7 +17,7 @@ const min_length = use_min_length()
const parametric = reactive({ const parametric = reactive({
length: { length: {
min: min_length.value, min: min_length.value,
max: 2400, max: 2466,
step: 1, step: 1,
}, },
total_length: { total_length: {
@ -33,7 +33,7 @@ const parametric = reactive({
}) })
const form_state = reactive({ const form_state = reactive({
length: fence_section.value * 1000, length: fence_section.value * 1000,
fence_length: 100, fence_length: 104,
height: 100 + lamelles_count.value * parametric.height.step, height: 100 + lamelles_count.value * parametric.height.step,
total_length: total_length.value, total_length: total_length.value,
total_length_mm: fence_section.value * 1000, total_length_mm: fence_section.value * 1000,
@ -69,30 +69,29 @@ const changeParametres = () => {
if (form_state.total_length_mm < form_state.length) { if (form_state.total_length_mm < form_state.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 form_state.total_length_mm = form_state.total_length * 1000
const total_without_pillar = form_state.total_length_mm - form_state.fence_length
if (form_state.auto_length) { let { fence_length, total_length_mm, auto_length, length } = form_state
length = parseFloat(length.toString())
if (auto_length) {
let w = parametric.length.min let w = parametric.length.min
const max_sections = Math.ceil(total_without_pillar / parametric.length.min) const max_sections = Math.ceil(total_length_mm / (parametric.length.min + fence_length))
const min_sections = Math.ceil(total_without_pillar / parametric.length.max) const min_sections = Math.ceil(total_length_mm / (parametric.length.max + fence_length))
for (let index = min_sections; index <= max_sections; index++) { for (let index = min_sections; index <= max_sections; index++) {
w = (total_without_pillar / index) + form_state.fence_length w = (total_length_mm - fence_length * (index - 1)) / index
if (w >= parametric.length.min && w <= parametric.length.max) { if (w >= parametric.length.min && w <= parametric.length.max) {
break break
} }
} }
form_state.length = w form_state.length = w
length = w
} }
const section_without_pillar = form_state.length - form_state.fence_length form_state.full_sections = Math.floor((total_length_mm - fence_length) / (length + fence_length))
if (((form_state.full_sections * length) + (form_state.full_sections * fence_length) + fence_length) !== total_length_mm) {
form_state.full_sections = Math.floor(total_without_pillar / section_without_pillar) form_state.extra_section = Math.floor((total_length_mm - fence_length) % form_state.length)
if (section_without_pillar * form_state.full_sections !== form_state.full_sections) {
form_state.extra_section = Math.floor(total_without_pillar % section_without_pillar)
} else { } else {
form_state.extra_section = 0 form_state.extra_section = 0
} }
@ -135,7 +134,7 @@ const plurals = {
<div class="col-span-12 lg:col-span-6"> <div class="col-span-12 lg:col-span-6">
<div class="form-row"> <div class="form-row">
<div class="form-item w-full"> <div class="form-item w-full">
<label for="length">Длина секции, мм</label> <label for="length">Длина ламельного блока, мм</label>
<input disabled :value="`${form_state.length} мм`" class="w-28" /> <input disabled :value="`${form_state.length} мм`" class="w-28" />
<input id="length" type="range" class="w-full" v-bind="parametric.length" <input id="length" type="range" class="w-full" v-bind="parametric.length"
v-model="form_state.length" :disabled="form_state.auto_length" v-model="form_state.length" :disabled="form_state.auto_length"

View File

@ -23,7 +23,7 @@ const { data: calculatorData } = await useFetch(`${apiBase}/calculator/5/`)
const about = (pagesData.value as ApiPagesType[]).find(el => el.slug == 'about') const about = (pagesData.value as ApiPagesType[]).find(el => el.slug == 'about')
const reviews = (pagesData.value as ApiPagesType[]).find(el => el.slug == 'clients') const reviews = (pagesData.value as ApiPagesType[]).find(el => el.slug == 'clients')
const delivery = (pagesData.value as ApiPagesType[]).find(el => el.slug == 'delivery') const delivery = (pagesData.value as ApiPagesType[]).find(el => el.slug == 'how_to')
const advantages = (pagesData.value as ApiPagesType[]).find(el => el.slug == 'advantages') const advantages = (pagesData.value as ApiPagesType[]).find(el => el.slug == 'advantages')
const roubleSign = new Intl.NumberFormat('ru-RU', { const roubleSign = new Intl.NumberFormat('ru-RU', {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

View File

@ -1,29 +0,0 @@
{
"gainMapMax": [
6.139551352398794,
6.139551352398794,
6.139551352398794
],
"gainMapMin": [
0,
0,
0
],
"gamma": [
1,
1,
1
],
"hdrCapacityMax": 6.139551352398794,
"hdrCapacityMin": 0,
"offsetHdr": [
0.015625,
0.015625,
0.015625
],
"offsetSdr": [
0.015625,
0.015625,
0.015625
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 MiB