fix. 액션버튼 api 데이터 수정 적용
This commit is contained in:
@@ -5,12 +5,6 @@ import type {
|
|||||||
} from '#layers/types/api/pageData'
|
} from '#layers/types/api/pageData'
|
||||||
import type { ButtonType } from '#layers/types/components/button'
|
import type { ButtonType } from '#layers/types/components/button'
|
||||||
|
|
||||||
/** 어드민 버튼 유형 (시스템 버튼 / 이미지 버튼) */
|
|
||||||
const BUTTON_CATEGORY = {
|
|
||||||
SYSTEM: 'SYSTEM', // 시스템 버튼
|
|
||||||
IMAGE: 'IMAGE', // 이미지 버튼
|
|
||||||
} as const
|
|
||||||
|
|
||||||
/** 어드민 버튼 타입 */
|
/** 어드민 버튼 타입 */
|
||||||
const BUTTON_ACTION_TYPE = {
|
const BUTTON_ACTION_TYPE = {
|
||||||
URL: 'URL',
|
URL: 'URL',
|
||||||
@@ -26,16 +20,6 @@ const OS_TYPE = {
|
|||||||
PC: 1,
|
PC: 1,
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
const MARKET_TYPE = {
|
|
||||||
PC: 'pc',
|
|
||||||
GOOGLE_PLAY: 'google_play',
|
|
||||||
APP_STORE: 'app_store',
|
|
||||||
} as const
|
|
||||||
|
|
||||||
const LINK_TARGET = {
|
|
||||||
BLANK: '_blank',
|
|
||||||
} as const
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
resourcesData: PageDataResourceGroup[]
|
resourcesData: PageDataResourceGroup[]
|
||||||
buttonSize?: string
|
buttonSize?: string
|
||||||
@@ -58,8 +42,7 @@ const buttonList = computed<PageDataResourceGroup[]>(
|
|||||||
|
|
||||||
/** 버튼 유형이 '시스템 버튼'인지 확인 */
|
/** 버튼 유형이 '시스템 버튼'인지 확인 */
|
||||||
const isSystemButton = (button: PageDataResourceGroup): boolean => {
|
const isSystemButton = (button: PageDataResourceGroup): boolean => {
|
||||||
// [TODO] 어디민 개발 후 수정 필요
|
return button.btn_info?.btn_category === 'system'
|
||||||
return button.btn_info?.btn_category === BUTTON_CATEGORY.SYSTEM
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 버튼 타입이 '게임 실행'인지 확인 */
|
/** 버튼 타입이 '게임 실행'인지 확인 */
|
||||||
@@ -81,7 +64,7 @@ const getButtonType = (btnInfo?: PageDataResourceGroupBtnInfo): ButtonType => {
|
|||||||
const target = btnInfo?.detail?.action?.link_target
|
const target = btnInfo?.detail?.action?.link_target
|
||||||
|
|
||||||
if (btnType === BUTTON_ACTION_TYPE.URL && target) {
|
if (btnType === BUTTON_ACTION_TYPE.URL && target) {
|
||||||
return target === LINK_TARGET.BLANK ? 'external' : 'internal'
|
return target === '_blank' ? 'external' : 'internal'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btnType === BUTTON_ACTION_TYPE.DOWNLOAD) return 'download'
|
if (btnType === BUTTON_ACTION_TYPE.DOWNLOAD) return 'download'
|
||||||
@@ -95,11 +78,11 @@ const isRunButtonVisible = (btnInfo: PageDataResourceGroupBtnInfo): boolean => {
|
|||||||
const marketType = btnInfo?.detail?.market_type
|
const marketType = btnInfo?.detail?.market_type
|
||||||
|
|
||||||
switch (marketType) {
|
switch (marketType) {
|
||||||
case MARKET_TYPE.PC:
|
case 'pc':
|
||||||
return false
|
return false
|
||||||
case MARKET_TYPE.GOOGLE_PLAY:
|
case 'google_play':
|
||||||
return device.isAndroid
|
return device.isAndroid
|
||||||
case MARKET_TYPE.APP_STORE:
|
case 'app_store':
|
||||||
return device.isApple
|
return device.isApple
|
||||||
default:
|
default:
|
||||||
return true
|
return true
|
||||||
@@ -209,20 +192,17 @@ const handleButtonClick = (button: PageDataResourceGroup) => {
|
|||||||
"
|
"
|
||||||
type="duplication"
|
type="duplication"
|
||||||
:platform="button.btn_info?.detail?.market_type"
|
:platform="button.btn_info?.detail?.market_type"
|
||||||
:background-color="getColorCodeFromData(button.btn_info, 'btn')"
|
|
||||||
:text-color="getColorCodeFromData(button.btn_info, 'txt')"
|
|
||||||
@click="handleButtonClick(button)"
|
@click="handleButtonClick(button)"
|
||||||
>
|
>
|
||||||
{{ button.btn_info?.txt_btn_name }}
|
{{ button.btn_info?.txt_btn_name }}
|
||||||
</BlocksButtonLauncher>
|
</BlocksButtonLauncher>
|
||||||
|
|
||||||
<!-- 버튼 유형: 이미지 버튼 + 타입: 기타 -->
|
<!-- 버튼 유형: 이미지 버튼 + 타입: 기타 -->
|
||||||
<!-- [TODO] api 개발 후 수정 필요 (background-image, alt 에 연결 필요) -->
|
|
||||||
<AtomsButtonImage
|
<AtomsButtonImage
|
||||||
v-else-if="!isSystemButton(button) && !isLauncherButton(button)"
|
v-else-if="!isLauncherButton(button)"
|
||||||
:href="button.btn_info?.detail?.action?.url"
|
:href="button.btn_info?.detail?.action?.url"
|
||||||
:background-image="'/images/test.png'"
|
:background-image="formatPathHost(button.btn_info?.res_path)"
|
||||||
alt="test"
|
:alt="button.btn_info?.txt_btn_name"
|
||||||
:disabled="isDisabled(button)"
|
:disabled="isDisabled(button)"
|
||||||
@click="handleButtonClick(button)"
|
@click="handleButtonClick(button)"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ export interface PageDataResourceGroupBtnInfo extends ColorObject {
|
|||||||
btn_category: string
|
btn_category: string
|
||||||
txt_btn_name: string
|
txt_btn_name: string
|
||||||
detail: Record<string, any>
|
detail: Record<string, any>
|
||||||
|
res_path?: string
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
use_game_font: 0 | 1 // 0: 사용하지 않음, 1: 사용함
|
use_game_font: 0 | 1 // 0: 사용하지 않음, 1: 사용함
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user