fix. 게임스타드 platform_type 별 분리

This commit is contained in:
clkim
2025-12-09 15:14:36 +09:00
parent 5acd43af95
commit 67295a112c
3 changed files with 47 additions and 42 deletions

View File

@@ -45,25 +45,26 @@ const overflowCount = ref<number>(0)
const gnbData = computed(() => gameData.value?.gnb)
const hasGnbMenus = computed(() => {
const menus = gnbData.value?.menus
if (!menus) return false
if (typeof menus !== 'object') return false
if (!menus || typeof menus !== 'object') return false
return Object.keys(menus).length > 0
})
const currentPath = computed(() => formatPathWithoutLocale(route.path))
const gnb1depthButtonData = computed(
const start1depthData = computed(
() => gnbData.value?.buttons[0]?.button_json as GameDataResourceGroup
)
const gnb2depthButtonData = computed(
const start2depthData = computed(
() => gnbData.value?.buttons[1]?.button_json as GameDataResourceGroupSet
)
const supportedPlatforms = computed(
() =>
getSupportedPlatforms(
gameData.value?.os_type,
gameData.value?.platform_type
gameData.value?.platform_type,
gameData.value?.os_type
) as PlatformTransformType[]
)
const isStartPCVisible = computed(() => {
return device.isDesktop && gameData.value?.platform_type !== '2'
})
// 자식 중 활성 링크 존재 여부 확인
const hasActiveChild = (children?: GameDataMenuChildren) => {
@@ -184,7 +185,7 @@ const showNotSupportedOSAlert = () => {
}
const handleStartClick = () => {
if (device.isDesktop) return
if (isStartPCVisible.value) return
const target = device.isAndroid
? 'google_play'
@@ -262,14 +263,14 @@ onMounted(() => {
<template v-if="hasGnbMenus">
<div class="official custom-theme-scrollbar">
<div
v-for="(gnbItem, key) in gnbData?.menus"
:key="key"
v-for="(gnbItem, index) in gnbData?.menus"
:key="index"
class="nav-item group"
:class="{
'is-hidden':
breakpoints.isDesktop &&
overflowCount > 0 &&
Number(key) >=
Number(index) >=
Object.keys(gnbData?.menus).length - overflowCount,
}"
>
@@ -333,13 +334,13 @@ onMounted(() => {
<div class="more-list">
<div class="list-inner">
<div
v-for="(gnbItem, key) in gnbData?.menus"
:key="key"
v-for="(gnbItem, index) in gnbData?.menus"
:key="index"
:class="{
'is-hidden':
breakpoints.isDesktop &&
overflowCount > 0 &&
Number(key) >=
Number(index) >=
Object.keys(gnbData?.menus).length - overflowCount,
}"
>
@@ -422,30 +423,30 @@ onMounted(() => {
</nav>
<ClientOnly>
<div ref="startRef" class="btn-start">
<template v-if="gnb1depthButtonData">
<template v-if="start1depthData">
<component
:is="
device.isDesktop ? 'BlocksButtonLauncher' : 'AtomsButton'
isStartPCVisible ? 'BlocksButtonLauncher' : 'AtomsButton'
"
type="custom"
platform="pc"
:background-color="
getColorCodeFromData(gnb1depthButtonData?.btn_info, 'btn')
getColorCodeFromData(start1depthData?.btn_info, 'btn')
"
:text-color="
getColorCodeFromData(gnb1depthButtonData?.btn_info, 'txt')
getColorCodeFromData(start1depthData?.btn_info, 'txt')
"
@click="handleStartClick"
>
{{ gnb1depthButtonData?.btn_info?.txt_btn_name }}
{{ start1depthData?.btn_info?.txt_btn_name }}
</component>
<div
v-if="breakpoints.isDesktop && gnb2depthButtonData"
v-if="breakpoints.isDesktop && start2depthData"
class="nav-2depth"
>
<ul>
<li v-for="(item, key) in gnb2depthButtonData" :key="key">
<BlocksButtonLauncher type="custom" :platform="key">
<li v-for="(item, index) in start2depthData" :key="index">
<BlocksButtonLauncher type="custom" :platform="index">
{{ item.btn_info?.txt_btn_name }}
</BlocksButtonLauncher>
</li>

View File

@@ -12,10 +12,12 @@ interface Props {
const props = defineProps<Props>()
// Configuration
const runtimeConfig = useRuntimeConfig()
const device = useDevice()
const gameDataStore = useGameDataStore()
const pageDataStore = usePageDataStore()
const dataResourcesUrl = runtimeConfig.public.dataResourcesUrl as string
const multilingualFileName = 'STOVE_PUBTEMPLATE_homepage_brand_preregist.json'
@@ -30,8 +32,8 @@ const { tm, locale }: any = useI18n({
})
const { getOperateResources } = useOperateResources()
const { gameData } = storeToRefs(useGameDataStore())
const { pageData } = storeToRefs(usePageDataStore())
const { gameData } = storeToRefs(gameDataStore)
const { pageData } = storeToRefs(pageDataStore)
// Constants
const COLOR_INDEX = { BACKGROUND: 0, TEXT: 1 } as const
@@ -289,19 +291,21 @@ const handlePreregistClick = () => {
>
{{ tm('Preregist_Btn_Preegist') }}
</BlocksButtonLauncher>
<template
v-for="platform in getSupportedPlatforms(gameData?.os_type, '2')"
:key="`preregist-${platform}`"
>
<BlocksButtonLauncher
v-if="isRunButtonVisible(platform as Platform)"
type="duplication"
:platform="platform as Platform"
:background-color="buttonColors.backgroundColor"
:text-color="buttonColors.textColor"
<template v-if="gameData?.platform_type !== '1'">
<template
v-for="platform in getSupportedPlatforms('2', gameData?.os_type)"
:key="`preregist-${platform}`"
>
{{ tm('Preregist_Btn_Preegist') }}
</BlocksButtonLauncher>
<BlocksButtonLauncher
v-if="isRunButtonVisible(platform as Platform)"
type="duplication"
:platform="platform as Platform"
:background-color="buttonColors.backgroundColor"
:text-color="buttonColors.textColor"
>
{{ tm('Preregist_Btn_Preegist') }}
</BlocksButtonLauncher>
</template>
</template>
</div>
<WidgetsDescription

View File

@@ -23,21 +23,21 @@ const OS_TYPE_MAP: Record<string, string[]> = {
* OS 타입에 따라 가능한 플랫폼 목록을 반환합니다.
*/
export const getSupportedPlatforms = (
osType: OsType,
platformType: PlatformType
platformType: PlatformType,
osType: OsType
): string[] => {
const storePlatforms = OS_TYPE_MAP[osType] ?? []
const osTypes = OS_TYPE_MAP[osType] ?? []
switch (platformType) {
case '1': // PC 전용
return ['pc']
case '2': // 모바일 스토어 전용
return storePlatforms
return osTypes
default:
case '3': // PC + 모바일 스토어 모두
return ['pc', ...storePlatforms]
return ['pc', ...osTypes]
}
}