Merge commit 'ea5f31acffc6466a035d1b2cf41d0ec93d7e8512' into feature/20250123_cl_motion
This commit is contained in:
19
app/app.vue
19
app/app.vue
@@ -1,9 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useNuxtApp } from 'nuxt/app'
|
import { useNuxtApp } from 'nuxt/app'
|
||||||
import type {
|
import type {
|
||||||
GameDataFavicon,
|
|
||||||
GameDataMetaTag,
|
GameDataMetaTag,
|
||||||
GameDataValue,
|
GameDataValue,
|
||||||
|
GameDataImg,
|
||||||
} from '#layers/types/api/gameData'
|
} from '#layers/types/api/gameData'
|
||||||
|
|
||||||
const nuxtApp = useNuxtApp()
|
const nuxtApp = useNuxtApp()
|
||||||
@@ -14,14 +14,14 @@ const modalStore = useModalStore()
|
|||||||
const scrollStore = useScrollStore()
|
const scrollStore = useScrollStore()
|
||||||
|
|
||||||
const { setGameData } = gameDataStore
|
const { setGameData } = gameDataStore
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { gameName, gaCode } = storeToRefs(gameDataStore)
|
||||||
const { confirm, alert } = modalStore
|
const { confirm, alert } = modalStore
|
||||||
const { scrollGnbPosition } = storeToRefs(scrollStore)
|
const { scrollGnbPosition } = storeToRefs(scrollStore)
|
||||||
|
|
||||||
// 통합 메타데이터 설정
|
// 통합 메타데이터 설정
|
||||||
const setupAllMetaData = (data: GameDataValue) => {
|
const setupAllMetaData = (data: GameDataValue) => {
|
||||||
const meta = data.meta_tag_json ?? ({} as GameDataMetaTag)
|
const meta = data.meta_tag_json ?? ({} as GameDataMetaTag)
|
||||||
const faviconPath = data.favicon_json ?? ({} as GameDataFavicon)
|
const faviconPath = data.favicon_json ?? ({} as GameDataImg)
|
||||||
const theme = data.design_theme === 1 ? 'light' : 'dark'
|
const theme = data.design_theme === 1 ? 'light' : 'dark'
|
||||||
|
|
||||||
// 파비콘 링크 생성
|
// 파비콘 링크 생성
|
||||||
@@ -47,18 +47,9 @@ const setupAllMetaData = (data: GameDataValue) => {
|
|||||||
.map(([key, value]) => `--${key}: ${value};`)
|
.map(([key, value]) => `--${key}: ${value};`)
|
||||||
.join('\n ')
|
.join('\n ')
|
||||||
|
|
||||||
const commImgVariables =
|
|
||||||
data.comm_img_json?.groups
|
|
||||||
?.map(
|
|
||||||
({ img_name, img_path }) =>
|
|
||||||
`--${img_name}: url(${formatPathHost(img_path?.comm ?? '')});`
|
|
||||||
)
|
|
||||||
.join('\n ') ?? ''
|
|
||||||
|
|
||||||
const cssContent = `
|
const cssContent = `
|
||||||
:root {
|
:root {
|
||||||
${cssColorVariables}
|
${cssColorVariables}
|
||||||
${commImgVariables}
|
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
@@ -119,7 +110,7 @@ onMounted(() => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const { gtag, initialize } = useGtag()
|
const { gtag, initialize } = useGtag()
|
||||||
initialize(gameData.value?.ga_code)
|
initialize(gaCode.value)
|
||||||
gtag('event', 'screen_view', {
|
gtag('event', 'screen_view', {
|
||||||
app_name: 'My App',
|
app_name: 'My App',
|
||||||
screen_name: 'Home',
|
screen_name: 'Home',
|
||||||
@@ -142,7 +133,7 @@ onBeforeUnmount(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<h1 class="sr-only">{{ gameData?.game_name }}</h1>
|
<h1 class="sr-only">{{ gameName }}</h1>
|
||||||
<NuxtPage />
|
<NuxtPage />
|
||||||
|
|
||||||
<!-- 공통 모달 컴포넌트 -->
|
<!-- 공통 모달 컴포넌트 -->
|
||||||
|
|||||||
@@ -96,8 +96,7 @@ const errorTitle = ref('')
|
|||||||
const errorMsg = ref('')
|
const errorMsg = ref('')
|
||||||
|
|
||||||
const gameDataStore = useGameDataStore()
|
const gameDataStore = useGameDataStore()
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { gameName } = storeToRefs(gameDataStore)
|
||||||
const gameName = computed(() => gameData.value?.game_name)
|
|
||||||
|
|
||||||
//error clear 함수 생성
|
//error clear 함수 생성
|
||||||
const localePath = useLocalePath()
|
const localePath = useLocalePath()
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ const gameDataStore = useGameDataStore()
|
|||||||
const modalStore = useModalStore()
|
const modalStore = useModalStore()
|
||||||
const { sendLog } = useAnalytics()
|
const { sendLog } = useAnalytics()
|
||||||
|
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { gameData, snsJson } = storeToRefs(gameDataStore)
|
||||||
const { handleOpenToast } = modalStore
|
const { handleOpenToast } = modalStore
|
||||||
|
|
||||||
const analytics = {
|
const analytics = {
|
||||||
@@ -22,9 +22,6 @@ const snsBackgroundColor = computed(() => {
|
|||||||
const colorCode = getColorCodeFromData(colorData, 'none')
|
const colorCode = getColorCodeFromData(colorData, 'none')
|
||||||
return colorCode
|
return colorCode
|
||||||
})
|
})
|
||||||
const snsList = computed(() => {
|
|
||||||
return gameData.value?.sns_json
|
|
||||||
})
|
|
||||||
|
|
||||||
const handleControlForce = (state: boolean) => {
|
const handleControlForce = (state: boolean) => {
|
||||||
showSnsList.value = state
|
showSnsList.value = state
|
||||||
@@ -45,7 +42,7 @@ const handleCopy = async () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="Object.keys(snsList).length > 0" class="sns-container">
|
<div v-if="Object.keys(snsJson).length > 0" class="sns-container">
|
||||||
<transition name="fade">
|
<transition name="fade">
|
||||||
<AtomsButtonCircle
|
<AtomsButtonCircle
|
||||||
v-show="!showSnsList"
|
v-show="!showSnsList"
|
||||||
@@ -63,7 +60,7 @@ const handleCopy = async () => {
|
|||||||
class="sns-list"
|
class="sns-list"
|
||||||
:style="{ backgroundColor: snsBackgroundColor }"
|
:style="{ backgroundColor: snsBackgroundColor }"
|
||||||
>
|
>
|
||||||
<template v-for="(item, key) in snsList" :key="key">
|
<template v-for="(item, key) in snsJson" :key="key">
|
||||||
<a
|
<a
|
||||||
v-if="item.use_yn === 1 && item.url"
|
v-if="item.use_yn === 1 && item.url"
|
||||||
:href="item.url"
|
:href="item.url"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const scrollStore = useScrollStore()
|
|||||||
const breakpoints = useResponsiveBreakpoints()
|
const breakpoints = useResponsiveBreakpoints()
|
||||||
const { sendLog } = useAnalytics()
|
const { sendLog } = useAnalytics()
|
||||||
|
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { gameName, imgJson, gnb, eventBanner } = storeToRefs(gameDataStore)
|
||||||
const { pageLayoutType } = storeToRefs(pageDataStore)
|
const { pageLayoutType } = storeToRefs(pageDataStore)
|
||||||
const { isPassedStoveGnb } = storeToRefs(scrollStore)
|
const { isPassedStoveGnb } = storeToRefs(scrollStore)
|
||||||
|
|
||||||
@@ -35,18 +35,18 @@ const navWidth = ref(0)
|
|||||||
const officialItemWidths = ref<number[]>([])
|
const officialItemWidths = ref<number[]>([])
|
||||||
const overflowCount = ref<number>(0)
|
const overflowCount = ref<number>(0)
|
||||||
|
|
||||||
const gnbData = computed(() => gameData.value?.gnb)
|
const biSmallPath = computed(() => imgJson.value?.bi_small)
|
||||||
const gnbMenusCount = computed(() => {
|
const gnbMenusCount = computed(() => {
|
||||||
const menus = gnbData.value?.menus
|
const menus = gnb.value?.menus
|
||||||
if (!menus || typeof menus !== 'object') return 0
|
if (!menus || typeof menus !== 'object') return 0
|
||||||
return Object.keys(menus).length
|
return Object.keys(menus).length
|
||||||
})
|
})
|
||||||
const currentPath = computed(() => formatPathWithoutLocale(route.path))
|
const currentPath = computed(() => formatPathWithoutLocale(route.path))
|
||||||
const start1depthData = computed(
|
const start1depthData = computed(
|
||||||
() => gnbData.value?.buttons[0]?.button_json as GameDataResourceGroup
|
() => gnb.value?.buttons[0]?.button_json as GameDataResourceGroup
|
||||||
)
|
)
|
||||||
const start2depthData = computed(
|
const start2depthData = computed(
|
||||||
() => gnbData.value?.buttons[1]?.button_json as GameDataResourceGroupSet
|
() => gnb.value?.buttons[1]?.button_json as GameDataResourceGroupSet
|
||||||
)
|
)
|
||||||
|
|
||||||
// 자식 중 활성 링크 존재 여부 확인
|
// 자식 중 활성 링크 존재 여부 확인
|
||||||
@@ -60,7 +60,7 @@ const hasActiveChild = (children?: GameDataMenuChildren) => {
|
|||||||
// navAreaRef의 넓이를 구하는 함수
|
// navAreaRef의 넓이를 구하는 함수
|
||||||
const calculateNavWidth = () => {
|
const calculateNavWidth = () => {
|
||||||
if (!import.meta.client) return
|
if (!import.meta.client) return
|
||||||
if (!navAreaRef.value || !gnbData.value) return 0
|
if (!navAreaRef.value || !gnb.value) return 0
|
||||||
|
|
||||||
const navAreaWidth = navAreaRef.value.offsetWidth
|
const navAreaWidth = navAreaRef.value.offsetWidth
|
||||||
navWidth.value = navAreaWidth + MORE_WIDTH
|
navWidth.value = navAreaWidth + MORE_WIDTH
|
||||||
@@ -179,20 +179,17 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<header :class="['header', { 'empty-game': !gnbData }]">
|
<header :class="['header', { 'empty-game': !gnb }]">
|
||||||
<BlocksStoveGnb class="h-[48px]" />
|
<BlocksStoveGnb class="h-[48px]" />
|
||||||
<div
|
<div v-if="gnb" :class="['game-wrap', { 'is-fixed': isPassedStoveGnb }]">
|
||||||
v-if="gnbData"
|
|
||||||
:class="['game-wrap', { 'is-fixed': isPassedStoveGnb }]"
|
|
||||||
>
|
|
||||||
<AtomsLocaleLink
|
<AtomsLocaleLink
|
||||||
to="/home"
|
to="/home"
|
||||||
class="mx-auto md:hidden"
|
class="mx-auto md:hidden"
|
||||||
@click="handleSendLog('BI')"
|
@click="handleSendLog('BI')"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
:src="formatPathHost(gnbData?.bi_path)"
|
:src="formatPathHost(biSmallPath)"
|
||||||
:alt="gameData?.game_name"
|
:alt="gameName"
|
||||||
class="h-[30px]"
|
class="h-[30px]"
|
||||||
/>
|
/>
|
||||||
</AtomsLocaleLink>
|
</AtomsLocaleLink>
|
||||||
@@ -211,8 +208,8 @@ onMounted(() => {
|
|||||||
@click="[handleMenuClose(), handleSendLog('BI')]"
|
@click="[handleMenuClose(), handleSendLog('BI')]"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
:src="formatPathHost(gnbData?.bi_path)"
|
:src="formatPathHost(biSmallPath)"
|
||||||
:alt="gameData?.game_name"
|
:alt="gameName"
|
||||||
class="h-[30px]"
|
class="h-[30px]"
|
||||||
/>
|
/>
|
||||||
</AtomsLocaleLink>
|
</AtomsLocaleLink>
|
||||||
@@ -221,7 +218,7 @@ onMounted(() => {
|
|||||||
<template v-if="gnbMenusCount > 0">
|
<template v-if="gnbMenusCount > 0">
|
||||||
<div class="official custom-theme-scrollbar">
|
<div class="official custom-theme-scrollbar">
|
||||||
<div
|
<div
|
||||||
v-for="(gnbItem, key) in gnbData?.menus"
|
v-for="(gnbItem, key) in gnb?.menus"
|
||||||
:key="key"
|
:key="key"
|
||||||
class="nav-item group"
|
class="nav-item group"
|
||||||
:class="{
|
:class="{
|
||||||
@@ -291,7 +288,7 @@ onMounted(() => {
|
|||||||
<div class="more-list">
|
<div class="more-list">
|
||||||
<div class="list-inner">
|
<div class="list-inner">
|
||||||
<div
|
<div
|
||||||
v-for="(gnbItem, key) in gnbData?.menus"
|
v-for="(gnbItem, key) in gnb?.menus"
|
||||||
:key="key"
|
:key="key"
|
||||||
:class="{
|
:class="{
|
||||||
'is-hidden':
|
'is-hidden':
|
||||||
@@ -349,15 +346,11 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<ClientOnly>
|
<ClientOnly>
|
||||||
<div v-if="gameData?.event_banner" class="event">
|
<div v-if="eventBanner" class="event">
|
||||||
<div class="nav-item">
|
<div class="nav-item">
|
||||||
<AtomsLocaleLink
|
<AtomsLocaleLink
|
||||||
:to="gameData?.event_banner?.page_url"
|
:to="eventBanner?.page_url"
|
||||||
:target="
|
:target="eventBanner?.link_type === 1 ? '_self' : '_blank'"
|
||||||
gameData?.event_banner?.link_type === 1
|
|
||||||
? '_self'
|
|
||||||
: '_blank'
|
|
||||||
"
|
|
||||||
:class="[
|
:class="[
|
||||||
'nav-1depth',
|
'nav-1depth',
|
||||||
{ 'router-link-active': pageLayoutType === 'promotion' },
|
{ 'router-link-active': pageLayoutType === 'promotion' },
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ const {
|
|||||||
setPreregist,
|
setPreregist,
|
||||||
} = usePreregist()
|
} = usePreregist()
|
||||||
|
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { gameId, gameName } = storeToRefs(gameDataStore)
|
||||||
const { sendLog } = useAnalytics()
|
const { sendLog } = useAnalytics()
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
const stoveCs = runtimeConfig.public.stoveCs
|
const stoveCs = runtimeConfig.public.stoveCs
|
||||||
const customerServiceUrl = `${stoveCs}/${gameData.value?.game_id}`
|
const customerServiceUrl = `${stoveCs}/${gameId.value}`
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 번역 함수 (Props로 전달받은 tm 또는 key 반환)
|
* 번역 함수 (Props로 전달받은 tm 또는 key 반환)
|
||||||
@@ -57,8 +57,7 @@ const errorMessages = computed<Record<number, string>>(() => ({
|
|||||||
const tmWithGameName = (key: string): string => {
|
const tmWithGameName = (key: string): string => {
|
||||||
const text = tm(key)
|
const text = tm(key)
|
||||||
if (typeof text === 'string' && text.includes('%게임명%')) {
|
if (typeof text === 'string' && text.includes('%게임명%')) {
|
||||||
const gameName = gameData.value?.game_name ?? ''
|
return text.replace(/%게임명%/g, gameName.value)
|
||||||
return text.replace(/%게임명%/g, gameName)
|
|
||||||
}
|
}
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
@@ -375,7 +374,7 @@ defineExpose({
|
|||||||
<h3
|
<h3
|
||||||
class="text-xl font-bold leading-[30px] tracking-[-0.6px] text-[#ebebeb] md:text-2xl md:leading-[34px] md:tracking-[-0.72px]"
|
class="text-xl font-bold leading-[30px] tracking-[-0.6px] text-[#ebebeb] md:text-2xl md:leading-[34px] md:tracking-[-0.72px]"
|
||||||
>
|
>
|
||||||
{{ gameData?.game_name }}
|
{{ gameName }}
|
||||||
</h3>
|
</h3>
|
||||||
<p
|
<p
|
||||||
class="text-[13px] font-normal leading-[22px] tracking-[-0.325px] text-[#ebebeb] md:text-[15px] md:leading-6 md:tracking-[-0.45px]"
|
class="text-[13px] font-normal leading-[22px] tracking-[-0.325px] text-[#ebebeb] md:text-[15px] md:leading-6 md:tracking-[-0.45px]"
|
||||||
|
|||||||
@@ -100,12 +100,12 @@ const sendSA = (
|
|||||||
if (isEmptyAnalytics(analytics)) return
|
if (isEmptyAnalytics(analytics)) return
|
||||||
|
|
||||||
const gameDataStore = useGameDataStore()
|
const gameDataStore = useGameDataStore()
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { gameCode } = storeToRefs(gameDataStore)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const device = useDevice()
|
const device = useDevice()
|
||||||
|
|
||||||
const gameNo = gameData.value?.game_code
|
const gameNo = gameCode.value
|
||||||
const deviceType = device.isDesktop ? 'pcweb' : 'mobileweb'
|
const deviceType = device.isDesktop ? 'pcweb' : 'mobileweb'
|
||||||
const country = `${csrGetCountry()}`
|
const country = `${csrGetCountry()}`
|
||||||
const memberNo = `${csrGetStoveMemberNo()}`
|
const memberNo = `${csrGetStoveMemberNo()}`
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ export const useCheckGameStart = () => {
|
|||||||
const { handleTokenValidation } = useTokenValidation()
|
const { handleTokenValidation } = useTokenValidation()
|
||||||
const { tm, locale } = useI18n()
|
const { tm, locale } = useI18n()
|
||||||
|
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { gameId } = storeToRefs(gameDataStore)
|
||||||
|
|
||||||
const stoveCs = runtimeConfig.public.stoveCs
|
const stoveCs = runtimeConfig.public.stoveCs
|
||||||
const isProcessing = ref(false) // 연속 클릭 방지
|
const isProcessing = ref(false) // 연속 클릭 방지
|
||||||
const isShowCheckLauncher = ref(false) // 런처 실행 로딩 표시
|
const isShowCheckLauncher = ref(false) // 런처 실행 로딩 표시
|
||||||
const isShowDownloadLauncher = ref(false) // 런처 다운로드 표시
|
const isShowDownloadLauncher = ref(false) // 런처 다운로드 표시
|
||||||
const customerServiceUrl = `${stoveCs}/${gameData.value?.game_id}`
|
const customerServiceUrl = `${stoveCs}/${gameId.value}`
|
||||||
let launcherTimeoutId: ReturnType<typeof setTimeout> | null = null
|
let launcherTimeoutId: ReturnType<typeof setTimeout> | null = null
|
||||||
|
|
||||||
// 에러 처리
|
// 에러 처리
|
||||||
@@ -116,11 +116,8 @@ export const useCheckGameStart = () => {
|
|||||||
const runLauncher = async () => {
|
const runLauncher = async () => {
|
||||||
if (!import.meta.client) return
|
if (!import.meta.client) return
|
||||||
|
|
||||||
const gameDataStore = useGameDataStore()
|
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
|
||||||
|
|
||||||
const accessTokenSub = csrGetAccessToken()
|
const accessTokenSub = csrGetAccessToken()
|
||||||
const stoveGameId = gameData.value?.game_id || ''
|
const stoveGameId = gameId.value || ''
|
||||||
const nationCookie = useCookie('NNTO').value
|
const nationCookie = useCookie('NNTO').value
|
||||||
const localeCode = locale.value.toUpperCase() || 'KO'
|
const localeCode = locale.value.toUpperCase() || 'KO'
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ export const useTokenValidation = () => {
|
|||||||
const gameDataStore = useGameDataStore()
|
const gameDataStore = useGameDataStore()
|
||||||
const { tm } = useI18n()
|
const { tm } = useI18n()
|
||||||
|
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { gameId } = storeToRefs(gameDataStore)
|
||||||
|
|
||||||
const apiBaseUrl = runtimeConfig.public.stoveApiUrl
|
const apiBaseUrl = runtimeConfig.public.stoveApiUrl
|
||||||
const stoveCs = runtimeConfig.public.stoveCs
|
const stoveCs = runtimeConfig.public.stoveCs
|
||||||
const customerServiceUrl = `${stoveCs}/${gameData.value?.game_id}`
|
const customerServiceUrl = `${stoveCs}/${gameId.value}`
|
||||||
const isTokenValid = ref(false)
|
const isTokenValid = ref(false)
|
||||||
|
|
||||||
// 로그인 모달 표시
|
// 로그인 모달 표시
|
||||||
|
|||||||
@@ -9,22 +9,22 @@ export default defineNuxtRouteMiddleware(to => {
|
|||||||
if (to.path.includes('inspection')) return
|
if (to.path.includes('inspection')) return
|
||||||
|
|
||||||
const gameDataStore = useGameDataStore()
|
const gameDataStore = useGameDataStore()
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { langCodes, intro } = storeToRefs(gameDataStore)
|
||||||
|
|
||||||
// app.vue에서 설정한 스토어 값이 없으면 대기
|
// app.vue에서 설정한 스토어 값이 없으면 대기
|
||||||
if (!gameData.value) return
|
if (!langCodes.value || !intro.value) return
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
// [Home Redirect]
|
// [Home Redirect]
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
const gamePath = getPathAfterLanguage(to.path)
|
const gamePath = getPathAfterLanguage(to.path)
|
||||||
const langCode = csrGetFinalLocale(to.path, gameData.value.lang_codes)
|
const langCode = csrGetFinalLocale(to.path, langCodes.value)
|
||||||
|
|
||||||
const isRootPath = gamePath === '' || gamePath === '/'
|
const isRootPath = gamePath === '' || gamePath === '/'
|
||||||
|
|
||||||
if (isRootPath) {
|
if (isRootPath) {
|
||||||
// gameData.intro.page_url이 있으면 해당 URL로 리다이렉트, 없으면 /home으로
|
// intro.page_url이 있으면 해당 URL로 리다이렉트, 없으면 /home으로
|
||||||
const introPageUrl = gameData.value?.intro?.page_url
|
const introPageUrl = intro.value?.page_url
|
||||||
const redirectPath = getIntroRedirectPath(
|
const redirectPath = getIntroRedirectPath(
|
||||||
introPageUrl,
|
introPageUrl,
|
||||||
langCode,
|
langCode,
|
||||||
|
|||||||
@@ -9,17 +9,17 @@ export default defineNuxtRouteMiddleware(async to => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const gameDataStore = useGameDataStore()
|
const gameDataStore = useGameDataStore()
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { gameId, langCodes } = storeToRefs(gameDataStore)
|
||||||
|
|
||||||
// app.vue에서 설정한 스토어 값이 없으면 대기
|
// app.vue에서 설정한 스토어 값이 없으면 대기
|
||||||
if (!gameData.value) return
|
if (!gameId.value || !langCodes.value) return
|
||||||
|
|
||||||
const stoveApiBaseUrl = `${runtimeConfig.public.stoveApiUrl}`
|
const stoveApiBaseUrl = `${runtimeConfig.public.stoveApiUrl}`
|
||||||
// const baseDomain = `${runtimeConfig.public.baseDomain}`
|
// const baseDomain = `${runtimeConfig.public.baseDomain}`
|
||||||
// const stoveMaintenanceApiUrl = `${runtimeConfig.public.stoveMaintenanceApiUrl}`
|
// const stoveMaintenanceApiUrl = `${runtimeConfig.public.stoveMaintenanceApiUrl}`
|
||||||
const stoveGameId = gameData.value.game_id
|
const stoveGameId = gameId.value
|
||||||
|
|
||||||
const finalLocale = csrGetFinalLocale(to.path, gameData.value.lang_codes)
|
const finalLocale = csrGetFinalLocale(to.path, langCodes.value)
|
||||||
|
|
||||||
// 웹 점검 -----
|
// 웹 점검 -----
|
||||||
const { isWebInspection, getInspectionDataExternal } =
|
const { isWebInspection, getInspectionDataExternal } =
|
||||||
|
|||||||
@@ -20,14 +20,13 @@ export default defineNuxtRouteMiddleware(async (to, _from) => {
|
|||||||
const pageDataStore = usePageDataStore()
|
const pageDataStore = usePageDataStore()
|
||||||
const loadingStore = useLoadingStore()
|
const loadingStore = useLoadingStore()
|
||||||
|
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { langCodes } = storeToRefs(gameDataStore)
|
||||||
|
|
||||||
const stoveApiBaseUrl = runtimeConfig.public.stoveApiUrl
|
const stoveApiBaseUrl = runtimeConfig.public.stoveApiUrl
|
||||||
const accessToken = csrGetAccessToken()
|
const accessToken = csrGetAccessToken()
|
||||||
const gameDomain = getGameDomain()
|
const gameDomain = getGameDomain()
|
||||||
const gamePath = getPathAfterLanguage(to.path)
|
const gamePath = getPathAfterLanguage(to.path)
|
||||||
const langCode =
|
const langCode = csrGetFinalLocale(to.path, langCodes.value) || 'ko'
|
||||||
csrGetFinalLocale(to.path, gameData.value?.lang_codes) || 'ko'
|
|
||||||
|
|
||||||
let pageDataResponse: PageDataResponse | null = null
|
let pageDataResponse: PageDataResponse | null = null
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,9 @@ export default defineNuxtPlugin(async nuxtApp => {
|
|||||||
const commonTranslations = 'STOVE_PUBTEMPLATE_common_translations.json'
|
const commonTranslations = 'STOVE_PUBTEMPLATE_common_translations.json'
|
||||||
|
|
||||||
const gameDataStore = useGameDataStore()
|
const gameDataStore = useGameDataStore()
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { langCodes } = storeToRefs(gameDataStore)
|
||||||
const langCodes = gameData.value?.lang_codes
|
|
||||||
|
|
||||||
if (!langCodes || langCodes.length === 0) {
|
if (!langCodes || langCodes.value.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ export default defineNuxtPlugin(async nuxtApp => {
|
|||||||
'zh-cn': 'zh-CN',
|
'zh-cn': 'zh-CN',
|
||||||
}
|
}
|
||||||
|
|
||||||
langCodes.forEach(langCode => {
|
langCodes.value.forEach(langCode => {
|
||||||
// 로케일 코드 변환 (필요한 경우)
|
// 로케일 코드 변환 (필요한 경우)
|
||||||
const normalizedLangCode = localeMap[langCode] || langCode
|
const normalizedLangCode = localeMap[langCode] || langCode
|
||||||
|
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ export default defineEventHandler(async event => {
|
|||||||
const isRootPath = gamePath === '' || gamePath === '/'
|
const isRootPath = gamePath === '' || gamePath === '/'
|
||||||
|
|
||||||
if (isRootPath) {
|
if (isRootPath) {
|
||||||
// gameData.intro.page_url이 있으면 해당 URL로 리다이렉트, 없으면 /home으로
|
// intro.page_url이 있으면 해당 URL로 리다이렉트, 없으면 /home으로
|
||||||
const introPageUrl = gameDataValue?.intro?.page_url
|
const introPageUrl = gameDataValue?.intro?.page_url
|
||||||
const currentFullUrl = event.node.req.url || fullPath
|
const currentFullUrl = event.node.req.url || fullPath
|
||||||
const redirectPath = getIntroRedirectPath(
|
const redirectPath = getIntroRedirectPath(
|
||||||
|
|||||||
@@ -1,26 +1,50 @@
|
|||||||
import type { GameDataValue } from '#layers/types/api/gameData'
|
import type { GameDataValue } from '#layers/types/api/gameData'
|
||||||
|
|
||||||
export const useGameDataStore = defineStore('gameData', () => {
|
export const useGameDataStore = defineStore('gameData', () => {
|
||||||
const gameData = ref<GameDataValue | null>(null)
|
const getInitialState = () => ({
|
||||||
const langCodes = ref<string[] | null>(null)
|
gameData: null as GameDataValue | null,
|
||||||
const defaultLangCode = ref<string | null>(null)
|
gameId: null as GameDataValue['game_id'] | null,
|
||||||
|
gameCode: null as GameDataValue['game_code'] | null,
|
||||||
|
gameName: null as GameDataValue['game_name'] | null,
|
||||||
|
langCodes: null as GameDataValue['lang_codes'] | null,
|
||||||
|
defaultLangCode: null as GameDataValue['default_lang_code'] | null,
|
||||||
|
gaCode: null as GameDataValue['ga_code'] | null,
|
||||||
|
platformType: null as GameDataValue['platform_type'] | null,
|
||||||
|
osType: null as GameDataValue['os_type'] | null,
|
||||||
|
intro: null as GameDataValue['intro'] | null,
|
||||||
|
imgJson: null as GameDataValue['img_json'] | null,
|
||||||
|
snsJson: null as GameDataValue['sns_json'] | null,
|
||||||
|
urlJson: null as GameDataValue['url_json'] | null,
|
||||||
|
gnb: null as GameDataValue['gnb'] | null,
|
||||||
|
eventBanner: null as GameDataValue['event_banner'] | null,
|
||||||
|
})
|
||||||
|
|
||||||
|
const state = reactive(getInitialState())
|
||||||
|
|
||||||
const setGameData = (data: GameDataValue) => {
|
const setGameData = (data: GameDataValue) => {
|
||||||
gameData.value = data
|
state.gameData = data
|
||||||
langCodes.value = data.lang_codes
|
state.gameId = data?.game_id
|
||||||
defaultLangCode.value = data.default_lang_code
|
state.gameCode = data?.game_code
|
||||||
|
state.gameName = data?.game_name
|
||||||
|
state.langCodes = data?.lang_codes
|
||||||
|
state.defaultLangCode = data?.default_lang_code
|
||||||
|
state.gaCode = data?.ga_code
|
||||||
|
state.platformType = data?.platform_type
|
||||||
|
state.osType = data?.os_type
|
||||||
|
state.intro = data?.intro
|
||||||
|
state.imgJson = data?.img_json
|
||||||
|
state.snsJson = data?.sns_json
|
||||||
|
state.urlJson = data?.url_json
|
||||||
|
state.gnb = data?.gnb
|
||||||
|
state.eventBanner = data?.event_banner
|
||||||
}
|
}
|
||||||
|
|
||||||
const clearGameData = () => {
|
const clearGameData = () => {
|
||||||
gameData.value = null
|
Object.assign(state, getInitialState())
|
||||||
langCodes.value = null
|
|
||||||
defaultLangCode.value = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
gameData,
|
...toRefs(state),
|
||||||
langCodes,
|
|
||||||
defaultLangCode,
|
|
||||||
setGameData,
|
setGameData,
|
||||||
clearGameData,
|
clearGameData,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +1,29 @@
|
|||||||
import type { PageDataValue } from '#layers/types/api/pageData'
|
import type { PageDataValue } from '#layers/types/api/pageData'
|
||||||
|
|
||||||
export const usePageDataStore = defineStore('pageData', () => {
|
export const usePageDataStore = defineStore('pageData', () => {
|
||||||
const pageData = ref<PageDataValue | null>(null)
|
// 초기 상태를 함수로 정의
|
||||||
const pageLayoutType = ref<'default' | 'promotion' | null>(null)
|
const getInitialState = () => ({
|
||||||
const pageName = ref<string | null>(null)
|
pageData: null as PageDataValue | null,
|
||||||
const pageNameEn = ref<string | null>(null)
|
pageLayoutType: null as 'default' | 'promotion' | null,
|
||||||
|
pageName: null as PageDataValue['page_name'] | null,
|
||||||
|
pageNameEn: null as PageDataValue['page_name_en'] | null,
|
||||||
|
})
|
||||||
|
|
||||||
|
const state = reactive(getInitialState())
|
||||||
|
|
||||||
const setPageData = (response: PageDataValue) => {
|
const setPageData = (response: PageDataValue) => {
|
||||||
clearPageData()
|
state.pageData = response
|
||||||
|
state.pageLayoutType = getLayoutType(state.pageData)
|
||||||
pageData.value = response
|
state.pageName = state.pageData?.page_name
|
||||||
pageLayoutType.value = getLayoutType(pageData.value)
|
state.pageNameEn = state.pageData?.page_name_en
|
||||||
pageName.value = pageData.value?.page_name
|
|
||||||
pageNameEn.value = pageData.value?.page_name_en
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const clearPageData = () => {
|
const clearPageData = () => {
|
||||||
pageData.value = null
|
Object.assign(state, getInitialState())
|
||||||
pageLayoutType.value = null
|
|
||||||
pageName.value = null
|
|
||||||
pageNameEn.value = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
pageData,
|
...toRefs(state),
|
||||||
pageLayoutType,
|
|
||||||
pageName,
|
|
||||||
pageNameEn,
|
|
||||||
setPageData,
|
setPageData,
|
||||||
clearPageData,
|
clearPageData,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ const { pageNo, pageSize, updatePagination, getPageBlock } = useCouponPaging()
|
|||||||
const gameDataStore = useGameDataStore()
|
const gameDataStore = useGameDataStore()
|
||||||
const modalStore = useModalStore()
|
const modalStore = useModalStore()
|
||||||
const couponStore = useCouponStore()
|
const couponStore = useCouponStore()
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { gameId, gameCode } = storeToRefs(gameDataStore)
|
||||||
const { handleOpenAlert, handleOpenConfirm } = modalStore
|
const { handleOpenAlert, handleOpenConfirm } = modalStore
|
||||||
const { couponNo, isSelectCharacter, selectCharacter } =
|
const { couponNo, isSelectCharacter, selectCharacter } =
|
||||||
storeToRefs(couponStore)
|
storeToRefs(couponStore)
|
||||||
@@ -148,8 +148,8 @@ const validationCheckBefore = async () => {
|
|||||||
* await checkGameMaintenance({
|
* await checkGameMaintenance({
|
||||||
* baseApiUrl: stoveMaintenanceApiUrl,
|
* baseApiUrl: stoveMaintenanceApiUrl,
|
||||||
* category: 'GAME',
|
* category: 'GAME',
|
||||||
* service_id1: gameData.value.game_id,
|
* service_id1: gameId.value,
|
||||||
* gameId: gameData.value.game_id,
|
* gameId: gameId.value,
|
||||||
* lang: locale.value,
|
* lang: locale.value,
|
||||||
* })
|
* })
|
||||||
* if (isGameMaintenance.value) {
|
* if (isGameMaintenance.value) {
|
||||||
@@ -176,8 +176,8 @@ const validationCheckBefore = async () => {
|
|||||||
* await getCharacterList({
|
* await getCharacterList({
|
||||||
* baseApiUrl: stoveApiUrl,
|
* baseApiUrl: stoveApiUrl,
|
||||||
* accessToken: csrGetAccessToken(),
|
* accessToken: csrGetAccessToken(),
|
||||||
* game_id: gameData.value.game_id,
|
* game_id: gameId.value,
|
||||||
* gameId: gameData.value.game_id,
|
* gameId: gameId.value,
|
||||||
* })
|
* })
|
||||||
* if (
|
* if (
|
||||||
* !characterList.value.some(
|
* !characterList.value.some(
|
||||||
@@ -195,7 +195,7 @@ const validationCheckBefore = async () => {
|
|||||||
*/
|
*/
|
||||||
await getInspectionDataExternal({
|
await getInspectionDataExternal({
|
||||||
baseApiUrl: stoveApiUrl,
|
baseApiUrl: stoveApiUrl,
|
||||||
gameId: gameData.value.game_id,
|
gameId: gameId.value,
|
||||||
})
|
})
|
||||||
if (isWebInspection.value) {
|
if (isWebInspection.value) {
|
||||||
return COUPON_RESULT.WEB_INSPECTION
|
return COUPON_RESULT.WEB_INSPECTION
|
||||||
@@ -216,8 +216,8 @@ const validationCheckBefore = async () => {
|
|||||||
await getGuid({
|
await getGuid({
|
||||||
baseApiUrl: stoveApiUrl,
|
baseApiUrl: stoveApiUrl,
|
||||||
accessToken: csrGetAccessToken(),
|
accessToken: csrGetAccessToken(),
|
||||||
game_id: gameData.value.game_id,
|
game_id: gameId.value,
|
||||||
gameId: gameData.value.game_id,
|
gameId: gameId.value,
|
||||||
})
|
})
|
||||||
if (!hasGuid.value) {
|
if (!hasGuid.value) {
|
||||||
return COUPON_RESULT.EMPTY_GUID
|
return COUPON_RESULT.EMPTY_GUID
|
||||||
@@ -311,7 +311,7 @@ const handleCouponRegister = async () => {
|
|||||||
const res = await postCouponUse({
|
const res = await postCouponUse({
|
||||||
accessToken: csrGetAccessToken(),
|
accessToken: csrGetAccessToken(),
|
||||||
user_token_type: 'web',
|
user_token_type: 'web',
|
||||||
game_code: gameData.value.game_code.toString(),
|
game_code: gameCode.value.toString(),
|
||||||
coupon_no: couponNo.value,
|
coupon_no: couponNo.value,
|
||||||
client_ipaddr: clientIp.value,
|
client_ipaddr: clientIp.value,
|
||||||
world_no: selectCharacter.value.world_id,
|
world_no: selectCharacter.value.world_id,
|
||||||
@@ -368,7 +368,7 @@ const handlePeriodSearch = async () => {
|
|||||||
const req: ReqCouponList = {
|
const req: ReqCouponList = {
|
||||||
accessToken: accessToken,
|
accessToken: accessToken,
|
||||||
user_token_type: 'web',
|
user_token_type: 'web',
|
||||||
game_code: gameData.value.game_code.toString(),
|
game_code: gameCode.value.toString(),
|
||||||
start_date: getTime(startDate.value),
|
start_date: getTime(startDate.value),
|
||||||
end_date: getTime(endDate.value),
|
end_date: getTime(endDate.value),
|
||||||
use_state_code: searchStatus.value,
|
use_state_code: searchStatus.value,
|
||||||
@@ -402,7 +402,7 @@ const getCouponBoxUrl = () => {
|
|||||||
url = getStoveCouponUrl('desktop')
|
url = getStoveCouponUrl('desktop')
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${url}?game_id=${gameData.value.game_id}`
|
return `${url}?game_id=${gameId.value}`
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -439,7 +439,7 @@ const goToCouponBox = () => {
|
|||||||
url = getStoveCouponUrl('desktop')
|
url = getStoveCouponUrl('desktop')
|
||||||
}
|
}
|
||||||
|
|
||||||
csrGoExternalLink(`${url}?game_id=${gameData.value.game_id}`)
|
csrGoExternalLink(`${url}?game_id=${gameId.value}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ const pageDataStore = usePageDataStore()
|
|||||||
const { getCwmsArticle } = useCwmsArticle()
|
const { getCwmsArticle } = useCwmsArticle()
|
||||||
const { locale } = useI18n()
|
const { locale } = useI18n()
|
||||||
|
|
||||||
const { gameData } = storeToRefs(gameDataStore)
|
const { urlJson } = storeToRefs(gameDataStore)
|
||||||
const { pageData } = storeToRefs(pageDataStore)
|
const { pageData } = storeToRefs(pageDataStore)
|
||||||
|
|
||||||
|
const communityUrl = computed(() => urlJson.value?.community)
|
||||||
const boardId = computed(
|
const boardId = computed(
|
||||||
() => getComponentGroup(props.components, 'boardId')?.display?.text
|
() => getComponentGroup(props.components, 'boardId')?.display?.text
|
||||||
)
|
)
|
||||||
@@ -101,11 +102,10 @@ const splideOptions = computed(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const getArticleUrl = (articleId: string) => {
|
const getArticleUrl = (articleId: string) => {
|
||||||
const communityUrl = gameData.value?.url_json?.community
|
if (!communityUrl.value || !articleId || !boardId.value) {
|
||||||
if (!communityUrl || !articleId || !boardId.value) {
|
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
return `${communityUrl}/view/${articleId}`
|
return `${communityUrl.value}/view/${articleId}`
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -43,12 +43,12 @@ export interface GameDataValue {
|
|||||||
intro: GameDataIntro
|
intro: GameDataIntro
|
||||||
inspection: Record<string, any>
|
inspection: Record<string, any>
|
||||||
stove_gnb_json: GameDataStoveGnb
|
stove_gnb_json: GameDataStoveGnb
|
||||||
favicon_json: GameDataFavicon
|
favicon_json: GameDataImg
|
||||||
meta_tag_json: GameDataMetaTag
|
meta_tag_json: GameDataMetaTag
|
||||||
sns_json: GameDataSns
|
sns_json: GameDataSns
|
||||||
url_json: Record<string, { url: string }>
|
url_json: Record<string, { url: string }>
|
||||||
footer_json: string // JSON 문자열로 변경
|
footer_json: string // JSON 문자열로 변경
|
||||||
comm_img_json: GameDataCommImg
|
img_json: GameDataImg
|
||||||
market_json: Record<string, { url: string }>
|
market_json: Record<string, { url: string }>
|
||||||
event_banner: GameDataEventBanner
|
event_banner: GameDataEventBanner
|
||||||
os_type: OsType
|
os_type: OsType
|
||||||
@@ -78,8 +78,8 @@ export interface GameDataGameFont {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 파비콘 경로 타입
|
// 파비콘 경로 타입
|
||||||
export interface GameDataFavicon {
|
export interface GameDataImg {
|
||||||
[index: number]: string
|
[key: string]: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// 메타 태그 타입
|
// 메타 태그 타입
|
||||||
@@ -111,20 +111,6 @@ export interface GameDataSns {
|
|||||||
tiktok?: GameDataSnsItem
|
tiktok?: GameDataSnsItem
|
||||||
}
|
}
|
||||||
|
|
||||||
// 공통 이미지 그룹 타입
|
|
||||||
export interface GameDataCommImgGroup {
|
|
||||||
img_name: string
|
|
||||||
img_path: {
|
|
||||||
comm: string
|
|
||||||
}
|
|
||||||
group_label: string
|
|
||||||
}
|
|
||||||
|
|
||||||
// 공통 이미지 타입
|
|
||||||
export interface GameDataCommImg {
|
|
||||||
groups: GameDataCommImgGroup[]
|
|
||||||
}
|
|
||||||
|
|
||||||
// Global 설정 타입
|
// Global 설정 타입
|
||||||
export interface GameDataGlobal {
|
export interface GameDataGlobal {
|
||||||
system_font: string // JSON 문자열로 변경
|
system_font: string // JSON 문자열로 변경
|
||||||
@@ -175,7 +161,6 @@ export interface GameDataMenu {
|
|||||||
// GNB 설정 타입
|
// GNB 설정 타입
|
||||||
export interface GameDataGnb {
|
export interface GameDataGnb {
|
||||||
game_gnb_ver: string
|
game_gnb_ver: string
|
||||||
bi_path: string
|
|
||||||
lang_codes: string // JSON 문자열로 변경
|
lang_codes: string // JSON 문자열로 변경
|
||||||
buttons: GameDataButton[]
|
buttons: GameDataButton[]
|
||||||
menus: GameDataMenuChildren
|
menus: GameDataMenuChildren
|
||||||
|
|||||||
Reference in New Issue
Block a user