- fnCustomVideo 유튜브 팝업 함수 추가 - script/link exclude 속성 지원 - 전역 함수 등록 로직 통합 (registerGlobalFunctions) - CSS Selector injection 보안 취약점 수정 - 사용되지 않는 변수/props 제거 - DOMPurify exclude, defer 속성 허용 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
134 lines
3.5 KiB
Vue
134 lines
3.5 KiB
Vue
<script setup lang="ts">
|
|
import { useTemplateRegistry } from '#layers/composables/useTemplateRegistry'
|
|
import type {
|
|
PageDataValue,
|
|
PageDataTemplate,
|
|
PageDataMetaTag,
|
|
} from '#layers/types/api/pageData'
|
|
|
|
interface Props {
|
|
pageData: PageDataValue
|
|
}
|
|
|
|
const props = defineProps<Props>()
|
|
|
|
const { tm, locale } = useI18n()
|
|
const { getTemplateComponent } = useTemplateRegistry()
|
|
const loadingStore = useLoadingStore()
|
|
const modalStore = useModalStore()
|
|
|
|
const { isPAssApiLoading, hasApiCallStarted } = storeToRefs(loadingStore)
|
|
|
|
// 개별 메타 태그 표시 여부 확인
|
|
const shouldShowMetaTag = computed(() => props.pageData?.meta_tag_type === 2)
|
|
|
|
// 템플릿 표시 여부 확인
|
|
const isTemplateVisible = (template: PageDataTemplate): boolean => {
|
|
return Boolean(
|
|
template?.page_ver_tmpl_json &&
|
|
Object.keys(template?.page_ver_tmpl_json).length > 0
|
|
)
|
|
}
|
|
|
|
// 템플릿 목록 계산
|
|
const visibleTemplates = computed(() =>
|
|
Object.values(props.pageData?.templates).filter(isTemplateVisible)
|
|
)
|
|
const isShowTopBtn = computed(() => props.pageData?.use_top_btn ?? false)
|
|
const isShowSnsBtn = computed(() => props.pageData?.use_sns_btn ?? false)
|
|
const isShowLnb = computed(() => props.pageData?.use_lnb ?? false)
|
|
|
|
// SEO 메타 태그 설정
|
|
const setupSeoMeta = (metaTag: PageDataMetaTag) => {
|
|
useSeoMeta({
|
|
title: metaTag?.page_title ?? '',
|
|
description: metaTag?.page_desc ?? '',
|
|
ogTitle: metaTag?.og_title ?? '',
|
|
ogDescription: metaTag?.og_desc ?? '',
|
|
ogImage: formatPathHost(metaTag?.og_image) ?? '',
|
|
twitterTitle: metaTag?.x_title ?? '',
|
|
twitterImage: formatPathHost(metaTag?.x_image) ?? '',
|
|
twitterDescription: metaTag?.x_desc ?? '',
|
|
})
|
|
}
|
|
|
|
// 메타 태그 설정 감시
|
|
watchEffect(() => {
|
|
if (shouldShowMetaTag.value && props.pageData?.meta_tag_json) {
|
|
setupSeoMeta(props.pageData?.meta_tag_json)
|
|
}
|
|
})
|
|
|
|
watch(isPAssApiLoading, newVal => {
|
|
if (newVal) {
|
|
loadingStore.stopFullLoading()
|
|
}
|
|
})
|
|
|
|
onMounted(() => {
|
|
const { sendLog } = useAnalytics()
|
|
sendLog(locale.value, 'view')
|
|
|
|
if (!hasApiCallStarted.value) {
|
|
loadingStore.stopFullLoading()
|
|
}
|
|
|
|
// 페이지 접근 권한 설정(로그인 유무)
|
|
if (props.pageData?.is_login_required === 1 && !csrGetAccessToken()) {
|
|
modalStore.handleOpenConfirm({
|
|
contentText: tm('Alert_StoveLogin'),
|
|
confirmButtonText: tm('Text_StoveLogin'),
|
|
confirmButtonEvent: () => {
|
|
csrGoStoveLogin()
|
|
},
|
|
})
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div class="content-wrap">
|
|
<template
|
|
v-for="(template, index) in visibleTemplates"
|
|
:key="template.template_code ?? index"
|
|
>
|
|
<component
|
|
:is="getTemplateComponent(template.template_code)"
|
|
:id="template.page_ver_tmpl_name_en"
|
|
:components="template.page_ver_tmpl_json"
|
|
:page-ver-tmpl-seq="template.page_ver_tmpl_seq"
|
|
:page-ver-tmpl-name-en="template.page_ver_tmpl_name_en"
|
|
/>
|
|
</template>
|
|
</div>
|
|
<ClientOnly>
|
|
<BlocksLnb v-if="isShowLnb" />
|
|
<div v-if="isShowTopBtn" class="utile-wrap">
|
|
<BlocksButtonScrollTop
|
|
v-if="isShowTopBtn"
|
|
:color="pageData?.top_btn_color_json"
|
|
/>
|
|
</div>
|
|
</ClientOnly>
|
|
<BlocksSns v-if="isShowSnsBtn" />
|
|
</template>
|
|
|
|
<style scoped>
|
|
.empty-game + main .content-wrap {
|
|
@apply pt-0;
|
|
}
|
|
.content-wrap {
|
|
@apply relative pt-[48px] md:pt-[64px];
|
|
}
|
|
.utile-wrap {
|
|
@apply fixed flex flex-col items-end z-[100]
|
|
bottom-[12px] right-[12px] gap-2 md:bottom-[40px] md:right-[40px] md:gap-3;
|
|
}
|
|
|
|
[data-theme='light'] {
|
|
.content-wrap {
|
|
@apply bg-theme-foreground;
|
|
}
|
|
}
|
|
</style>
|