forked from mns/mini-skamja
price from 1c
This commit is contained in:
parent
e03889db97
commit
bad63f37e9
|
@ -8,11 +8,19 @@ import yt from '@/assets/icons/youtube.svg'
|
||||||
const icons = {
|
const icons = {
|
||||||
'simple-icons:vk': vk,
|
'simple-icons:vk': vk,
|
||||||
'simple-icons:telegram': tg,
|
'simple-icons:telegram': tg,
|
||||||
'simple-icons:youtube': yt,
|
'simple-icons:youtube': yt
|
||||||
}
|
}
|
||||||
|
|
||||||
const { data: footerData } = await fetchData<Footer[]>(`footer/?ordering=small_text`, true)
|
const { data: footerData } = await fetchData<Footer[]>(
|
||||||
const { data: socialNetworkData } = await fetchData<SocialNetwork[]>(`social_network/`, true)
|
`footer`,
|
||||||
|
{ ordering: 'small_text' },
|
||||||
|
true
|
||||||
|
)
|
||||||
|
const { data: socialNetworkData } = await fetchData<SocialNetwork[]>(
|
||||||
|
`social_network`,
|
||||||
|
{},
|
||||||
|
true
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
@ -26,7 +34,9 @@ const { data: socialNetworkData } = await fetchData<SocialNetwork[]>(`social_net
|
||||||
<div class="col-span-12 lg:col-span-6 xl:col-span-6 mb-12 lg:mb-0">
|
<div class="col-span-12 lg:col-span-6 xl:col-span-6 mb-12 lg:mb-0">
|
||||||
<template v-for="item in footerData">
|
<template v-for="item in footerData">
|
||||||
<div class="footer-text" v-if="!item.small_text">
|
<div class="footer-text" v-if="!item.small_text">
|
||||||
<template v-for="p in item.text.replace(/\r\n/g, '\n').split('\n')">
|
<template
|
||||||
|
v-for="p in item.text.replace(/\r\n/g, '\n').split('\n')"
|
||||||
|
>
|
||||||
<p v-if="p.trim().length">{{ p }}</p>
|
<p v-if="p.trim().length">{{ p }}</p>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
@ -35,11 +45,16 @@ const { data: socialNetworkData } = await fetchData<SocialNetwork[]>(`social_net
|
||||||
<div class="col-span-12 xl:col-span-3">
|
<div class="col-span-12 xl:col-span-3">
|
||||||
<div class="footer-text footer-text-social" v-if="socialNetworkData">
|
<div class="footer-text footer-text-social" v-if="socialNetworkData">
|
||||||
<template v-for="item in socialNetworkData">
|
<template v-for="item in socialNetworkData">
|
||||||
<a :class="['footer-icon', { 'footer-icon-big': !item.icon }]" :href="item.link"
|
<a
|
||||||
target="_blank">
|
:class="['footer-icon', { 'footer-icon-big': !item.icon }]"
|
||||||
|
:href="item.link"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
<template v-if="item.icon">
|
<template v-if="item.icon">
|
||||||
<component :is="icons[(item.icon.trim() as keyof typeof icons)]"
|
<component
|
||||||
v-if="icons.hasOwnProperty(item.icon.trim())" />
|
:is="icons[(item.icon.trim() as keyof typeof icons)]"
|
||||||
|
v-if="icons.hasOwnProperty(item.icon.trim())"
|
||||||
|
/>
|
||||||
<Icon :name="item.icon" v-else />
|
<Icon :name="item.icon" v-else />
|
||||||
</template>
|
</template>
|
||||||
<span class="footer-icon-text">{{ item.name }}</span>
|
<span class="footer-icon-text">{{ item.name }}</span>
|
||||||
|
|
|
@ -4,7 +4,7 @@ import k_logo from '@/assets/LOGO.svg'
|
||||||
const { fetchData } = useApiFetch()
|
const { fetchData } = useApiFetch()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const { data, status, error } = await fetchData<Menu[]>(`menu/`)
|
const { data, status, error } = await fetchData<Menu[]>(`menu`)
|
||||||
const menu = computed(() => {
|
const menu = computed(() => {
|
||||||
const menu = data.value?.find(el => el.type == 1)
|
const menu = data.value?.find(el => el.type == 1)
|
||||||
return (menu?.pages || []).sort((a, b) => a.order - b.order)
|
return (menu?.pages || []).sort((a, b) => a.order - b.order)
|
||||||
|
|
|
@ -5,13 +5,14 @@ export function useApiFetch() {
|
||||||
const apiBase = config.public.apiBase
|
const apiBase = config.public.apiBase
|
||||||
const prefix = config.public.apiPrefix
|
const prefix = config.public.apiPrefix
|
||||||
|
|
||||||
const fetchData = <T>(path: string, global = false) => {
|
const fetchData = <T>(path: string, queryParams: Record<string, any> = {}, global = false) => {
|
||||||
const headers = new Headers()
|
const headers = new Headers()
|
||||||
headers.set('Referer', config.public.baseUrl)
|
headers.set('Referer', config.public.baseUrl)
|
||||||
|
|
||||||
return useFetch<T>(`${apiBase}/${global ? 'gb' : prefix}/${path}`, {
|
return useFetch<T>(`${apiBase}/${global ? 'gb' : prefix}/${path}/`, {
|
||||||
baseURL: config.public.baseUrl,
|
baseURL: config.public.baseUrl,
|
||||||
headers,
|
headers,
|
||||||
|
query: queryParams,
|
||||||
onResponseError({ response }) {
|
onResponseError({ response }) {
|
||||||
console.log(response.status)
|
console.log(response.status)
|
||||||
console.log(response.url)
|
console.log(response.url)
|
||||||
|
|
|
@ -7,7 +7,7 @@ const { fetchData } = useApiFetch()
|
||||||
|
|
||||||
import og_img from '/og_img.png'
|
import og_img from '/og_img.png'
|
||||||
|
|
||||||
const { data: seo } = await fetchData<Seo[]>(`seo/`)
|
const { data: seo } = await fetchData<Seo[]>(`seo`)
|
||||||
useSeoMeta({
|
useSeoMeta({
|
||||||
title: seo.value && seo.value[0].title,
|
title: seo.value && seo.value[0].title,
|
||||||
ogTitle: seo.value && seo.value[0].title,
|
ogTitle: seo.value && seo.value[0].title,
|
||||||
|
|
|
@ -62,11 +62,9 @@ type DiscountType = {
|
||||||
max_quantitt?: number
|
max_quantitt?: number
|
||||||
percent: number
|
percent: number
|
||||||
}
|
}
|
||||||
type ApiCalcType = {
|
type CalcItem = {
|
||||||
id: number
|
id: number
|
||||||
title: string
|
title: string
|
||||||
pillar: string
|
slug: string
|
||||||
pillar_base: string
|
base: number
|
||||||
lamelles_block: string
|
|
||||||
discount: DiscountType[]
|
|
||||||
}
|
}
|
|
@ -7,9 +7,10 @@ import { marked } from 'marked'
|
||||||
|
|
||||||
import og_img from '/og_img.png'
|
import og_img from '/og_img.png'
|
||||||
|
|
||||||
const { data: seo } = await fetchData<Seo[]>(`seo/`)
|
const { data: seo } = await fetchData<Seo[]>(`seo`)
|
||||||
const { data: menu_raw, status: menu_status } = await fetchData<Menu[]>(`menu/`)
|
const { data: menu_raw, status: menu_status } = await fetchData<Menu[]>(`menu`)
|
||||||
const { data: review } = await fetchData<Review[]>(`review/`)
|
const { data: review } = await fetchData<Review[]>(`review`)
|
||||||
|
const { data: calc_data } = await fetchData<CalcItem[]>(`calculator`)
|
||||||
|
|
||||||
useSeoMeta({
|
useSeoMeta({
|
||||||
title: seo.value && seo.value[0].title,
|
title: seo.value && seo.value[0].title,
|
||||||
|
@ -30,6 +31,14 @@ const delivery = computed(() =>
|
||||||
?.content.split('[col]')
|
?.content.split('[col]')
|
||||||
.map(el => marked.parse(el || ''))
|
.map(el => marked.parse(el || ''))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const setCalcData = (txt: string) => {
|
||||||
|
let c = txt
|
||||||
|
;(calc_data.value || []).map(item => {
|
||||||
|
c = c.replaceAll(`[${item.slug}]`, roubleSign.format(item.base))
|
||||||
|
})
|
||||||
|
return marked.parse(c)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
@ -99,7 +108,7 @@ const delivery = computed(() =>
|
||||||
<ModelScene type="bench" />
|
<ModelScene type="bench" />
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-full xl:col-span-4 prose">
|
<div class="col-span-full xl:col-span-4 prose">
|
||||||
<span v-html="marked.parse(page.content || '')"></span>
|
<span v-html="setCalcData(page.content || '')"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -120,7 +129,7 @@ const delivery = computed(() =>
|
||||||
<div class="siteblock bg-white" :id="page.slug">
|
<div class="siteblock bg-white" :id="page.slug">
|
||||||
<div class="container gap-4">
|
<div class="container gap-4">
|
||||||
<div class="col-span-full xl:col-span-8">
|
<div class="col-span-full xl:col-span-8">
|
||||||
<span v-html="marked.parse(page.content || '')"></span>
|
<span v-html="setCalcData(page.content || '')"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-full xl:col-span-4 prose">
|
<div class="col-span-full xl:col-span-4 prose">
|
||||||
<ModelScene type="table" />
|
<ModelScene type="table" />
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
export default new Intl.NumberFormat('ru-RU', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'RUB',
|
||||||
|
});
|
Loading…
Reference in New Issue