.
This commit is contained in:
+100
-72
@@ -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<boolean>(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,
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
<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']" @click="selectComponent" @dragover.prevent @drop.stop.prevent="drop" :style="LAYOUT_PARSE['article']">
|
||||
<div class="article_video">
|
||||
<template v-if="parseData">
|
||||
<div
|
||||
v-if="!playVideo"
|
||||
class="article_video_thumb h-full"
|
||||
:style="{ backgroundImage: `url('${parseData.thumbnail ? parseData.thumbnail : '/images/default-thumbnail.jpg'}')` }"
|
||||
@click="playVideo = true"
|
||||
>
|
||||
<div></div>
|
||||
<div class="article_video_content">
|
||||
<span><Icon name="ri:play-circle-line" class="text-white" /></span>
|
||||
<h3 class="line-clamp text-white" :class="LAYOUT_PARSE['title_Class']" :style="LAYOUT_PARSE['h3.title']">
|
||||
{{ parseData.title?.replace(/<[^>]+>/g, "") }}
|
||||
</h3>
|
||||
<p class="mb-0 line-clamp text-white" :class="LAYOUT_PARSE['paragraph_Class']" :style="LAYOUT_PARSE['p.paragraph']">
|
||||
{{ parseData.intro?.replace(/<[^>]+>/g, "") }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else v-html="getResource('HIGHLIGHT_VIDEO', JSON.parse(props.dataResult).detail)">
|
||||
<div class="article_video_thumb article-thumbnail" :style="{ backgroundImage: `url('${parseData.thumbnail ? parseData.thumbnail : '/images/default-thumbnail.jpg'}')` }">
|
||||
<div></div>
|
||||
<div class="article_video_content">
|
||||
<span>
|
||||
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M23.5 18.5C24.375 17.875 25.625 17.875 26.5 18.5L44.5 29.5C45.375 30 46 31 46 32C46 33.125 45.375 34.125 44.5 34.625L26.5 45.625C25.625 46.125 24.375 46.25 23.5 45.625C22.5 45.125 22 44.125 22 43V21C22 20 22.5 19 23.5 18.5ZM64 32C64 49.75 49.625 64 32 64C14.25 64 0 49.75 0 32C0 14.375 14.25 0 32 0C49.625 0 64 14.375 64 32ZM32 6C17.625 6 6 17.75 6 32C6 46.375 17.625 58 32 58C46.25 58 58 46.375 58 32C58 17.75 46.25 6 32 6Z"
|
||||
fill="#ED1C24"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
<h3 class="line-clamp article-title" :class="LAYOUT_PARSE['title_Class']" :style="LAYOUT_PARSE['h3.title']">
|
||||
{{ parseData.title?.replace(/<[^>]+>/g, "") }}
|
||||
</h3>
|
||||
<p class="mb-0 line-clamp article-intro" :class="LAYOUT_PARSE['paragraph_Class']" :style="LAYOUT_PARSE['p.paragraph']">
|
||||
{{ parseData.intro?.replace(/<[^>]+>/g, "") }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div v-else class="empty-box">
|
||||
<div class="d-flex justify-content-center align-items-center flex-column">
|
||||
<i class="ri-play-circle-line"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="LAYOUT_PARSE.styleClasses" v-html="LAYOUT_PARSE.styleClasses"></div>
|
||||
<div v-html="LAYOUT_PARSE.styleClasses" v-if="LAYOUT_PARSE.styles"></div>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.article_video {
|
||||
@apply min-h-465px;
|
||||
.article_video_thumb {
|
||||
@apply flex flex-col justify-end min-h-465px;
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
padding: 120px 85px 60px 85px;
|
||||
border-radius: 2px;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
z-index: 1;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
.article_video_content {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
h3 {
|
||||
font-size: 44px;
|
||||
font-weight: 700;
|
||||
line-height: 57.2px;
|
||||
text-align: left;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
svg {
|
||||
font-size: 80px;
|
||||
color: #ed1c24;
|
||||
}
|
||||
}
|
||||
}
|
||||
.article_video {
|
||||
.article_video_thumb {
|
||||
background-size: cover;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
padding: 120px 85px 60px 85px;
|
||||
border-radius: 2px;
|
||||
margin: 10px;
|
||||
cursor: pointer;
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
z-index: 1;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
}
|
||||
.article_video_content {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
h3 {
|
||||
font-size: 44px;
|
||||
font-weight: 700;
|
||||
line-height: 57.2px;
|
||||
text-align: left;
|
||||
margin-bottom: 12px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
color: white;
|
||||
}
|
||||
|
||||
i {
|
||||
font-size: 80px;
|
||||
color: #ed1c24;
|
||||
}
|
||||
}
|
||||
}
|
||||
.empty-box {
|
||||
background-color: #409eff;
|
||||
margin: 10px;
|
||||
min-height: 60px;
|
||||
i {
|
||||
font-size: 60px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,67 +1,93 @@
|
||||
<script setup lang="ts">
|
||||
// const store = {
|
||||
// page: useCmsPageStore(),
|
||||
// };
|
||||
// import Comment from "@/components/cms/page-component/templates/others/comments/Default.vue";
|
||||
const { categoryTree } = storeToRefs(useCategoryStore());
|
||||
const { currentArticle } = storeToRefs(useArticleStore());
|
||||
if (categoryTree.value) {
|
||||
await useCategoryStore().fetchBySiteId();
|
||||
}
|
||||
|
||||
const currentCategoryTree = findElementPathById(categoryTree.value, currentArticle.value.categoryId);
|
||||
function findElementPathById(categories: any[], targetId: number, path: any[] = []) {
|
||||
for (const category of categories) {
|
||||
const currentPath = [...path, { title: category.title, code: category.code }];
|
||||
if (category.id === targetId) {
|
||||
return currentPath;
|
||||
}
|
||||
if (category.children) {
|
||||
const result: any = findElementPathById(category.children, targetId, currentPath);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
video
|
||||
<!-- <div class="container overflow-hidden">
|
||||
<div class="video row">
|
||||
<div
|
||||
class="video__left"
|
||||
:class="
|
||||
store.page.classifyScreenByWidth({
|
||||
computer: 'col-8 px-0',
|
||||
tablet: 'col-8 px-0',
|
||||
smartphone: 'col-12',
|
||||
})
|
||||
"
|
||||
>
|
||||
<video controls="controls" width="100%" height="100%" data-file-id="149" data-resource="https://acp-api.vpress.vn/Resources/Video/983d2f57-7743-472f-b22d-fc73085af6d5.mp4" data-title="Download.mp4">
|
||||
<source src="" type="video/mp4" />
|
||||
</video>
|
||||
</div>
|
||||
<div class="video-container">
|
||||
<ul class="flex gap-32px lg:ml-80px md:ml-40px sm:ml-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>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div
|
||||
class="video__right bg-body-tertiary"
|
||||
:class="
|
||||
store.page.classifyScreenByWidth({
|
||||
computer: 'col-4 ps-4 pt-2',
|
||||
tablet: 'col-4 ps-4 pt-2',
|
||||
smartphone: 'col-12 pt-2',
|
||||
})
|
||||
"
|
||||
>
|
||||
<h1
|
||||
class=""
|
||||
:class="
|
||||
store.page.classifyScreenByWidth({
|
||||
computer: 'fs-1',
|
||||
tablet: 'fs-2',
|
||||
smartphone: 'fs-3',
|
||||
})
|
||||
"
|
||||
>
|
||||
Tiêu đề video
|
||||
</h1>
|
||||
<p class="line-clamp-3 fs-5 fw-light" :class="store.page.classifyScreenByWidth({})">
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
||||
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
</p>
|
||||
<h5 class="text-end fs-4 opacity-75">Tác giả</h5>
|
||||
|
||||
<p><b class="text-primary fw-semibold">Danh mục</b> <span class="ms-2 opacity-25 fw-semibold">Ngày đăng video</span></p>
|
||||
<Comment />
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="video-content" v-html="currentArticle.detail"></div>
|
||||
</div>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
.line-clamp-3 {
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
.video-container {
|
||||
width: 100%;
|
||||
max-width: 1080px;
|
||||
margin: auto;
|
||||
|
||||
.category-list {
|
||||
display: flex;
|
||||
gap: 32px;
|
||||
margin-bottom: 26px;
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0 0 0 80px;
|
||||
|
||||
.category-item {
|
||||
color: #929292;
|
||||
position: relative;
|
||||
font-size: 18px;
|
||||
|
||||
& > span {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
line-height: 180%;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
content: "/";
|
||||
font-size: 20px;
|
||||
right: -20px;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
&::after {
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.video-content {
|
||||
width: 100%;
|
||||
// max-width: 1080px;
|
||||
margin: 26px 0 26px 0px;
|
||||
// background-color: #eee;
|
||||
// height: 500px;
|
||||
font-size: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user