11 Commits

Author SHA1 Message Date
nguyen van thai b4aa3e45d1 thainv-dev: Fix emagazine 2024-07-18 17:11:42 +07:00
nguyen van thai a63155a782 thainv-dev: Fix 2024-07-17 14:27:21 +07:00
nguyen van thai 45f21ba187 Fix Footer 2024-07-17 11:00:01 +07:00
nguyen van thai 795cd47e41 thainv-dev: Fix 2024-07-17 10:35:35 +07:00
nguyen van thai 5f9525371d Poll 2024-07-16 22:54:15 +07:00
nguyen van thai 6f571d9549 fix 2024-07-16 13:06:34 +07:00
nguyen van thai 174a596db9 Fix 2024-07-16 11:37:38 +07:00
Duong Truong Phong 5f72a107ce phongdt:add id component 2024-07-16 11:19:46 +07:00
nguyen van thai 5a041acd54 Fix 2024-07-16 09:58:54 +07:00
nguyen van thai 9cc998e0bf Fix 2024-07-16 09:23:44 +07:00
MoreStrive 7565a37d60 feat: create by site 2024-07-15 21:02:22 +07:00
40 changed files with 400 additions and 154 deletions
+5
View File
@@ -208,6 +208,11 @@ div[layout="ARTICLE_PAGE"] {
} }
} }
.emagazine {
h1,h2,h3,h4,h5,h6,span,em {
@apply w-full max-w-660px mx-auto;
}
}
.detail-default { .detail-default {
p { p {
@apply text-18px font-raleway leading-180% my-10px; @apply text-18px font-raleway leading-180% my-10px;
+5 -2
View File
@@ -15,14 +15,14 @@ const store = reactive({
}); });
const { currentPoll } = storeToRefs(store.poll); const { currentPoll } = storeToRefs(store.poll);
const { currentPollOptions } = storeToRefs(store.pollOptions); const { currentPollOptions } = storeToRefs(store.pollOptions);
const { currentPollResponses } = storeToRefs(store.pollResponse); // const { currentPollResponses } = storeToRefs(store.pollResponse);
const poll = reactive<Poll | any>({}); const poll = reactive<Poll | any>({});
const options = ref<PollOption[] | any[]>([]); const options = ref<PollOption[] | any[]>([]);
async function loadData() { async function loadData() {
await store.poll.fetchById(String(props.dataId)); await store.poll.fetchById(String(props.dataId));
await store.pollOptions.fetchByPollId(String(props.dataId)); await store.pollOptions.fetchByPollId(String(props.dataId));
await store.pollResponse.fetchByPollId(String(props.dataId)); // await store.pollResponse.fetchByPollId(String(props.dataId));
assignData(); assignData();
} }
@@ -78,6 +78,8 @@ async function submitVote() {
switch (poll.type) { switch (poll.type) {
case 1: case 1:
if(singleSelect.value >= 0) { if(singleSelect.value >= 0) {
const result = await store.pollResponse.create({ optionId: singleSelect.value })
if(result?.id) {
totalResponses.value = options.value?.reduce((sum, option) => sum + Number(option.responseCount ?? 0), 1); totalResponses.value = options.value?.reduce((sum, option) => sum + Number(option.responseCount ?? 0), 1);
options?.value?.forEach((option: PollOption | any) => { options?.value?.forEach((option: PollOption | any) => {
if (option.id === singleSelect.value) { if (option.id === singleSelect.value) {
@@ -89,6 +91,7 @@ async function submitVote() {
} }
} }
} }
}
</script> </script>
<template> <template>
@@ -7,6 +7,7 @@ const props = defineProps<{
type?: any; // [TOP_NAVIGATION, BOTTOM_NAVIGATION] type?: any; // [TOP_NAVIGATION, BOTTOM_NAVIGATION]
}>(); }>();
const contentParse = computed(() => (currentPage.value.content ? JSON.parse(currentPage.value.content) : {}));
const defineTypeRecusive = { const defineTypeRecusive = {
TOP_NAVIGATION: enumPageComponentLayouts[`${enumPageComponentTemplate[enumPageComponentKey.NAVIGATION]['TOP']}`]['NAVIGATION_TOP_DEFAULT'], TOP_NAVIGATION: enumPageComponentLayouts[`${enumPageComponentTemplate[enumPageComponentKey.NAVIGATION]['TOP']}`]['NAVIGATION_TOP_DEFAULT'],
BOTTOM_NAVIGATION: enumPageComponentLayouts[`${enumPageComponentTemplate[enumPageComponentKey.NAVIGATION]['BOTTOM']}`]['NAVIGATION_BOTTOM_DEFAULT'], BOTTOM_NAVIGATION: enumPageComponentLayouts[`${enumPageComponentTemplate[enumPageComponentKey.NAVIGATION]['BOTTOM']}`]['NAVIGATION_BOTTOM_DEFAULT'],
@@ -16,14 +17,22 @@ const findDataPosition = computed<any>(() => {
let result = {}; let result = {};
switch (props.type) { switch (props.type) {
case defineTypeRecusive.TOP_NAVIGATION: case defineTypeRecusive.TOP_NAVIGATION:
result = currentPage.value.components && currentPage.value.components.find((component: any) => { if (contentParse.value.navigationTop) {
return component.taxonomy === enumPageComponentKey.NAVIGATION && component.settings?.layout === defineTypeRecusive.TOP_NAVIGATION result =
currentPage.value.components &&
currentPage.value.components.find((component: any) => {
return component.id === contentParse.value.navigationTop;
}); });
}
break; break;
case defineTypeRecusive.BOTTOM_NAVIGATION: case defineTypeRecusive.BOTTOM_NAVIGATION:
result = currentPage.value.components && currentPage.value.components.find((component: any) => { if (contentParse.value.navigationBottom) {
return component.taxonomy === enumPageComponentKey.NAVIGATION && component.settings?.layout === defineTypeRecusive.BOTTOM_NAVIGATION result =
currentPage.value.components &&
currentPage.value.components.find((component: any) => {
return component.id === contentParse.value.navigationBottom;
}); });
}
break; break;
default: default:
result = {}; result = {};
@@ -9,6 +9,7 @@ const props = defineProps<{
dataQuery?: any; dataQuery?: any;
layout?: string; layout?: string;
label?: any; label?: any;
component?: any;
}>(); }>();
const LAYOUT_PARSE = computed(() => { const LAYOUT_PARSE = computed(() => {
@@ -51,8 +52,10 @@ const parseData = computed(() => {
</script> </script>
<template> <template>
<article class="card-audio" :class="LAYOUT_PARSE['article_Class']" :style="LAYOUT_PARSE['article']"> <article :id="`cpn_${props.component.id}`" class="card-audio" :class="LAYOUT_PARSE['article_Class']" :style="LAYOUT_PARSE['article']">
<nuxt-link :to="`/bai-viet/${parseData?.slug}`" class="article-thumbnail">
<img :src="parseData?.thumbnail ? parseData?.thumbnail : 'https://indiaeducationdiary.in/wp-content/uploads/2021/02/SD-default-image.png'" :alt="parseData?.title?.replace(/<[^>]+>/g, '')" /> <img :src="parseData?.thumbnail ? parseData?.thumbnail : 'https://indiaeducationdiary.in/wp-content/uploads/2021/02/SD-default-image.png'" :alt="parseData?.title?.replace(/<[^>]+>/g, '')" />
</nuxt-link>
<div class="card-audio__content"> <div class="card-audio__content">
<span class="flex justify-center"> <span class="flex justify-center">
<template v-if="['Image', 'Infographics', 'Emagazine'].includes(type)"> <template v-if="['Image', 'Infographics', 'Emagazine'].includes(type)">
@@ -92,12 +95,18 @@ const parseData = computed(() => {
padding-bottom: calc((16 / 9) * 100%); padding-bottom: calc((16 / 9) * 100%);
overflow: hidden; overflow: hidden;
img { .article-thumbnail {
position: absolute; position: absolute;
height: 100%; height: 100%;
width: 100%; width: 100%;
object-fit: cover;
z-index: 1; z-index: 1;
& img {
width: 100%;
height: 100%;
object-fit: cover;
}
} }
.card-audio__content { .card-audio__content {
@@ -10,6 +10,7 @@ const props = defineProps<{
dataQuery?: any; dataQuery?: any;
layout?: string; layout?: string;
label?: any; label?: any;
component?: any;
}>(); }>();
const LAYOUT_PARSE = computed(() => { const LAYOUT_PARSE = computed(() => {
@@ -27,11 +28,12 @@ const parseData = computed(() => {
<template> <template>
<article <article
v-if="parseData" v-if="parseData"
:id="`cpn_${props.component.id}`"
class="basic-article border-custom" class="basic-article border-custom"
:class="LAYOUT_PARSE['article_Class']" :class="LAYOUT_PARSE['article_Class']"
:style="LAYOUT_PARSE['article']" :style="LAYOUT_PARSE['article']"
> >
<div class="basic-article_thumbnail" :class="LAYOUT_PARSE['thumbnail_Class']" :style="LAYOUT_PARSE['div.basic-article_thumbnail']"> <div class="basic-article_thumbnail article-thumbnail" :class="LAYOUT_PARSE['thumbnail_Class']" :style="LAYOUT_PARSE['div.basic-article_thumbnail']">
<template v-if="parseData"> <template v-if="parseData">
<nuxt-link :to="`${parseData.code}`"> <nuxt-link :to="`${parseData.code}`">
<img class="object-fit-cover" :src="parseData.thumbnail ? parseData.thumbnail : '/images/default-thumbnail.jpg'" :alt="parseData.title?.replace(/<[^>]+>/g, '')" /> <img class="object-fit-cover" :src="parseData.thumbnail ? parseData.thumbnail : '/images/default-thumbnail.jpg'" :alt="parseData.title?.replace(/<[^>]+>/g, '')" />
@@ -55,19 +57,19 @@ const parseData = computed(() => {
<span v-else class="empty-block" style="height: 8px"></span> <span v-else class="empty-block" style="height: 8px"></span>
</h3> </h3>
<div class="article-card-default__bottom" v-if="LAYOUT_PARSE.layout === 'row'"> <div class="article-card-default__bottom" v-if="LAYOUT_PARSE.layout === 'row'">
<span :style="LAYOUT_PARSE['time']" style="margin-right: 5px" :class="LAYOUT_PARSE['time_Class']">{{ <span :style="LAYOUT_PARSE['time']" style="margin-right: 5px" :class="[LAYOUT_PARSE['time_Class'], 'article-time']">{{
formatDate(String(parseData?.createdOn), "DD/MM/YYYY | HH:mm") formatDate(String(parseData?.createdOn), "DD/MM/YYYY | HH:mm")
}}</span> }}</span>
<nuxt-link :style="LAYOUT_PARSE['category-article']" :class="LAYOUT_PARSE['category-article_Class']">{{ parseData?.category?.title }}</nuxt-link> <nuxt-link :style="LAYOUT_PARSE['category-article']" :class="LAYOUT_PARSE['category-article_Class']">{{ parseData?.category?.title }}</nuxt-link>
</div> </div>
<p class="mb-0 line-clamp-5" :class="LAYOUT_PARSE['paragraph_Class']" :style="LAYOUT_PARSE['p.paragraph']"> <p class="mb-0 line-clamp-5 article-intro" :class="LAYOUT_PARSE['paragraph_Class']" :style="LAYOUT_PARSE['p.paragraph']">
<template v-if="parseData"> <template v-if="parseData">
{{ parseData.intro?.replace(/<[^>]+>/g, "") }} {{ parseData.intro?.replace(/<[^>]+>/g, "") }}
</template> </template>
<span v-else class="empty-block" style="height: 5px"></span> <span v-else class="empty-block" style="height: 5px"></span>
</p> </p>
<div class="article-card-default__bottom" v-if="LAYOUT_PARSE?.layout !== 'row'" :style="LAYOUT_PARSE['metadata']"> <div class="article-card-default__bottom" v-if="LAYOUT_PARSE?.layout !== 'row'" :style="LAYOUT_PARSE['metadata']">
<span :style="LAYOUT_PARSE['time']" style="margin-right: 5px" :class="LAYOUT_PARSE['time_Class']">{{ <span :style="LAYOUT_PARSE['time']" style="margin-right: 5px" :class="[LAYOUT_PARSE['time_Class'], 'article-time']">{{
formatDate(String(parseData?.createdOn), "DD/MM/YYYY | HH:mm") formatDate(String(parseData?.createdOn), "DD/MM/YYYY | HH:mm")
}}</span> }}</span>
<nuxt-link :style="LAYOUT_PARSE['category-article']" :class="LAYOUT_PARSE['category-article_Class']">{{ parseData?.category?.title }}</nuxt-link> <nuxt-link :style="LAYOUT_PARSE['category-article']" :class="LAYOUT_PARSE['category-article_Class']">{{ parseData?.category?.title }}</nuxt-link>
@@ -10,6 +10,7 @@ const props = defineProps<{
dataQuery?: any; dataQuery?: any;
layout?: string; layout?: string;
label?: string; label?: string;
component?: any;
}>(); }>();
const LAYOUT_PARSE = computed(() => { const LAYOUT_PARSE = computed(() => {
@@ -44,14 +45,21 @@ const drop = (e: any) => {
</script> </script>
<template> <template>
<article class="basic-article border-custom" :class="LAYOUT_PARSE['article_Class']" :style="LAYOUT_PARSE['article']"> <article :id="`cpn_${props.component.id}`" class="basic-article border-custom" :class="LAYOUT_PARSE['article_Class']" :style="LAYOUT_PARSE['article']">
<div class="article_miss"> <div class="article_miss">
<template v-if="parseData"> <template v-if="parseData">
<nuxt-link :to="`/bai-viet/${parseData.slug}`">
<div class="article_miss_thumb custom-thumb" :style="{ backgroundImage: `url('${parseData.thumbnail ? parseData.thumbnail : '/images/default-thumbnail.jpg'}')` }"></div> <div class="article_miss_thumb custom-thumb" :style="{ backgroundImage: `url('${parseData.thumbnail ? parseData.thumbnail : '/images/default-thumbnail.jpg'}')` }"></div>
</nuxt-link>
<div class="article_miss_content" :style="LAYOUT_PARSE['content']"> <div class="article_miss_content" :style="LAYOUT_PARSE['content']">
<nuxt-link :to="`/bai-viet/${parseData.slug}`">
<h3 class="line-clamp text-white" :class="LAYOUT_PARSE['title_Class']" :style="LAYOUT_PARSE['h3.title']"> <h3 class="line-clamp text-white" :class="LAYOUT_PARSE['title_Class']" :style="LAYOUT_PARSE['h3.title']">
{{ parseData.title?.replace(/<[^>]+>/g, "") }} {{ parseData.title?.replace(/<[^>]+>/g, "") }}
</h3> </h3>
</nuxt-link>
</div> </div>
</template> </template>
<div v-else class="empty-box"></div> <div v-else class="empty-box"></div>
@@ -8,6 +8,7 @@ const props = defineProps<{
dataQuery?: any; dataQuery?: any;
layout?: string; layout?: string;
label?: any; label?: any;
component?: any;
}>(); }>();
const LAYOUT_PARSE = computed(() => { const LAYOUT_PARSE = computed(() => {
@@ -24,6 +25,7 @@ const parseData = computed(() => {
<template> <template>
<article <article
:id="`cpn_${props.component.id}`"
class="basic-article border-custom" class="basic-article border-custom"
:class="LAYOUT_PARSE['article_Class']" :class="LAYOUT_PARSE['article_Class']"
:style="LAYOUT_PARSE['article']" :style="LAYOUT_PARSE['article']"
@@ -12,18 +12,83 @@ console.log(currentArticle.value, 'currentArticle')
</script> </script>
<template> <template>
<div class="overflow-hidden emagazine"> <div class="overflow-hidden emagazine">
<!-- bổ sung sau --> <h2 class="font-gelasio text-center text-44px font-bold leading-130%" v-if="currentArticle?.title" v-html="currentArticle?.title"></h2>
<!-- <img :src="currentArticle.thumbnail" alt="" class="w-full object-cover"> <div class="article-detail" v-html="currentArticle.detail"></div>
<div class="px-44px pb-30px my-30px max-w-660px mx-auto border-b-1px border-#000">
</div> -->
<div v-html="currentArticle.detail"></div>
</div> </div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.breadcrumb {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
&__list {
margin: 0;
padding: 0px;
display: flex;
overflow-x: auto;
gap: 1.5rem;
align-items: center;
font-size: 0.875rem;
line-height: 1.25rem;
&__item {
display: inline-block;
position: relative;
&__title {
margin: 0;
font-size: 18px;
color: #000;
font-weight: 500;
text-transform: uppercase;
line-height: 180%;
}
// &:first-child {
// color: blue;
// }
&:not(:first-child):before {
content: "\\";
position: absolute;
left: -18px;
}
}
}
.article-card-default__topic {
position: relative;
// background-color: #151411;
display: inline-block;
h5 {
font-size: 12px;
display: flex;
align-items: center;
justify-content: center;
text-transform: uppercase;
// color: #fff;
padding: 0 12px;
height: 100%;
margin: 0;
border: 1px solid #000;
line-height: 180%;
font-weight: 300;
}
&::after {
position: absolute;
content: "";
display: block;
width: 12px;
height: 100%;
background-color: #ed1c24;
left: -12px;
top: 0;
}
}
}
.content { .content {
width: auto; width: auto;
} }
@@ -18,13 +18,83 @@ console.log(currentArticle.value, 'currentArticle')
<div class="px-44px pb-30px my-30px max-w-660px mx-auto border-b-1px border-#000"> <div class="px-44px pb-30px my-30px max-w-660px mx-auto border-b-1px border-#000">
</div> --> </div> -->
<h2 class="font-gelasio text-center text-44px font-bold leading-130%" v-if="currentArticle?.title" v-html="currentArticle?.title"></h2>
<div v-html="currentArticle.detail"></div> <div v-html="currentArticle.detail"></div>
</div> </div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
.breadcrumb {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
&__list {
margin: 0;
padding: 0px;
display: flex;
overflow-x: auto;
gap: 1.5rem;
align-items: center;
font-size: 0.875rem;
line-height: 1.25rem;
&__item {
display: inline-block;
position: relative;
&__title {
margin: 0;
font-size: 18px;
color: #000;
font-weight: 500;
text-transform: uppercase;
line-height: 180%;
}
// &:first-child {
// color: blue;
// }
&:not(:first-child):before {
content: "\\";
position: absolute;
left: -18px;
}
}
}
.article-card-default__topic {
position: relative;
// background-color: #151411;
display: inline-block;
h5 {
font-size: 12px;
display: flex;
align-items: center;
justify-content: center;
text-transform: uppercase;
// color: #fff;
padding: 0 12px;
height: 100%;
margin: 0;
border: 1px solid #000;
line-height: 180%;
font-weight: 300;
}
&::after {
position: absolute;
content: "";
display: block;
width: 12px;
height: 100%;
background-color: #ed1c24;
left: -12px;
top: 0;
}
}
}
.center-y { .center-y {
width: auto; width: auto;
} }
@@ -29,7 +29,7 @@ function findElementPathById(categories: any[], targetId: number, path: any[] =
<nuxt-link class="font-raleway text-18px font-500 leading-180% uppercase" :to="`/${category.code}`">{{ category.title }}</nuxt-link> <nuxt-link class="font-raleway text-18px font-500 leading-180% uppercase" :to="`/${category.code}`">{{ category.title }}</nuxt-link>
</li> </li>
</ul> </ul>
<h2 class="font-gelasio text-center text-44px font-bold leading-130%" v-if="currentArticle?.title" v-html="currentArticle?.title"></h2>
<div class="video-content" v-html="currentArticle.detail"></div> <div class="video-content" v-html="currentArticle.detail"></div>
</div> </div>
</template> </template>
@@ -6,6 +6,7 @@ const _props = defineProps<{
dataResult?: any; dataResult?: any;
dataQuery?: string; dataQuery?: string;
label?: any; label?: any;
component?: any;
}>(); }>();
const SETTING_OPTIONS = { const SETTING_OPTIONS = {
@@ -37,7 +38,7 @@ const mapActivesToItems = (index: number) => {
</script> </script>
<template> <template>
<div class="categories-container border-custom" :class="designObject['categories_Class']" :style="designObject['div.categories-container']"> <div :id="`cpn_${_props.component.id}`" class="categories-container border-custom" :class="designObject['categories_Class']" :style="designObject['div.categories-container']">
<div v-for="(component, index) in _dataResult" :key="index" :class="['border-custom', isEmpty(component) ? 'empty' : 'category', designObject['category_Class']]" :style="mapActivesToItems(index)['category']"> <div v-for="(component, index) in _dataResult" :key="index" :class="['border-custom', isEmpty(component) ? 'empty' : 'category', designObject['category_Class']]" :style="mapActivesToItems(index)['category']">
<template v-if="!isEmpty(component)"> <template v-if="!isEmpty(component)">
<div> <div>
@@ -6,6 +6,7 @@ const _props = defineProps<{
dataResult?: any; dataResult?: any;
dataQuery?: string; dataQuery?: string;
label?: any; label?: any;
component?: any;
}>(); }>();
const SETTING_OPTIONS = { const SETTING_OPTIONS = {
@@ -37,7 +38,7 @@ const mapActivesToItems = (index: number) => {
</script> </script>
<template> <template>
<div class="categories-container border-custom flex-wrap" :class="designObject['categories_Class']" :style="designObject['div.categories-container']"> <div :id="`cpn_${_props.component.id}`" class="categories-container border-custom flex-wrap" :class="designObject['categories_Class']" :style="designObject['div.categories-container']">
<div v-for="(component, index) in _dataResult" :key="index" :class="['border-custom', isEmpty(component) ? 'empty' : 'category', designObject['category_Class']]" :style="mapActivesToItems(index)['category']"> <div v-for="(component, index) in _dataResult" :key="index" :class="['border-custom', isEmpty(component) ? 'empty' : 'category', designObject['category_Class']]" :style="mapActivesToItems(index)['category']">
<template v-if="!isEmpty(component)"> <template v-if="!isEmpty(component)">
<div class="category-content"> <div class="category-content">
@@ -10,6 +10,7 @@ const _props = defineProps<{
layout?: string; layout?: string;
label?: any; label?: any;
content?: any; content?: any;
component?: any;
}>(); }>();
const SETTING_OPTIONS = { const SETTING_OPTIONS = {
@@ -46,7 +47,7 @@ const mapActivesToItems = (index: number) => {
</script> </script>
<template> <template>
<div class="collection-container border-custom" :class="[LAYOUT_PARSE['div.collection-container_Class'], LAYOUT_PARSE['collection_Class']]" :style="LAYOUT_PARSE['div.collection-container']"> <div :id="`cpn_${_props.component.id}`" class="collection-container border-custom" :class="[LAYOUT_PARSE['div.collection-container_Class'], LAYOUT_PARSE['collection_Class']]" :style="LAYOUT_PARSE['div.collection-container']">
<DynamicComponent <DynamicComponent
v-for="(component, index) in _dataResult" v-for="(component, index) in _dataResult"
:key="index" :key="index"
@@ -10,6 +10,7 @@ const _props = defineProps<{
layout?: string; layout?: string;
label?: any; label?: any;
content?: any; content?: any;
component?: any;
}>(); }>();
const SETTING_OPTIONS = { const SETTING_OPTIONS = {
@@ -46,7 +47,7 @@ const mapActivesToItems = (index: number) => {
</script> </script>
<template> <template>
<div class="collection-container border-custom overflow-hidden" :class="[LAYOUT_PARSE['div.collection-container_Class'], LAYOUT_PARSE['collection_Class']]" :style="LAYOUT_PARSE['div.collection-container']"> <div :id="`cpn_${_props.component.id}`" class="collection-container border-custom overflow-hidden" :class="[LAYOUT_PARSE['div.collection-container_Class'], LAYOUT_PARSE['collection_Class']]" :style="LAYOUT_PARSE['div.collection-container']">
<DynamicComponent <DynamicComponent
v-for="(component, index) in _dataResult" v-for="(component, index) in _dataResult"
:key="index" :key="index"
@@ -10,6 +10,7 @@ const _props = defineProps<{
layout?: string; layout?: string;
label?: string; label?: string;
content?: any; content?: any;
component?: any;
}>(); }>();
const SETTING_OPTIONS = { const SETTING_OPTIONS = {
@@ -66,10 +67,10 @@ const mapActivesToItems = (index: number) => {
</script> </script>
<template> <template>
<section class="gallery" :class="[LAYOUT_PARSE['div.collection-container_Class'], LAYOUT_PARSE['collection_Class']]" @click="selectComponent" :style="LAYOUT_PARSE['div.collection-container']"> <section :id="`cpn_${_props.component.id}`" class="gallery" :class="[LAYOUT_PARSE['div.collection-container_Class'], LAYOUT_PARSE['collection_Class']]" @click="selectComponent" :style="LAYOUT_PARSE['div.collection-container']">
<div class="wrap" v-for="(component, index) in _dataResult" :key="index"> <div class="wrap" v-for="(component, index) in _dataResult" :key="index">
<DynamicComponent <DynamicComponent
class="abc" class="box"
:settings="{ :settings="{
template: SETTING_OPTIONS.TEMPLATE, template: SETTING_OPTIONS.TEMPLATE,
layout: SETTING_OPTIONS.LAYOUT, layout: SETTING_OPTIONS.LAYOUT,
@@ -141,7 +142,7 @@ const mapActivesToItems = (index: number) => {
padding-top: 241px; padding-top: 241px;
} }
& > .abc { & > .box {
position: absolute; position: absolute;
top: 0; top: 0;
width: 100%; width: 100%;
@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { isEmpty } from "@/utils/lodash"; import { isEmpty } from "@/utils/lodash";
import { nanoid } from "nanoid" import { nanoid } from "nanoid";
import DynamicComponent from "~/components/dynamic-page/page-component/templates/index.vue"; import DynamicComponent from "~/components/dynamic-page/page-component/templates/index.vue";
import RecusiveNavItem from "@/components/dynamic-page/page-component/templates/navigations/components/RecusiveNavItem.vue"; import RecusiveNavItem from "@/components/dynamic-page/page-component/templates/navigations/components/RecusiveNavItem.vue";
import { buildTree } from "@/utils/recusive"; import { buildTree } from "@/utils/recusive";
@@ -15,16 +15,17 @@ const _props = defineProps<{
<div class="px-4 mt-4"> <div class="px-4 mt-4">
<div class="nav-container"> <div class="nav-container">
<template v-if="_props.content"> <template v-if="_props.content">
<div v-for="item, index in buildTree(_props.content)" :key="index" class="nav-items-box"> <div v-for="(item, index) in buildTree(_props.content)" :key="index" class="nav-items-box">
<div class="submenu-container"> <div class="submenu-container">
<h4 class="" >{{ item.title }}</h4> <nuxt-link :to="`/${item.slug}`"
<div class="ml-2"> ><h4 class="font-raleway">{{ item.title }}</h4></nuxt-link
<h5
v-for="_item, _index in item.childs ? item.childs : []"
:key="_index"
> >
<div class="ml-2">
<nuxt-link v-for="(_item, _index) in item.childs ? item.childs : []" :key="_index" :to="`/${_item.slug}`"
><h5 class="font-raleway">
{{ _item.title }} {{ _item.title }}
</h5> </h5></nuxt-link
>
</div> </div>
</div> </div>
</div> </div>
@@ -20,7 +20,7 @@ const setGlobalState = (id: any) => {
<template v-if="record && record.childs && record.childs.length > 0 && record.typeChild === enumPageComponentStaticChild.DEFAULT"> <template v-if="record && record.childs && record.childs.length > 0 && record.typeChild === enumPageComponentStaticChild.DEFAULT">
<div class="navigation-submenu"> <div class="navigation-submenu">
<div class="navigation_title"> <div class="navigation_title">
<nuxt-link :to="record?.slug" class="!font-arial !font-400">{{ record?.title }}</nuxt-link> <nuxt-link :to="`/${record?.slug}`" class="!font-arial !font-400">{{ record?.title }}</nuxt-link>
</div> </div>
<div class="navigation-item submenu-container dropdown-container"> <div class="navigation-item submenu-container dropdown-container">
<RecusiveNavItem :records="record.childs" /> <RecusiveNavItem :records="record.childs" />
@@ -31,7 +31,7 @@ const setGlobalState = (id: any) => {
<div class="navigation-submenu"> <div class="navigation-submenu">
<div class="position-relative ps-3"> <div class="position-relative ps-3">
<div class="navigation_title "> <div class="navigation_title ">
<nuxt-link :to="record?.slug" class="!font-arial !font-400">{{ record?.title }}</nuxt-link> <nuxt-link :to="`/${record?.slug}`" class="!font-arial !font-400">{{ record?.title }}</nuxt-link>
</div> </div>
</div> </div>
<div class="full-layout dropdown-container"> <div class="full-layout dropdown-container">
@@ -45,7 +45,7 @@ const setGlobalState = (id: any) => {
</template> </template>
<template v-else> <template v-else>
<div class="navigation_title navigation-item" > <div class="navigation_title navigation-item" >
<nuxt-link :to="record?.slug" class="!font-arial !font-400">{{ record?.title }}</nuxt-link> <nuxt-link :to="`/${record?.slug}`" class="!font-arial !font-400">{{ record?.title }}</nuxt-link>
</div> </div>
</template> </template>
</div> </div>
@@ -83,7 +83,11 @@ const mapActivesToItems = (index: number) => {
return {}; return {};
}; };
const currentCategoryTree = findElementPathById(categoryTree.value, currentArticle.value.categoryId); const currentCategoryTree = ref<any []>([]);
if(currentArticle.value?.categoryId) {
console.log('urrentArticle.value?.categoryId', categoryTree.value)
currentCategoryTree.value = findElementPathById(categoryTree.value, currentArticle.value.categoryId)
}
function findElementPathById(categories: any[], targetId: number, path: any[] = []) { function findElementPathById(categories: any[], targetId: number, path: any[] = []) {
for (const category of categories) { for (const category of categories) {
const currentPath = [...path, { title: category.title, code: category.code }]; const currentPath = [...path, { title: category.title, code: category.code }];
@@ -99,15 +103,13 @@ function findElementPathById(categories: any[], targetId: number, path: any[] =
} }
return null; return null;
} }
console.log(currentArticle.value ,'currentArticle')
</script> </script>
<template> <template>
<div class="section_layout border-custom four_col_layout" :style="LAYOUT_PARSE['div.section_layout']"> <div class="section_layout border-custom four_col_layout" :style="LAYOUT_PARSE['div.section_layout']">
<div class="left"> <div class="left">
<div> <div>
<div class="audio"> <!-- <div class="audio">
<div class="play"> <div class="play">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path <path
@@ -123,7 +125,7 @@ console.log(currentArticle.value ,'currentArticle')
<div class="timeline"> <div class="timeline">
<input type="range" name="" id="" /> <input type="range" name="" id="" />
</div> </div>
</div> </div> -->
<div class="buttons"> <div class="buttons">
<div class="actions"> <div class="actions">
@@ -189,7 +191,7 @@ console.log(currentArticle.value ,'currentArticle')
</div> </div>
</div> </div>
<div class="tags" v-if="currentArticle.tags"> <div class="tags" v-if="currentArticle && currentArticle?.tags">
<span> <span>
<svg width="18" height="19" viewBox="0 0 18 19" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="18" height="19" viewBox="0 0 18 19" fill="none" xmlns="http://www.w3.org/2000/svg">
<path <path
@@ -200,7 +202,7 @@ console.log(currentArticle.value ,'currentArticle')
</span> </span>
<ul > <ul >
<li v-for="(tag, index) in currentArticle.tags"> <li v-for="(tag, index) in currentArticle?.tags">
<nuxt-link class="font-raleway font-500" :to="`/tag/${tag.code}`">{{ tag.title }}</nuxt-link> <nuxt-link class="font-raleway font-500" :to="`/tag/${tag.code}`">{{ tag.title }}</nuxt-link>
</li> </li>
</ul> </ul>
@@ -220,38 +222,38 @@ console.log(currentArticle.value ,'currentArticle')
<div class="content detail-default"> <div class="content detail-default">
<div class="content__top"> <div class="content__top">
<div class="flex justify-between flex-wrap items-center mb-10px"> <div class="flex justify-between flex-wrap items-center mb-10px">
<ul class="flex gap-32px"> <ul class="flex gap-32px" v-if="currentCategoryTree?.length">
<li v-for="( category, index ) in currentCategoryTree" :key="index" class="first:text-#000 text-#929292 last:after:content-[''] relative after:absolute after:content-['/'] after:text-20px after:right--20px" > <li v-for="( category, index ) in currentCategoryTree" :key="index" class="first:text-#000 text-#929292 last:after:content-[''] relative after:absolute after:content-['/'] after:text-20px after:right--20px" >
<nuxt-link class=" font-raleway text-18px font-500 leading-180% uppercase" :to="`/${category.code}`">{{ category.title }}</nuxt-link> <nuxt-link class=" font-raleway text-18px font-500 leading-180% uppercase" :to="`/${category.code}`">{{ category.title }}</nuxt-link>
</li> </li>
</ul> </ul>
<div v-if="currentArticle.topics" class="pl-20px relative bg-primary inline-block"> <div v-if="currentArticle?.topics" class="pl-20px relative bg-primary inline-block">
<nuxt-link class="h-30px block py-4px px-16px border-1 border-#000 bg-white text-12px leading-180% font-raleway font-400" :to="`/topic/${currentArticle.topics[0].slug}`">{{ currentArticle.topics[0].title }}</nuxt-link> <nuxt-link class="h-30px block py-4px px-16px border-1 border-#000 bg-white text-12px leading-180% font-raleway font-400" :to="`/topic/${currentArticle?.topics[0].slug}`">{{ currentArticle?.topics[0].title }}</nuxt-link>
</div> </div>
</div> </div>
<h2 class="font-gelasio text-44px font-bold leading-130%" v-if="currentArticle.title" v-html="currentArticle.title"></h2> <h2 class="font-gelasio text-44px font-bold leading-130%" v-if="currentArticle?.title" v-html="currentArticle?.title"></h2>
<div class="author flex gap-12px my-20px" v-if="currentArticle.authors"> <div class="author flex gap-12px my-20px" v-if="currentArticle?.authors">
<ul class="flex"> <ul class="flex">
<li :style="{'z-index': index + 1}" class="relative ml--12px first:ml-0" v-for="(author, index) in currentArticle.authors" :key="index"> <li :style="{'z-index': index + 1}" class="relative ml--12px first:ml-0" v-for="(author, index) in currentArticle?.authors" :key="index">
<nuxt-link :to="`/tac-gia/${author.code}`"> <nuxt-link :to="`/tac-gia/${author.code}`">
<img :src="author.thumbnail || `http://picsum.photos/1024/600?random=1`" alt="" class="w-64px p-1px border-1px border-white h-64px object-cover rounded-full"> <img :src="author?.thumbnail || `http://picsum.photos/1024/600?random=1`" alt="" class="w-64px p-1px border-1px border-white h-64px object-cover rounded-full">
</nuxt-link> </nuxt-link>
</li> </li>
</ul> </ul>
<div> <div>
<div class="mt-10px"> <div class="mt-10px">
<nuxt-link class="font-raleway text-#000" v-for="(author, index) in currentArticle.authors" :key="index" :to="`/tac-gia/${author.code}`">{{ author.title + (index < currentArticle.authors.length - 1 ? ', ' : '') }}</nuxt-link> <nuxt-link class="font-raleway text-#000" v-for="(author, index) in currentArticle?.authors" :key="index" :to="`/tac-gia/${author.code}`">{{ author.title + (index < currentArticle.authors.length - 1 ? ', ' : '') }}</nuxt-link>
</div> </div>
<div class="text-12px"> <div class="text-12px">
Xuất bản vào {{ formatDate(currentArticle.publishedOn, 'DD/MM/YYYY | hh:mm') }} Xuất bản vào {{ formatDate(currentArticle?.publishedOn, 'DD/MM/YYYY | hh:mm') }}
</div> </div>
</div> </div>
</div> </div>
<figure v-if="currentArticle.thumbnail"> <figure v-if="currentArticle?.thumbnail">
<img :src="currentArticle.thumbnail" class="w-full " alt=""> <img :src="currentArticle?.thumbnail" class="w-full " alt="">
</figure> </figure>
</div> </div>
<div class="content__bottom" > <div class="content__bottom" >
@@ -302,11 +304,11 @@ console.log(currentArticle.value ,'currentArticle')
</div> </div>
<div> <div>
<p class="my-10px" v-if="currentArticle.intro" v-html="currentArticle.intro"> <p class="my-10px" v-if="currentArticle?.intro" v-html="currentArticle.intro">
</p> </p>
<!-- <div v-html="currentArticle.detail" class="[&_p_>_span]:!font-raleway [&_p]:mb-10px"></div> --> <!-- <div v-html="currentArticle.detail" class="[&_p_>_span]:!font-raleway [&_p]:mb-10px"></div> -->
<component :is="{ template: currentArticle.detail, components: { Poll, Quiz, Survey, Document, Attachment, Tag } }" /> <component :is="{ template: currentArticle?.detail, components: { Poll, Quiz, Survey, Document, Attachment, Tag } }" />
</div> </div>
</div> </div>
<div class="content__bottom__right"> <div class="content__bottom__right">
@@ -6,9 +6,7 @@ import { enumPageComponentLayouts, enumPageComponentTemplate, enumPageComponentK
<template> <template>
<footer id="footer" class="main-footer mt-20"> <footer id="footer" class="main-footer mt-20">
<div class="main-footer-container"> <div class="main-footer-container">
<div class="footer-centertab grid lg:grid-cols-6"> <div class="footer-centertab">
<div class="col-span-1 lg:block hidden"></div>
<div class="col-span-5">
<div class="footer-navigation-container md:block hidden"> <div class="footer-navigation-container md:block hidden">
<div> <div>
<AssignComponent :type="enumPageComponentLayouts[`${enumPageComponentTemplate[enumPageComponentKey.NAVIGATION]['BOTTOM']}`]['NAVIGATION_BOTTOM_DEFAULT']" /> <AssignComponent :type="enumPageComponentLayouts[`${enumPageComponentTemplate[enumPageComponentKey.NAVIGATION]['BOTTOM']}`]['NAVIGATION_BOTTOM_DEFAULT']" />
@@ -85,11 +83,7 @@ import { enumPageComponentLayouts, enumPageComponentTemplate, enumPageComponentK
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="footer-bottomtab"> <div class="footer-bottomtab">
<div class="lg:grid-cols-6 grid">
<div class="lg:block hidden"></div>
<div class="col-span-5">
<div class="flex justify-between items-end"> <div class="flex justify-between items-end">
<div class="flex-1 flex md:justify-start justify-center"> <div class="flex-1 flex md:justify-start justify-center">
<div> <div>
@@ -114,9 +108,7 @@ import { enumPageComponentLayouts, enumPageComponentTemplate, enumPageComponentK
<p>Giấy phép số <span class="fw-bold">...</span>, cấp ngày ....</p> <p>Giấy phép số <span class="fw-bold">...</span>, cấp ngày ....</p>
<p> quan chủ quản: <span class="fw-bold">....</span></p> <p> quan chủ quản: <span class="fw-bold">....</span></p>
<p>Cấm sao chép dưới mọi hình thức nếu không sự chấp thuận bằng văn bản</p> <p>Cấm sao chép dưới mọi hình thức nếu không sự chấp thuận bằng văn bản</p>
<p>Powered by GCT</p> <p>Powered by VPress</p>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
+3 -2
View File
@@ -9,7 +9,7 @@ import DynamicTemplate from "~/components/dynamic-page/page/templates/index.vue"
import DynamicSection from "~/components/dynamic-page/page-section/templates/index.vue"; import DynamicSection from "~/components/dynamic-page/page-section/templates/index.vue";
const route = useRoute(); const route = useRoute();
const site = useCookie("site")
const store = reactive({ const store = reactive({
dynamicPage: useDynamicPageStore(), dynamicPage: useDynamicPageStore(),
article: useArticleStore(), article: useArticleStore(),
@@ -20,8 +20,9 @@ import { useArticleStore } from '~/stores/articles';
const loadPage = async () => { const loadPage = async () => {
const article = await store.article.getArticleBySlug(String(route.params.slug)); const article = await store.article.getArticleBySlug(String(route.params.slug));
site.value = article?.value.siteId
let isContentType let isContentType
switch (article.value?.contentType) { switch (article?.value?.contentType) {
case 1: case 1:
isContentType = 'trang-chi-tiet'; isContentType = 'trang-chi-tiet';
break; break;
+5 -5
View File
@@ -11,12 +11,12 @@ const store = reactive({
}); });
//ly danh sách categoryTree //ly danh sách categoryTree
await store.category.fetchBySiteId() await store.category.fetchBySiteId()
// const site = useCookie('site')
const { data } = await useAsyncData('index', () => store.dynamicPage.fetchPageByCode(route.path === '/' ? 'trang-chu' : route.path.replace('/', ''))) const { data } = await useAsyncData('index', () => store.dynamicPage.fetchPageByCode(route.path === '/' ? 'trang-chu' : route.path.replace('/', '')))
const asycnCurrentPage = data.value.currentPage; const asycnCurrentPage = data.value && data.value.currentPage;
const asycnSectionPublished = data.value.sectionPublished; const asycnSectionPublished = data.value && data.value.sectionPublished;
const asycnComponentPublished = data.value.componentPublished; const asycnComponentPublished = data.value && data.value.componentPublished;
// site.value = data.value?.currentPage?.siteId
useHead({ useHead({
title: () => 'Trang chủ', title: () => 'Trang chủ',
description: () => 'Với công nghệ đột phá và giải pháp sáng tạo, Vpress sẽ là đối tác tin cậy của các tòa soạn báo, cùng nhau kiến tạo nên những giá trị bền vững trong kỷ nguyên chuyển đổi số báo chí.', description: () => 'Với công nghệ đột phá và giải pháp sáng tạo, Vpress sẽ là đối tác tin cậy của các tòa soạn báo, cùng nhau kiến tạo nên những giá trị bền vững trong kỷ nguyên chuyển đổi số báo chí.',
+7 -5
View File
@@ -63,9 +63,10 @@ export const getArticleById = async (event : any) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const id = event.context.params.id; const id = event.context.params.id;
const query = getQuery(event)
const { item }: any = await $fetch(`${apiUrl}/cms/digital-article/${id}`, { const { item }: any = await $fetch(`${apiUrl}/cms/digital-article/${id}`, {
headers: new Headers({ headers: new Headers({
site: '1' || 1, site: getSite(query.site).toString(),
}), }),
}) })
@@ -79,9 +80,10 @@ export const getArticleBySlug = async (event : any) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const slug = event.context.params.slug; const slug = event.context.params.slug;
const query = getQuery(event)
const { item }: any = await $fetch(`${apiUrl}/cms/digital-article/slug:${slug}`, { const { item }: any = await $fetch(`${apiUrl}/cms/digital-article/slug:${slug}`, {
headers: new Headers({ headers: new Headers({
site: '1' || 1, site: getSite(query.site).toString(),
}), }),
}) })
return { item } return { item }
@@ -93,17 +95,17 @@ export const getArticleBySlug = async (event : any) => {
export const listArticleCondition = async (event: H3Event) => { export const listArticleCondition = async (event: H3Event) => {
try { try {
const payload = await readBody<any>(event) const payload = await readBody<any>(event)
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public;
const query = getQuery(event)
const { items }: any = await $fetch(`${apiUrl}/cms/article/condition`, { const { items }: any = await $fetch(`${apiUrl}/cms/article/condition`, {
method: "POST", method: "POST",
headers: new Headers({ headers: new Headers({
site: '1' || 1, site: getSite(query.site).toString(),
}), }),
body: { body: {
payload payload
} }
}) })
// log(event)
return items return items
} catch (error) { } catch (error) {
+5 -4
View File
@@ -17,12 +17,13 @@ export type Author = {
export const fetchByCode = async (event: H3Event) => { export const fetchByCode = async (event: H3Event) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const { authorCode }: any = getQuery(event) const { authorCode }: any = getQuery(event);
const query = getQuery(event)
const { items }: any = await $fetch(`${apiUrl}/cms/author/code:${authorCode}`, { const { items }: any = await $fetch(`${apiUrl}/cms/author/code:${authorCode}`, {
method: 'GET', method: 'GET',
headers: { headers: new Headers({
site: 1 site: getSite(query.site).toString(),
} }),
}) })
return items[0] return items[0]
} catch (error) { } catch (error) {
+7 -6
View File
@@ -28,15 +28,16 @@ export type CategoryTree = Category & {
children?: Category[] children?: Category[]
} }
export const list = async () => { export const list = async (event : H3Event) => {
try { try {
const { site, apiUrl } = useRuntimeConfig().public; const { site, apiUrl } = useRuntimeConfig().public;
const query = getQuery(event)
const { items }: CategoryTree[] | any = await $fetch(`${apiUrl}/cms/category/tree/site:1`, { const siteId = getSite(query.site).toString()
const { items }: CategoryTree[] | any = await $fetch(`${apiUrl}/cms/category/tree/site:${siteId}`, {
method: "GET", method: "GET",
headers: { headers: new Headers({
site: 1, site: siteId,
}, }),
}); });
return { items } ; return { items } ;
} catch (error) { } catch (error) {
+11 -2
View File
@@ -101,11 +101,13 @@ export const getDynamicPageByCode = async (event: any) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const slug = event.context.params.slug; const slug = event.context.params.slug;
const query = getQuery(event)
const { item }: any = await $fetch(`${apiUrl}/cms/page/overview-page/slug:${slug}`, { const { item }: any = await $fetch(`${apiUrl}/cms/page/overview-page/slug:${slug}`, {
headers: new Headers({ headers: new Headers({
site: '1' || 1, site: getSite(query.site).toString(),
}), }),
}) })
console.log(getSite(query.site))
return item return item
} catch (error) { } catch (error) {
handleError(error); handleError(error);
@@ -116,7 +118,12 @@ export const getDynamicPageById = async (event: any) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const id = event.context.params.id; const id = event.context.params.id;
const { item }: any = await $fetch(`${apiUrl}/cms/overview-page/${id}`) const query = getQuery(event)
const { item }: any = await $fetch(`${apiUrl}/cms/overview-page/${id}`, {
headers: new Headers({
site: getSite(query.site).toString(),
}),
})
return item return item
} catch (error) { } catch (error) {
handleError(error); handleError(error);
@@ -126,10 +133,12 @@ export async function getOverviewPageComponentById(event: any) {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const { componentId, dataQuery } = getQuery(event) const { componentId, dataQuery } = getQuery(event)
const query = getQuery(event)
return await $fetch(`${apiUrl}/cms/overview-page-component/${componentId}`, { return await $fetch(`${apiUrl}/cms/overview-page-component/${componentId}`, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
site: getSite(query.site).toString(),
}, },
body: dataQuery, body: dataQuery,
}); });
+8 -6
View File
@@ -21,11 +21,12 @@ export const fetchByCode = async(event: H3Event) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const { eventCode }: any = getQuery(event) const { eventCode }: any = getQuery(event)
const query = getQuery(event)
const { item }: any = await $fetch(`${apiUrl}/cms/event/code:${eventCode}`, { const { item }: any = await $fetch(`${apiUrl}/cms/event/code:${eventCode}`, {
method: 'GET', method: 'GET',
headers: { headers: new Headers({
Site: 1 site: getSite(query.site).toString(),
} }),
}) })
return item return item
} catch (error) { } catch (error) {
@@ -37,11 +38,12 @@ export const fetchById = async(event: H3Event) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const { eventId }: any = getQuery(event) const { eventId }: any = getQuery(event)
const query = getQuery(event);
const { item }: any = await $fetch(`${apiUrl}/cms/event/${eventId}`, { const { item }: any = await $fetch(`${apiUrl}/cms/event/${eventId}`, {
method: 'GET', method: 'GET',
headers: { headers: new Headers({
Site: 1 site: getSite(query.site).toString(),
} }),
}) })
return item return item
} catch (error) { } catch (error) {
+4 -2
View File
@@ -1,5 +1,6 @@
import { H3Event } from 'h3'; import { H3Event } from 'h3';
import Base from './base' import Base from './base'
import { useCookie } from 'nuxt/app';
export type PollOption = { export type PollOption = {
id?: number; // Mã định danh id?: number; // Mã định danh
@@ -19,11 +20,12 @@ export type PollOption = {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const { pollId }: any = getQuery(event) const { pollId }: any = getQuery(event)
const query = getQuery(event)
const { items }: PollOption[] | any = await $fetch(`${apiUrl}/cms/poll-option/poll:${pollId}`, { const { items }: PollOption[] | any = await $fetch(`${apiUrl}/cms/poll-option/poll:${pollId}`, {
method: 'GET', method: 'GET',
headers: { headers: {
site: 1 site: getSite(query.site).toString()
} },
}) })
return items return items
+6 -4
View File
@@ -1,5 +1,6 @@
import { H3Event } from 'h3'; import { H3Event } from 'h3';
import Base from './base' import Base from './base'
import { useCookie } from 'nuxt/app';
export type PollResponse = { export type PollResponse = {
id?: number; // Mã định danh id?: number; // Mã định danh
@@ -15,10 +16,11 @@ export const create = async (event: H3Event) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const payload = await readBody<any>(event) const payload = await readBody<any>(event)
const query = getQuery(event)
const { item }: any = await $fetch(`${apiUrl}/cms/poll-response`, { const { item }: any = await $fetch(`${apiUrl}/cms/poll-response`, {
method: 'POST', method: 'POST',
headers: { headers: {
site: 1 site: getSite(query.site).toString()
}, },
body: payload body: payload
}) })
@@ -32,14 +34,14 @@ export const create = async (event: H3Event) => {
export const fetchByPollId = async (event: H3Event) => { export const fetchByPollId = async (event: H3Event) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const { pollId }: any = getQuery(event) const { pollId }: any = getQuery(event)
const query = getQuery(event)
const { items }: PollResponse[] | any = await $fetch(`${apiUrl}/cms/poll-response/poll:${pollId}`, { const { items }: PollResponse[] | any = await $fetch(`${apiUrl}/cms/poll-response/poll:${pollId}`, {
method: 'GET', method: 'GET',
headers: { headers: {
site: 1 site: getSite(query.site).toString()
} },
}) })
return items return items
+2 -1
View File
@@ -32,10 +32,11 @@ export type Poll = {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const { pollId}: any = getQuery(event) const { pollId}: any = getQuery(event)
const query = getQuery(event)
const { item }: Poll | any = await $fetch(`${apiUrl}/cms/poll/${pollId}`, { const { item }: Poll | any = await $fetch(`${apiUrl}/cms/poll/${pollId}`, {
method: 'GET', method: 'GET',
headers: { headers: {
site: 1 site: getSite(query.site).toString()
} }
}) })
+2 -1
View File
@@ -31,10 +31,11 @@ export type Quiz = {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const { quizId }: any = getQuery(event) const { quizId }: any = getQuery(event)
const query = getQuery(event)
const { item }: Quiz | any = await $fetch(`${apiUrl}/cms/quiz/${quizId}`, { const { item }: Quiz | any = await $fetch(`${apiUrl}/cms/quiz/${quizId}`, {
method: 'GET', method: 'GET',
headers: { headers: {
site: 1 site: getSite(query.site).toString()
} }
}) })
+2 -1
View File
@@ -31,10 +31,11 @@ export type Survey = {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const { surveyId }: any = getQuery(event) const { surveyId }: any = getQuery(event)
const query = getQuery(event)
const { item }: Survey | any = await $fetch(`${apiUrl}/cms/survey/${surveyId}`, { const { item }: Survey | any = await $fetch(`${apiUrl}/cms/survey/${surveyId}`, {
method: 'GET', method: 'GET',
headers: { headers: {
site: 1 site: getSite(query.site).toString()
} }
}) })
+4 -3
View File
@@ -7,10 +7,10 @@ export const get = async(event: H3Event) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const { code } = getQuery(event) const { code } = getQuery(event)
const query = getQuery(event)
const { items }: any = await $fetch(`${apiUrl}/cms/tag/code:${code}`, { const { items }: any = await $fetch(`${apiUrl}/cms/tag/code:${code}`, {
headers: { headers: {
site: 1 site: getSite(query.site).toString()
} }
}) })
return items return items
@@ -23,10 +23,11 @@ export const fetchById = async(event: H3Event) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const { tagId }: any = getQuery(event) const { tagId }: any = getQuery(event)
const query = getQuery(event)
const { item }: any = await $fetch(`${apiUrl}/cms/tag/${tagId}`, { const { item }: any = await $fetch(`${apiUrl}/cms/tag/${tagId}`, {
method: 'GET', method: 'GET',
headers: { headers: {
Site: 1 Site: getSite(query.site).toString()
} }
}) })
return item return item
+6 -4
View File
@@ -12,10 +12,10 @@ export const listPaging = async (event: H3Event) => {
if(categoryId) { if(categoryId) {
query.value = { categoryId } query.value = { categoryId }
} }
const gQuery = getQuery(event)
const { items, total }: any = await $fetch(`${apiUrl}/cms/topic/condition/paging:${page}-${limit}/sorting:${sort}`,{ const { items, total }: any = await $fetch(`${apiUrl}/cms/topic/condition/paging:${page}-${limit}/sorting:${sort}`,{
method: 'POST', method: 'POST',
headers: {site: 1}, headers: {site: getSite(gQuery.site).toString()},
body:{ ...query.value } body:{ ...query.value }
}) })
@@ -29,10 +29,11 @@ export const fetchByCode = async(event: H3Event) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const { topicCode }: any = getQuery(event) const { topicCode }: any = getQuery(event)
const query = getQuery(event)
const { item }: any = await $fetch(`${apiUrl}/cms/topic/code:${topicCode}`, { const { item }: any = await $fetch(`${apiUrl}/cms/topic/code:${topicCode}`, {
method: 'GET', method: 'GET',
headers: { headers: {
site: 1 site: getSite(query.site).toString()
} }
}) })
@@ -46,10 +47,11 @@ export const fetchById = async(event: H3Event) => {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const { topicId }: any = getQuery(event) const { topicId }: any = getQuery(event)
const query = getQuery(event)
const { item }: any = await $fetch(`${apiUrl}/cms/topic/${topicId}`, { const { item }: any = await $fetch(`${apiUrl}/cms/topic/${topicId}`, {
method: 'GET', method: 'GET',
headers: { headers: {
site: 1 site: getSite(query.site).toString()
} }
}) })
+17
View File
@@ -0,0 +1,17 @@
export const getSite = (dns : any) => {
const SITE = {
DEFAULT: 1,
PORTAL2: 'portal2',
}
let site = null;
switch (dns) {
case SITE.PORTAL2:
site = 2;
break;
default:
site = 1;
break;
}
return site;
}
+17 -3
View File
@@ -5,9 +5,16 @@ export const useArticleStore = defineStore("article", () => {
const currentArticle = ref<any>({}); const currentArticle = ref<any>({});
const currentArticles = ref<any[]>([]) const currentArticles = ref<any[]>([])
const url : any = useRequestURL();
const host = url.hostname.split('.')[0];
const getArticleById = async (id: string | number) => { const getArticleById = async (id: string | number) => {
try { try {
const { data } = await useFetch(`/api/articles/get-by-id/${id}`) const { data } = await useFetch(`/api/articles/get-by-id/${id}`, {
query: {
site: host
}
})
currentArticle.value = {} currentArticle.value = {}
currentArticle.value = data.value.item currentArticle.value = data.value.item
} catch (error: any) { } } catch (error: any) { }
@@ -15,7 +22,11 @@ export const useArticleStore = defineStore("article", () => {
const getArticleBySlug = async (slug: string) => { const getArticleBySlug = async (slug: string) => {
try { try {
const article = await $fetch(`/api/articles/get-by-slug/${slug}`) const article = await $fetch(`/api/articles/get-by-slug/${slug}`, {
query: {
site: host
}
})
currentArticle.value = {} currentArticle.value = {}
currentArticle.value = article?.item currentArticle.value = article?.item
@@ -27,7 +38,10 @@ export const useArticleStore = defineStore("article", () => {
try { try {
const { data: articles } = await useFetch(`/api/articles/condition`, { const { data: articles } = await useFetch(`/api/articles/condition`, {
method: 'POST', method: 'POST',
body: condition body: condition,
query: {
site: host
}
}) })
} catch (error: any) { } catch (error: any) {
+7 -2
View File
@@ -83,9 +83,14 @@ import type { Category, CategoryTree } from "~/server/models/category";
export const useCategoryStore = defineStore('usecategorystore', () => { export const useCategoryStore = defineStore('usecategorystore', () => {
const categoryTree = shallowRef<CategoryTree[]>([]) const categoryTree = shallowRef<CategoryTree[]>([])
const currentCategoryTree = shallowRef<any[]>([]) const currentCategoryTree = shallowRef<any[]>([])
const url : any = useRequestURL();
const host = url.hostname.split('.')[0];
async function fetchBySiteId() { async function fetchBySiteId() {
const { data }: any = await useFetch(`/api/services/category-tree`) const { data }: any = await useFetch(`/api/services/category-tree`,{
query: {
site: host
}
})
categoryTree.value = data.value.items categoryTree.value = data.value.items
return categoryTree.value return categoryTree.value
} }
+10 -2
View File
@@ -1,10 +1,14 @@
import { defineStore, acceptHMRUpdate } from "pinia"; import { defineStore, acceptHMRUpdate } from "pinia";
import { useLocalStorage } from "@vueuse/core"; import { useLocalStorage } from "@vueuse/core";
export const useDynamicPageStore = defineStore("dynamicPageStore", () => { export const useDynamicPageStore = defineStore("dynamicPageStore", () => {
const currentPage = ref<any>({}); const currentPage = ref<any>({});
const sectionPublished = ref<any[]>([]); const sectionPublished = ref<any[]>([]);
const componentPublished = ref<any[]>([]); const componentPublished = ref<any[]>([]);
const url : any = useRequestURL();
const host = url.hostname.split('.')[0];
const setSectionPublished = () => { const setSectionPublished = () => {
const exsitsTemplate = ['None'] const exsitsTemplate = ['None']
const contentArr: any = []; const contentArr: any = [];
@@ -45,7 +49,11 @@ export const useDynamicPageStore = defineStore("dynamicPageStore", () => {
async function fetchPageByCode(slug: any) { async function fetchPageByCode(slug: any) {
try { try {
const page = await $fetch(`/api/dynamic-page/get-by-code/${slug}`) const page = await $fetch(`/api/dynamic-page/get-by-code/${slug}`, {
query: {
site: host
}
})
currentPage.value = {} currentPage.value = {}
currentPage.value = page currentPage.value = page
@@ -60,7 +68,7 @@ export const useDynamicPageStore = defineStore("dynamicPageStore", () => {
} catch (error: any) {} } catch (error: any) {}
} }
async function getOverviewPageComponentById(componentId, dataQuery) { async function getOverviewPageComponentById(componentId: any, dataQuery: any) {
try { try {
const { apiUrl } = useRuntimeConfig().public const { apiUrl } = useRuntimeConfig().public
const res = await $fetch(`${apiUrl}/cms/page-component/overview-page-component/${componentId}`, { const res = await $fetch(`${apiUrl}/cms/page-component/overview-page-component/${componentId}`, {
+4 -1
View File
@@ -2,11 +2,14 @@ import type { PollOption } from "~/server/models/poll-option"
export const usePollOptionStore = defineStore('usePollOptionStore', () => { export const usePollOptionStore = defineStore('usePollOptionStore', () => {
const currentPollOption = shallowReactive<PollOption>({}) const currentPollOption = shallowReactive<PollOption>({})
const currentPollOptions = shallowRef<PollOption[] | any[]>([]) const currentPollOptions = shallowRef<PollOption[] | any[]>([])
const url : any = useRequestURL();
const host = url.hostname.split('.')[0];
async function fetchByPollId(id: string) { async function fetchByPollId(id: string) {
try { try {
const { data } = await useFetch<any>(`/api/services/poll-option/pollId`, { const { data } = await useFetch<any>(`/api/services/poll-option/pollId`, {
query: { query: {
pollId: id pollId: id,
site: host
} }
}) })
+6 -2
View File
@@ -2,12 +2,15 @@ import type { PollResponse } from "~/server/models/poll-response"
export const usePollResponseStore = defineStore('usePollResponseStore', () => { export const usePollResponseStore = defineStore('usePollResponseStore', () => {
const currentPollResponse = shallowReactive<PollResponse>({}) const currentPollResponse = shallowReactive<PollResponse>({})
const currentPollResponses = shallowRef<PollResponse[]>([]) const currentPollResponses = shallowRef<PollResponse[]>([])
const url : any = useRequestURL();
const host = url.hostname.split('.')[0];
const create = async (pollResponse: any) => { const create = async (pollResponse: any) => {
try { try {
const { data } = await useFetch<any>(`/api/services/poll-response`, { const { data } = await useFetch<any>(`/api/services/poll-response`, {
method: 'POST', method: 'POST',
body: pollResponse body: pollResponse,
query: {site: host}
}) })
data.value && (Object.assign(currentPollResponse, data.value)) data.value && (Object.assign(currentPollResponse, data.value))
return currentPollResponse return currentPollResponse
@@ -21,7 +24,8 @@ export const usePollResponseStore = defineStore('usePollResponseStore', () => {
try { try {
const { data } = await useFetch<any>(`/api/services/poll-response/pollId`, { const { data } = await useFetch<any>(`/api/services/poll-response/pollId`, {
query: { query: {
pollId: id pollId: id,
site: host
} }
}) })
+7 -11
View File
@@ -1,12 +1,17 @@
import type { Poll } from "~/server/models/poll" import type { Poll } from "~/server/models/poll"
export const usePollStore = defineStore('usePollStore', () => { export const usePollStore = defineStore('usePollStore', () => {
const currentPoll = shallowReactive<Poll>({}) const currentPoll = shallowReactive<Poll>({})
const url : any = useRequestURL();
const host = url.hostname.split('.')[0];
async function fetchById(id: string) { async function fetchById(id: string) {
try { try {
const { data } = await useFetch<any>(`/api/services/poll-by-id`, { const { data } = await useFetch<any>(`/api/services/poll-by-id`, {
query: { query: {
pollId: id pollId: id,
site: host
} }
}) })
@@ -16,16 +21,7 @@ export const usePollStore = defineStore('usePollStore', () => {
} }
} }
return { fetchById, currentPoll }
async function categoryId() {
try {
const { data } = await useFetch(`/api/services/category-tree`)
return data.value
} catch (error) {}
}
return { fetchById, currentPoll, categoryId }
}) })
if(import.meta.hot) { if(import.meta.hot) {