dev #60

Merged
ksenia_mikhailova merged 48 commits from dev into main 2024-07-26 10:41:38 +03:00
18 changed files with 456 additions and 2327 deletions

View File

@ -12,5 +12,5 @@ RUN npm install --omit=dev
COPY . /src
RUN npm run build
CMD npm run preview -- --host
# CMD node .output/server/index.mjs
# CMD npm run preview -- --host
CMD export $(cat .env | egrep -v '#|^$' | xargs) && node .output/server/index.mjs

View File

@ -12,6 +12,7 @@ html {
body {
@apply select-none min-w-80 font-sans;
&.modal-opened {
@apply overflow-hidden;
}
@ -188,6 +189,10 @@ a[href^="#"] {
>.container {
@apply items-start;
}
a[href^="tel://"] {
@apply whitespace-nowrap
}
}
&-content {
@ -235,7 +240,7 @@ a[href^="#"] {
}
&-close {
@apply absolute right-3 top-3 text-4xl opacity-50;
@apply absolute right-3 top-3 text-4xl opacity-50 cursor-pointer;
}
&-status {

View File

@ -66,8 +66,8 @@ const changeParametres = () => {
const key_p = key as keyof typeof parametric
const key_s = key as keyof typeof form_state
if (parametric[key_p].max) {
if (form_state[key_s] > parametric[key_p].max) {
form_state[key_s] = parametric[key_p].max
if ((form_state[key_s] as number) > parametric[key_p].max) {
(form_state[key_s] as number) = parametric[key_p].max
}
}
}
@ -102,9 +102,14 @@ const changeParametres = () => {
length = total_length_mm - fence_length - fence_length
}
}
if (((full_sections * length) + (full_sections * fence_length) + fence_length) < total_length_mm) {
form_state.extra_section = Math.floor((total_length_mm - fence_length) % length)
const calc_full_section = () => (full_sections * length) + (full_sections * fence_length) + fence_length
let total_length_calc = calc_full_section()
if (Math.round(total_length_mm - total_length_calc) > 0 && Math.round(total_length_mm - total_length_calc) <= fence_length) {
full_sections -= 1
total_length_calc = calc_full_section()
}
if (Math.round(total_length_mm - total_length_calc) > 0) {
form_state.extra_section = total_length_mm - total_length_calc - fence_length
} else {
form_state.extra_section = 0
}
@ -140,7 +145,7 @@ const toggleModal = () => {
const goal = (target: string, params: object) => {
const nuxtApp = useNuxtApp()
if (nuxtApp.$metrika) {
nuxtApp.$metrika.reachGoal(target, params || {})
(nuxtApp.$metrika as any).reachGoal(target, params || {})
}
}
</script>
@ -230,12 +235,13 @@ const goal = (target: string, params: object) => {
</div>
</template>
<template v-if="form_state.extra_section">
<div class="col-span-4 calc_table-maincell">Секции</div>
<div class="col-span-4 calc_table-maincell">Дополнительная секция</div>
<div class="col-span-2 calc_table-maincell">1</div>
<div class="col-span-6 sm:col-span-4">
Ламели, RAL {{ lamelle_color }}, {{ getColorNameFromRal(lamelle_color)?.toLowerCase() }}
</div>
<div class="col-span-3 sm:col-span-1">{{ 1 * lamelles_count }}</div>
<div class="col-span-3 sm:col-span-1">
{{ 1 * lamelles_count }}</div>
<div class="col-span-3 sm:col-span-1">{{
`${parseFloat(form_state.extra_section.toString()).toFixed(2)}\xa0мм` }}</div>
</template>

View File

@ -30,18 +30,15 @@ const loadAll = async () => {
back_light.value = back.children[0]
back_light.value.intensity = back_light.value.intensity * k
back_light.value.shadow.bias = -0.01
// back_light.value.intensity = 250
key_light.value = key.children[0]
key_light.value.intensity = key_light.value.intensity * k
key_light.value.shadow.bias = -0.01
// key_light.value.intensity = 250
key_light.value.cast_shadow = true
secondary_light.value = secondary.children[0]
secondary_light.value.intensity = secondary_light.value.intensity * k
secondary_light.value.shadow.bias = -0.01
// secondary_light.value.intensity = 50
}
const changeDistance = (v = 1) => {
@ -63,7 +60,7 @@ onMounted(() => {
Загрузка 3D модели
</div>
</template>
<TresCanvas height="600" preset="realistic">
<TresCanvas height="600">
<TresPerspectiveCamera :position="[-7, 2, 4]" ref="camera" />
<OrbitControls v-bind="controlsState" ref="controls" make-default />
<Suspense>
@ -76,7 +73,7 @@ onMounted(() => {
:position="[key_light.position.x, key_light.position.y, key_light.position.z]" />
<TresPointLight v-bind="secondary_light" v-if="secondary_light"
:position="[secondary_light.position.x, secondary_light.position.y, secondary_light.position.z]" />
<TresAmbientLight :intensity="2" />
<!-- <TresAmbientLight :intensity="2" /> -->
</TresCanvas>
</ClientOnly>
<div class="canvas-icons">

View File

@ -26,7 +26,7 @@ const { data: social_networkData } = await apiFetch<ApiSocial_networkType[]>(`so
<div class="col-span-12 lg:col-span-6 xl:col-span-6 mb-12 lg:mb-0">
<template v-for="item in footerData">
<div class="footer-text" v-if="!item.small_text">
<template v-for="p in item.text.split('\n')">
<template v-for="p in item.text.replace(/\r\n/g, '\n').split('\n')">
<p v-if="p.trim().length">{{ p }}</p>
</template>
</div>

View File

@ -238,10 +238,7 @@ const policy = () => {
<template v-else>
<h2>данные расчета</h2>
<div class="flex gap-4 flex-col mb-4 modal-content">
<p>Общая длина: {{ total_length }}<br />
Ламелей: {{ lamelles_count }}<br />
Длина секции: {{ (fence_section * 1000).toFixed(0) }}<br />
Секций: {{ section_count }}<br />
<p>Общая длина: {{ total_length }} м<br />
Цвет столба: {{ getColorNameFromRal(pillar_color) }}<br />
Цвет ламелей: {{ getColorNameFromRal(lamelle_color) }}
</p>
@ -252,7 +249,8 @@ const policy = () => {
</template>
</div>
<div class="flex gap-4 justify-center">
<button class="not-prose" @click="openForm">Отправить расчет на <nobr>e-mail</nobr></button>
<button class="not-prose" @click="openForm">Отправить расчет на <span
class="whitespace-nowrap">e-mail</span></button>
</div>
</template>
</div>

View File

@ -14,12 +14,12 @@ const targetExplosion = {
verh: [0 * k, 0.25 * k, 0 * k],
}
const { scene: kosynka } = await useGLTF('/models/kosynka.glb', { draco: true })
const { scene: krepleniye_planok } = await useGLTF('/models/krepleniye_planok.glb', { draco: true })
const { scene: osnova_stolba } = await useGLTF('/models/osnova_stolba.glb', { draco: true })
const { scene: planki } = await useGLTF('/models/planki.glb', { draco: true })
const { scene: stolb } = await useGLTF('/models/stolb.glb', { draco: true })
const { scene: verh } = await useGLTF('/models/verh.glb', { draco: true })
const { scene: kosynka } = await useGLTF('/models/kosynka.glb')
const { scene: krepleniye_planok } = await useGLTF('/models/krepleniye_planok.glb')
const { scene: osnova_stolba } = await useGLTF('/models/osnova_stolba.glb')
const { scene: planki } = await useGLTF('/models/planki.glb')
const { scene: stolb } = await useGLTF('/models/stolb.glb')
const { scene: verh } = await useGLTF('/models/verh.glb')
const lamelle_color = use_lamelle_color()
const pillar_color = use_pillar_color()
@ -29,12 +29,15 @@ set_material(planki, getColorHexFromRal(lamelle_color.value));
</script>
<template>
<TresGroup :position-y="-3.5" :scale="2">
<ModelItem :model="kosynka" :target="explosion_state ? targetExplosion.kosynka : [0, 0, 0]" />
<ModelItem :model="krepleniye_planok" :target="explosion_state ? targetExplosion.krepleniye_planok : [0, 0, 0]" />
<ModelItem :model="osnova_stolba" />
<ModelItem :model="planki" :target="explosion_state ? targetExplosion.planki : [0, 0, 0]" />
<ModelItem :model="stolb" :target="explosion_state ? targetExplosion.stolb : [0, 0, 0]" />
<ModelItem :model="verh" :target="explosion_state ? targetExplosion.verh : [0, 0, 0]" />
</TresGroup>
<Suspense>
<TresGroup :position-y="-3.5" :scale="2">
<ModelItem :model="kosynka" :target="explosion_state ? targetExplosion.kosynka : [0, 0, 0]" />
<ModelItem :model="krepleniye_planok"
:target="explosion_state ? targetExplosion.krepleniye_planok : [0, 0, 0]" />
<ModelItem :model="osnova_stolba" />
<ModelItem :model="planki" :target="explosion_state ? targetExplosion.planki : [0, 0, 0]" />
<ModelItem :model="stolb" :target="explosion_state ? targetExplosion.stolb : [0, 0, 0]" />
<ModelItem :model="verh" :target="explosion_state ? targetExplosion.verh : [0, 0, 0]" />
</TresGroup>
</Suspense>
</template>

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { useGLTF } from '@tresjs/cientos'
import { Vector3 } from 'three';
import { useGLTF, Text3D } from '@tresjs/cientos'
import { DoubleSide, Object3D, Vector3 } from 'three';
const props = defineProps(['modelUrl', 'model', 'position', 'target', 'parent'])
let scene: any
@ -36,7 +36,19 @@ onLoop(() => {
if (Math.abs(point) >= Math.abs(target.value[element.axis as vectorType])) {
step = 0
}
model.value[element.func](step)
if (model.value !== undefined && model.value[element.func] !== undefined && model.value.__tres) {
try {
model.value[element.func](step)
} catch (error) {
console.log('lvl 1')
try { model.value[element.func](step) } catch {
console.log('lvl 2')
try { model.value[element.func](step) } catch {
console.log('lvl 3')
}
}
}
}
}
}
});
@ -48,10 +60,14 @@ watch(props, () => {
target.value = new Vector3(...props.target)
}
}, { deep: true })
</script>
<template>
<Suspense>
<primitive :object="scene.children[0]" :position="(props.position || [0, 0, 0])" ref="model" />
</Suspense>
<TresGroup ref="model" :position="(props.position || [0, 0, 0])" :scale="1">
<template v-if="scene.children[0].type == 'Group'">
<TresObject3D v-for="item in scene.children[0].children" v-bind="item" />
</template>
<template v-else>
<TresObject3D v-for="item in (scene.children)" v-bind="item" />
</template>
</TresGroup>
</template>

View File

@ -4,10 +4,11 @@ services:
context: ./
dockerfile: Dockerfile
# env_file: ".env"
container_name: mns_mini_zabor_${BRANCH}
container_name: mns_mini_zabor_${BRANCH:-dev}
restart: always
ports:
- "${DOCKER_PORT}:3000"
- "${DOCKER_PORT:-80}:3000"
- "8999:3001"
volumes:
- ./.env:/src/.env
image: ci.svs-tech.pro/mns-mini-zabor:$BRANCH
image: ci.svs-tech.pro/mns-mini-zabor:${BRANCH:-dev}

View File

@ -1,38 +1,7 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
import fs from 'fs/promises'
import chalk from 'chalk';
import imagemin from 'imagemin';
import imageminPngquant from 'imagemin-pngquant';
export default defineNuxtConfig({
hooks: {
'nitro:build:public-assets': async (nitro) => {
console.log(`😈 custom hook imagemin in ${nitro.options.output.publicDir}`)
const output_path = nitro.options.output.publicDir
const filelist = await fs.readdir(output_path, { recursive: true });
for (let index = 0; index < filelist.length; index++) {
const element = filelist[index];
const elementFile = await fs.lstat(`${output_path}/${element}`)
if (element.startsWith('_nuxt')) continue
if (elementFile.isFile()) {
if (element.endsWith('.png')) {
const dest = `${output_path}/${element.split('/').slice(0, -1).join('/')}`
const res = await imagemin([`${output_path}/${element}`], {
destination: dest,
plugins: [
imageminPngquant({
quality: [0.6, 0.8]
})
]
})
if (res.length) {
console.log(chalk.gray(` compress PNG ${output_path}/${element}`))
}
}
}
}
}
},
hooks: {},
app: {
pageTransition: { name: 'page', mode: 'out-in' },
head: {
@ -42,11 +11,6 @@ export default defineNuxtConfig({
},
},
},
vue: {
compilerOptions: {
isCustomElement: (tag) => ['nobr'].includes(tag),
}
},
ssr: true,
modules: [
'@nuxtjs/tailwindcss',
@ -56,6 +20,7 @@ export default defineNuxtConfig({
'@tresjs/nuxt',
'@nuxtjs/robots',
'@artmizu/yandex-metrika-nuxt',
"@nuxtjs/sitemap"
],
runtimeConfig: {
public: {
@ -71,15 +36,17 @@ export default defineNuxtConfig({
'/index.html': { redirect: '/' },
'/index.php': { redirect: '/' },
},
// nitro: {
// prerender: {
// crawlLinks: true
// },
// },
nitro: {
// minify: false,
prerender: {
crawlLinks: false
},
},
vite: {
assetsInclude: ['**/*.glb', '**/*.gltf'],
build: {
minify: 'esbuild'
// minify: 'esbuild'
// minify: false
},
},
robots: {

2604
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -10,17 +10,17 @@
"postinstall": "nuxt prepare"
},
"dependencies": {
"@monogrid/gainmap-js": "^3.0.5",
"@artmizu/yandex-metrika-nuxt": "^1.0.4",
"@monogrid/gainmap-js": "^3.0.5",
"@nuxt/image": "^1.7.0",
"@nuxtjs/robots": "^3.0.0",
"@nuxtjs/robots": "^4.0.0",
"@nuxtjs/sitemap": "^5.3.5",
"@nuxtjs/tailwindcss": "^6.12.0",
"@tailwindcss/typography": "^0.5.13",
"@tresjs/cientos": "^3.9.0",
"@tresjs/core": "^4.0.2",
"@tresjs/nuxt": "^2.1.2",
"imagemin": "^9.0.0",
"imagemin-pngquant": "^10.0.0",
"consola": "^3.2.3",
"marked": "^12.0.2",
"nuxt": "^3.11.2",
"nuxt-icon": "^0.6.10",

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.