diff --git a/assets/main.scss b/assets/main.scss index 31c8153..6c23270 100644 --- a/assets/main.scss +++ b/assets/main.scss @@ -12,6 +12,9 @@ html { body { @apply select-none min-w-80 font-sans; + &.modal-opened { + @apply overflow-hidden; + } } .container { @@ -31,7 +34,7 @@ body { } .logo { - @apply w-full py-4 col-span-4 xl:col-span-2; + @apply w-full py-4 col-span-8 xl:col-span-2; a { @apply flex items-center gap-2; @@ -42,7 +45,7 @@ body { } svg { - @apply text-ioprim inline-block m-0 w-10 h-10; + @apply text-ioprim inline-block m-0 w-10 h-10 min-w-10; } } @@ -72,7 +75,7 @@ body { } &.toggle_visible { - @apply max-xl:flex max-xl:flex-col max-xl:text-center; + @apply max-xl:flex max-xl:flex-col max-xl:text-left; a { @apply max-xl:mb-2; @@ -86,7 +89,7 @@ body { } &-toggle { - @apply flex xl:hidden col-span-8 justify-end; + @apply flex xl:hidden col-span-4 justify-end; >span { @apply cursor-pointer text-zinc-600 hover:text-ioprim-900 transition-colors; @@ -196,7 +199,7 @@ a[href^="#"] { } &-title { - @apply col-span-full text-4xl xl:text-6xl font-black font-h1 leading-[0.85] tracking-tight mb-[3.15rem] + @apply col-span-full text-4xl xl:text-6xl font-black font-h1 xl:leading-[0.85] tracking-tight mb-[3.15rem] } &-image { @@ -208,15 +211,19 @@ a[href^="#"] { @apply col-span-12 md:col-span-6 xl:col-span-4 grid grid-cols-4 items-center px-4; &-image { - @apply rounded-full size-20 bg-slate-300 overflow-hidden col-span-1; + @apply max-w-full max-h-full aspect-square overflow-hidden col-span-1 pr-4; + + img { + @apply rounded-full bg-slate-300 + } } &-content { - @apply col-span-3 text-end italic; + @apply col-span-3 text-end italic text-sm lg:text-base; } &-title { - @apply col-span-4 font-bold text-lg text-end mt-4; + @apply col-span-4 font-bold text-lg text-end xl:mt-4 mb-4 xl:mb-0; } } @@ -228,7 +235,7 @@ a[href^="#"] { } &-close { - @apply absolute right-4 top-4 text-4xl opacity-50; + @apply absolute right-3 top-3 text-4xl opacity-50; } &-status { @@ -243,8 +250,12 @@ a[href^="#"] { } } + &-content { + @apply max-h-[66vh] overflow-auto; + } + h2 { - @apply px-4; + @apply px-6 text-2xl text-center; } form { @@ -285,7 +296,7 @@ button { } &-item { - @apply flex flex-row gap-4 items-center justify-center flex-wrap xl:flex-nowrap; + @apply flex flex-row gap-4 items-center justify-start xl:justify-center flex-wrap xl:flex-nowrap; label { @apply w-full xl:w-auto; @@ -302,6 +313,10 @@ button { &_checkbox { @apply w-full xl:w-auto flex-row xl:flex-initial flex-nowrap } + + input[type=range] { + @apply min-w-[calc(100%-8rem)] xl:min-w-min; + } } } diff --git a/components/calcModels.vue b/components/calcModels.vue index f19a2f5..5689f78 100644 --- a/components/calcModels.vue +++ b/components/calcModels.vue @@ -23,7 +23,6 @@ const cameraStat = reactive({ }) const pointLight = ref() -const pointLight2 = ref() const loadAll = async () => { const { scene: light } = await useGLTF('/models_light/zabor_so_svetom.glb') pointLight.value = light.children[2] @@ -35,7 +34,7 @@ const loadAll = async () => { pointLight.value.shadow.mapSize.x = 512 * j pointLight.value.shadow.mapSize.y = 512 * j - const k = 5 + const k = 3 pointLight.value.position.x = pointLight.value.position.x * k pointLight.value.position.y = pointLight.value.position.y * k pointLight.value.position.z = pointLight.value.position.z * k @@ -62,7 +61,7 @@ watch([section_count, extra_section], () => { - + diff --git a/components/calcValues.vue b/components/calcValues.vue index b8abffd..a2306ee 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, @@ -43,6 +49,7 @@ const form_state = reactive({ auto_length: true, remove_pillar: false }) +let copy_form_state = Object.assign({}, form_state) const form_refs = { length: ref(), height: ref(), @@ -50,9 +57,8 @@ const form_refs = { } const changeParametres = () => { - if (form_state.total_length * 1000 < parametric.length.min) { - return - } + // 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) for (const key in form_state) { @@ -67,18 +73,16 @@ const changeParametres = () => { } } - if (form_state.total_length_mm < form_state.length) { - 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 length = parseFloat(length.toString()) + if (total_length_mm < parametric.length.min) total_length_mm = parametric.length.min if (auto_length) { let w = parametric.length.min const max_sections = Math.floor((total_length_mm - fence_length) / (parametric.length.min + fence_length)) - const min_sections = Math.floor((total_length_mm - fence_length) / (parametric.length.max + fence_length)) + const min_sections = Math.floor((total_length_mm - fence_length) / (parametric.length.max + fence_length)) || 1 for (let index = min_sections; index <= max_sections; index++) { full_sections = index @@ -106,8 +110,10 @@ 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) total_length.value = form_state.total_length lamelles_count.value = lamelles @@ -125,17 +131,12 @@ const setLamelleColor = (color: ralTypes) => { const setPillarColor = (color: ralTypes) => { pillar_color.value = color } -watch(form_state, changeParametres, { deep: true }) +watch(() => form_state, changeParametres, { deep: true }) const isModalOpen = useState('modal_open', () => false) const toggleModal = () => { isModalOpen.value = !isModalOpen.value } -const plurals = { - lamelle: { one: 'ламель', few: 'ламели', many: 'ламелей' }, - fence: { one: 'cтолб', few: 'столба', many: 'столбов' }, - section: { one: 'секция', few: 'секции', many: 'секций' }, -} const goal = (target: string, params: object) => { const nuxtApp = useNuxtApp() if (nuxtApp.$metrika) { @@ -146,23 +147,23 @@ const goal = (target: string, params: object) => { - + diff --git a/components/modal.vue b/components/modal.vue index 76e2c70..a43fd0b 100644 --- a/components/modal.vue +++ b/components/modal.vue @@ -36,7 +36,7 @@ const modal_data = reactive({ email: undefined, phone: undefined, name: undefined, - policy: true + policy: false }) const modal_form = reactive({ @@ -75,6 +75,13 @@ const validate = () => { } } watch(modal_data, validate) +watch(isModalOpen, () => { + if (isModalOpen.value == true) { + document.body.classList.add('modal-opened') + } else { + document.body.classList.remove('modal-opened') + } +}) const submit = async (e: any) => { goal('submit_form', modal_data) @@ -208,7 +215,7 @@ const policy = () => {