diff --git a/app.vue b/app.vue index 43e3a18..ce9b294 100644 --- a/app.vue +++ b/app.vue @@ -6,6 +6,5 @@ import '@/assets/main.scss' - diff --git a/components/modal.vue b/components/modal.vue index 38478a3..79ffee3 100644 --- a/components/modal.vue +++ b/components/modal.vue @@ -7,7 +7,7 @@ import { getName as getTopperName } from './topper'; const config = useRuntimeConfig() const apiBase = config.public.apiBase -const { data: calculatorData } = await apiFetch(`calculator/5/`) +const props = defineProps(['calcData']) const isModalOpen = useState('modal_open', () => false) const lamelle_height = useState('lamelle_height') @@ -122,12 +122,14 @@ const total_colors = computed(() => { `Столбы ${pillar_color.value} ${getColorNameFromRal(pillar_color.value)}`, ] }) + const total_txt = computed(() => { - if (!calculatorData.value) return - const pillar = parseFloat(calculatorData.value.pillar) - const pillar_base = parseFloat(calculatorData.value.pillar_base) - const lamelles_block = parseFloat(calculatorData.value.lamelles_block) - const { discount } = calculatorData.value + const calculatorData = props.calcData as ApiCalcType + if (!calculatorData) return + const pillar = parseFloat(calculatorData.pillar) + const pillar_base = parseFloat(calculatorData.pillar_base) + const lamelles_block = parseFloat(calculatorData.lamelles_block) + const { discount } = calculatorData const sections = section_count.value as number const extra_m = extra_section.value as number * 0.001 diff --git a/components/model/env.vue b/components/model/env.vue index 521b3af..435fdaf 100644 --- a/components/model/env.vue +++ b/components/model/env.vue @@ -32,7 +32,7 @@ onMounted(async () => { const newEnvMap = exrCubeRenderTarget ? exrCubeRenderTarget.texture : null; scene.value.environment = newEnvMap - scene.value.environmentIntensity = 1 + scene.value.environmentIntensity = 0.7 scene.value.environmentRotation.z = 0.25 result.renderTarget.texture.dispose(); }) diff --git a/nuxt.config.ts b/nuxt.config.ts index e6328bf..26d178b 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -25,7 +25,7 @@ export default defineNuxtConfig({ ], runtimeConfig: { public: { - apiBase: 'https://mns.kustarshina.ru/kp', + apiBase: process.env.mode == 'DEVELOPMENT' ? "http://localhost:8000" : "https://mns.kustarshina.ru/kp", imgBase: 'https://mns.kustarshina.ru', baseUrl: '', yandexMetrika: { diff --git a/pages/index.vue b/pages/index.vue index 372cf5e..ee50051 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -21,7 +21,10 @@ const { data: menuData } = await apiFetch(`menu/1/?ordering=order`) const pagesData = menuData.value ? menuData.value.pages : [] const { data: reviewsData } = await apiFetch(`review/`) -const { data: calculatorData } = await apiFetch(`calculator/5/`) + +const { data: calculators } = await apiFetch('calculator') +const openTab = ref() +if (calculators.value?.length) openTab.value = calculators.value[0].id const about = pagesData.find(el => el.slug == 'about') const reviews = pagesData.find(el => el.slug == 'clients') @@ -37,13 +40,17 @@ const aboutText = computed(() => marked.parse(about?.content || '')) const deliveryText = computed(() => delivery?.content.split('[col]').map(el => marked.parse(el || ''))) const advantagesText = computed(() => { let c = advantages?.content || '' - Object.entries(calculatorData.value || {}).map(item => { - c = c.replaceAll(`[${item[0]}]`, roubleSign.format(item[1])) + Object.entries(calculators.value?.find(el => el.id == openTab.value) || {}).map(item => { + c = c.replaceAll(`[${item[0]}]`, roubleSign.format(item[1] as number)) }) return marked.parse(c) }) const { data: advData } = await apiFetch(`advantage/`) + +const setCalcData = (id: number) => { + openTab.value = id +} @@ -91,6 +98,21 @@ const { data: advData } = await apiFetch(`advantage/`) + + + + + + {{ item.title }} + + + + + +