From 7da82c9101352a31237a493672135083ca720318 Mon Sep 17 00:00:00 2001 From: nguyen van thai Date: Wed, 10 Jul 2024 17:39:38 +0700 Subject: [PATCH] . --- assets/styles/style.scss | 6 + .../articles/cards/VideoBackground.vue | 172 +++++++----- .../templates/articles/details/Video.vue | 144 +++++----- .../categories/categories/Default.vue | 16 ++ .../categories/categories/Vertical.vue | 2 +- .../templates/collections/articles/Video.vue | 247 ++++++++++++++++++ .../templates/collections/articles/index.ts | 1 + .../templates/collections/articles/index.vue | 3 +- .../layouts/articles/details/Default.vue | 6 +- definitions/cms/page.type.ts | 17 +- definitions/enum/page.enum.ts | 90 ++++++- pages/bai-viet/[slug].vue | 2 +- 12 files changed, 553 insertions(+), 153 deletions(-) create mode 100644 components/dynamic-page/page-component/templates/collections/articles/Video.vue diff --git a/assets/styles/style.scss b/assets/styles/style.scss index 92c4650..8cee48d 100644 --- a/assets/styles/style.scss +++ b/assets/styles/style.scss @@ -206,4 +206,10 @@ div[layout="ARTICLE_PAGE"] { img { @apply mx-auto; } +} + +.detail-default { + p { + @apply text-18px font-raleway leading-180% my-10px; + } } \ No newline at end of file diff --git a/components/dynamic-page/page-component/templates/articles/cards/VideoBackground.vue b/components/dynamic-page/page-component/templates/articles/cards/VideoBackground.vue index 3999a2b..d6c9094 100644 --- a/components/dynamic-page/page-component/templates/articles/cards/VideoBackground.vue +++ b/components/dynamic-page/page-component/templates/articles/cards/VideoBackground.vue @@ -8,7 +8,8 @@ const props = defineProps<{ dataType?: any; dataQuery?: any; layout?: string; - label?: any; + label?: string; + component?: any; }>(); const LAYOUT_PARSE = computed(() => { @@ -16,95 +17,122 @@ const LAYOUT_PARSE = computed(() => { return Object.assign({}, designObject); }); +const emit = defineEmits(["selectComponent", "dropData"]); + +const selectComponent = () => { + emit("selectComponent"); +}; + const parseData = computed(() => { if (!props.dataResult) return; const result = getInputValue(props.dataResult, "OBJECT"); return result; }); -const playVideo = ref(false) +const drop = (e: any) => { + if (e.dataTransfer.getData(`${enumPageComponentTemplates.ARTICLE}`)) { + const data = e.dataTransfer.getData(`${enumPageComponentTemplates.ARTICLE}`); + const { dataType, dataResult } = JSON.parse(data); + const dataQuery = DEFAULT_QUERY_DROP(dataType, dataResult.id); + emit("dropData", { + dataType, + dataResult, + dataQuery: dataQuery, + }); + } +}; + diff --git a/components/dynamic-page/page-component/templates/articles/details/Video.vue b/components/dynamic-page/page-component/templates/articles/details/Video.vue index 75a411c..9242dbc 100644 --- a/components/dynamic-page/page-component/templates/articles/details/Video.vue +++ b/components/dynamic-page/page-component/templates/articles/details/Video.vue @@ -1,67 +1,93 @@ diff --git a/components/dynamic-page/page-component/templates/categories/categories/Default.vue b/components/dynamic-page/page-component/templates/categories/categories/Default.vue index f3cc798..d00f731 100644 --- a/components/dynamic-page/page-component/templates/categories/categories/Default.vue +++ b/components/dynamic-page/page-component/templates/categories/categories/Default.vue @@ -8,6 +8,22 @@ const _props = defineProps<{ label?: any; }>(); +const SETTING_OPTIONS = { + MAX_ELEMENT: 3, +}; + +const _dataResult = computed(() => { + const designObject = _props.label ? getInputValue(_props.label, "OBJECT") : {}; + let _components = Array(Number(designObject.MAX) || SETTING_OPTIONS.MAX_ELEMENT).fill(null); + const result = getInputValue(_props.dataResult, "ARRAY"); + result && + result.length > 0 && + _components.map((_: any, index: any) => { + _components[index] = result[index] || null; + }); + return Object.assign({}, _components); +}); + const designObject = computed(() => { return _props.label ? getInputValue(_props.label, "OBJECT") : {}; }); diff --git a/components/dynamic-page/page-component/templates/categories/categories/Vertical.vue b/components/dynamic-page/page-component/templates/categories/categories/Vertical.vue index 78d32dd..4760cfa 100644 --- a/components/dynamic-page/page-component/templates/categories/categories/Vertical.vue +++ b/components/dynamic-page/page-component/templates/categories/categories/Vertical.vue @@ -46,7 +46,7 @@ const mapActivesToItems = (index: number) => {

- {{ component.title }} + {{ component.title }}

diff --git a/components/dynamic-page/page-component/templates/collections/articles/Video.vue b/components/dynamic-page/page-component/templates/collections/articles/Video.vue new file mode 100644 index 0000000..c589b18 --- /dev/null +++ b/components/dynamic-page/page-component/templates/collections/articles/Video.vue @@ -0,0 +1,247 @@ + + + + + diff --git a/components/dynamic-page/page-component/templates/collections/articles/index.ts b/components/dynamic-page/page-component/templates/collections/articles/index.ts index 50973d5..aa6bcd5 100644 --- a/components/dynamic-page/page-component/templates/collections/articles/index.ts +++ b/components/dynamic-page/page-component/templates/collections/articles/index.ts @@ -1,2 +1,3 @@ export { default as Default_Collection } from './Default.vue' export { default as Audio_Collection } from './Audio.vue' +export { default as Video_Collection } from './Video.vue' diff --git a/components/dynamic-page/page-component/templates/collections/articles/index.vue b/components/dynamic-page/page-component/templates/collections/articles/index.vue index 0311484..8736a56 100644 --- a/components/dynamic-page/page-component/templates/collections/articles/index.vue +++ b/components/dynamic-page/page-component/templates/collections/articles/index.vue @@ -1,6 +1,6 @@